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

# API overview

> The entry point to OpenPAI's three protocol endpoints

OpenPAI exposes three protocol endpoints at once, so you can choose freely based on your existing code or the upstream model.

## Endpoint quick reference

| Protocol          | Base URL                                     | Auth header                               | Best for                                           |
| ----------------- | -------------------------------------------- | ----------------------------------------- | -------------------------------------------------- |
| OpenAI-compatible | `https://openp.ai/v1`                        | `Authorization: Bearer sk-...`            | Existing OpenAI SDK code / most models             |
| Claude Messages   | `https://openp.ai/v1/messages`               | `x-api-key: sk-...` + `anthropic-version` | Claude thinking / cache\_control advanced features |
| Gemini native     | `https://openp.ai/v1beta/models/{model}:...` | `x-goog-api-key: sk-...`                  | Gemini multimodal, function\_declarations          |

> The same `sk-` key works across all three endpoints, sharing the account quota.

## API categories

<CardGroup cols={2}>
  <Card title="OpenAI-compatible" icon="o" href="/en/api-reference/openai/chat-completions">
    `/v1/chat/completions`, `/v1/embeddings`, `/v1/images/*`, `/v1/audio/*`, `/v1/responses`, `/v1/realtime`
  </Card>

  <Card title="Claude Messages" icon="a" href="/en/api-reference/anthropic/messages">
    `/v1/messages`, `/v1/messages/count_tokens`
  </Card>

  <Card title="Gemini native" icon="g" href="/en/api-reference/gemini/generate-content">
    `:generateContent`, `:streamGenerateContent`, `:embedContent`
  </Card>

  <Card title="Rerank" icon="arrow-up-9-1" href="/en/api-reference/rerank/create-rerank">
    `/v1/rerank` — Cohere / Jina compatible
  </Card>

  <Card title="Midjourney" icon="paintbrush" href="/en/api-reference/midjourney/imagine">
    `/mj/submit/*`, `/mj/task/{id}/fetch`
  </Card>

  <Card title="Suno" icon="music" href="/en/api-reference/suno/generate">
    `/suno/submit/music`, `/suno/fetch/{id}`
  </Card>
</CardGroup>

## Common conventions

* **Protocol**: HTTPS, HTTP/2 recommended (`curl --http2`).
* **Encoding**: `Content-Type: application/json; charset=utf-8`.
* **Timeout**: server default 600 seconds. Streaming responses keep a long connection, with an idle heartbeat every 15 seconds.
* **Request body size**: default limit 32 MB (after compression).
* **Response headers**:
  * `X-OpenPAI-Request-Id`: the request ID — include it in support tickets to speed up diagnosis.
  * `X-OpenPAI-Group`: the user group this request used.
  * `X-OpenPAI-Quota-Consumed`: the amount charged for this request.
  * `X-OpenPAI-Remaining-Quota`: the account balance after the charge.

## Next steps

<CardGroup cols={2}>
  <Card title="Authentication" icon="key" href="/en/api-reference/authentication">
    Auth header formats and examples for the three protocols.
  </Card>

  <Card title="Error codes" icon="circle-exclamation" href="/en/api-reference/errors">
    HTTP statuses, error structure and troubleshooting tips.
  </Card>

  <Card title="Rate limits" icon="gauge-high" href="/en/api-reference/rate-limits">
    RPM / TPM limits and handling 429.
  </Card>
</CardGroup>
