OpenAI Compat API
The OpenAI Compat API is a drop-in replacement for OpenAI’s official Images API. Fully compatible with the officialopenai SDK (Python & Node.js) and the raw OpenAI REST interface — just change the base_url.
Why Use Compat API?
Official SDK Support
Works with OpenAI’s official
openai Python and Node.js SDKsSame API Shape
Same request/response format as
https://api.openai.com/v1/images/*Synchronous
Returns the generated image directly — no polling needed
Unified Billing
Single API key, unified usage tracking through Mountsea
Configuration
Base URL
Authentication
Use your Mountsea API key:- HTTP header:
Authorization: Bearer your-api-key - Or set via the SDK’s
api_key/apiKeyparameter
Supported Endpoints
Supported Model
Using the Official openai SDK
Installation
Python
Node.js / TypeScript
Using the REST API Directly
If you don’t want to use the SDK, you can call the endpoints directly.Text-to-Image (JSON)
Image Edit (multipart/form-data)
Inpainting (multipart/form-data)
Request Parameters
images/generations (JSON)
images/edits (multipart/form-data)
All fields above plus:
Response Format
Identical to OpenAI’s official response:gpt-image-2 always returns the image as b64_json. The url response format is only kept for DALL·E compatibility and will be ignored for gpt-image models.Notes & Limitations
- All standard OpenAI parameters are supported; unknown parameters are ignored gracefully.
response_format=urlis accepted but gpt-image-2 will still returnb64_json.- Both
openaiSDK and raw REST calls work identically.
Explore the API Documentation
- images.generate (Compat) — OpenAI-compatible text-to-image endpoint
- images.edit (Compat) — OpenAI-compatible image editing endpoint