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

# OpenAI-compatible API

> Use Floodgate with curl and OpenAI SDKs.

Floodgate implements a standard OpenAI-compatible API at:

```text theme={null}
https://api.floodgate.dev/v1
```

Send your API key as a bearer token in the `Authorization` header:

```http theme={null}
Authorization: Bearer YOUR_API_KEY
```

***

## Available Endpoints

| Endpoint | Method | Purpose |
| :- | :- | :- |
| `/v1/models` | `GET` | List all models available to your account |
| `/v1/chat/completions` | `POST` | Generate chat completions, reasoning, and tool calls |
| `/v1/responses` | `POST` | Responses wire API for Codex CLI and modern agent clients |
| `/v1/images/generations` | `POST` | Generate images using `gpt-image-2` or `gpt-image-2.5` |
| `/v1/images/edits` | `POST` | Edit images or inpaint using text prompts and masks |

***

## Chat Completions

<CodeGroup>
  ```bash cURL theme={null}
  curl "https://api.floodgate.dev/v1/chat/completions" \
    -H "Authorization: Bearer $FLOODGATE_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "gpt-6-sol",
      "messages": [
        {"role": "user", "content": "Write a TypeScript debounce function with proper generics."}
      ],
      "stream": true
    }'
  ```

  ```python Python theme={null}
  import os
  from openai import OpenAI

  client = OpenAI(
      api_key=os.environ["FLOODGATE_API_KEY"],
      base_url="https://api.floodgate.dev/v1",
  )

  response = client.chat.completions.create(
      model="gpt-6-sol",
      messages=[
          {"role": "user", "content": "Explain binary search and its edge cases."}
      ],
  )

  print(response.choices[0].message.content)
  ```

  ```typescript TypeScript theme={null}
  import OpenAI from "openai";

  const client = new OpenAI({
    apiKey: process.env.FLOODGATE_API_KEY,
    baseURL: "https://api.floodgate.dev/v1",
  });

  const response = await client.chat.completions.create({
    model: "gpt-6-sol",
    messages: [
      { role: "user", content: "Explain binary search and its edge cases." }
    ],
  });

  console.log(response.choices[0].message.content);
  ```
</CodeGroup>

***

## Image Generations

Floodgate supports high-performance image generation using `gpt-image-2` ($0.30/call) and `gpt-image-2.5` ($0.40/call).

<CodeGroup>
  ```bash cURL theme={null}
  curl "https://api.floodgate.dev/v1/images/generations" \
    -H "Authorization: Bearer $FLOODGATE_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "gpt-image-2.5",
      "prompt": "A modern minimalist logo of a geometric fox, clean lines, vector art",
      "size": "1024x1024",
      "n": 1
    }'
  ```

  ```python Python theme={null}
  import os
  from openai import OpenAI

  client = OpenAI(
      api_key=os.environ["FLOODGATE_API_KEY"],
      base_url="https://api.floodgate.dev/v1",
  )

  response = client.images.generate(
      model="gpt-image-2.5",
      prompt="A modern minimalist logo of a geometric fox, clean lines, vector art",
      size="1024x1024",
      n=1,
  )

  print(response.data[0].url)
  ```
</CodeGroup>

<Tip>
  For detailed image parameter references, resolution options, and image edit/inpainting examples, read the [Image Generation Guide](/images).
</Tip>

***

## Streaming Responses

Floodgate supports Server-Sent Events (SSE) streaming for all completion models. Simply pass `"stream": true` in your request body:

```python Python Streaming theme={null}
stream = client.chat.completions.create(
    model="gpt-6-luna",
    messages=[{"role": "user", "content": "Count from 1 to 10."}],
    stream=True,
)

for chunk in stream:
    if chunk.choices[0].delta.content is not None:
        print(chunk.choices[0].delta.content, end="", flush=True)
print()
```

<Note>
  Always include the `/v1` prefix in your base URL (`https://api.floodgate.dev/v1`) when configuring OpenAI SDKs or compatible tooling.
</Note>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.