Skip to main content

OpenAI Compat API

The OpenAI Compat API is a drop-in replacement for OpenAI’s official Images API. Fully compatible with the official openai SDK (Python & Node.js) and the raw OpenAI REST interface — just change the base_url.
No code changes needed — if you already use OpenAI’s images.generate / images.edit, simply override base_url to https://api.mountsea.ai/openai/v1 with your Mountsea API key.

Why Use Compat API?

Official SDK Support

Works with OpenAI’s official openai Python and Node.js SDKs

Same 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 / apiKey parameter

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

Currently n only supports 1. Multi-image generation per request is not yet supported.
  • All standard OpenAI parameters are supported; unknown parameters are ignored gracefully.
  • response_format=url is accepted but gpt-image-2 will still return b64_json.
  • Both openai SDK and raw REST calls work identically.

Explore the API Documentation