> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mountsea.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Introduction

# Introduction to OpenAI

Welcome to the **OpenAI** service documentation!

Mountsea's OpenAI service provides **GPT Image** generation and editing, available in two flavors:

<CardGroup cols={2}>
  <Card title="Async Task API" icon="bolt" href="/api-reference/openai/images-introduction">
    Single unified endpoint `/openai/images` that handles both text-to-image and image editing asynchronously. Returns a `taskId`; poll via `/openai/tasks`.
  </Card>

  <Card title="OpenAI Compat (Official SDK)" icon="plug" href="/api-reference/openai/compat-introduction">
    Drop-in replacement for OpenAI's official Images API. Works with the official `openai` SDK — just change `base_url` to `https://api.mountsea.ai/openai/v1`.
  </Card>
</CardGroup>

## Supported Models

| Model         | Description                                                                                          |
| ------------- | ---------------------------------------------------------------------------------------------------- |
| `gpt-image-2` | Latest OpenAI image model — supports generation, editing, inpainting (mask), and high input fidelity |

## Service Overview

### ⚡ Async Task API (`/openai/images`)

A single unified endpoint that auto-detects the operation based on whether the `image` field is present:

* **Without `image`** → Text-to-image (maps to `/v1/images/generations`)
* **With `image`** → Image editing (maps to `/v1/images/edits`) — supports URL or base64 data URL
* **With `mask`** → Inpainting (transparent areas in mask will be repainted)

Returns a `taskId` immediately; poll `GET /openai/tasks?taskId=...` until the task reaches a terminal state.

[Explore Async API Documentation →](/api-reference/openai/images-introduction)

***

### 🔌 OpenAI Compat (Official SDK)

**Fully compatible** with OpenAI's official Images API:

* **Text-to-Image** — `POST /openai/v1/images/generations` (identical to `https://api.openai.com/v1/images/generations`)
* **Image Editing** — `POST /openai/v1/images/edits` (multipart/form-data, identical to OpenAI)
* **Synchronous** — returns the generated image(s) directly in the response (no polling needed)
* **Official SDK support** — use Python/Node.js `openai` SDK with `base_url` override

[Explore Compat Documentation →](/api-reference/openai/compat-introduction)

***

## When to Use Which?

| Use Case                                                                                                      | Recommended        |
| ------------------------------------------------------------------------------------------------------------- | ------------------ |
| You already have code using the `openai` SDK and want to switch providers without changes                     | **Compat API**     |
| You want a unified endpoint for both generate & edit, with consistent async behavior across Mountsea services | **Async Task API** |
| You need to process many requests in the background and track them by ID                                      | **Async Task API** |
| You want synchronous request/response (single HTTP call → image)                                              | **Compat API**     |

## Base URL

```
https://api.mountsea.ai
```

For the Compat SDK endpoint, set your OpenAI SDK `base_url` to:

```
https://api.mountsea.ai/openai/v1
```

## Authentication

All endpoints require Bearer token authentication:

```
Authorization: Bearer your-api-key
```
