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

Endpoint quick reference

ProtocolBase URLAuth headerBest for
OpenAI-compatiblehttps://openp.ai/v1Authorization: Bearer sk-...Existing OpenAI SDK code / most models
Claude Messageshttps://openp.ai/v1/messagesx-api-key: sk-... + anthropic-versionClaude thinking / cache_control advanced features
Gemini nativehttps://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

OpenAI-compatible

/v1/chat/completions, /v1/embeddings, /v1/images/*, /v1/audio/*, /v1/responses, /v1/realtime

Claude Messages

/v1/messages, /v1/messages/count_tokens

Gemini native

:generateContent, :streamGenerateContent, :embedContent

Rerank

/v1/rerank — Cohere / Jina compatible

Midjourney

/mj/submit/*, /mj/task/{id}/fetch

Suno

/suno/submit/music, /suno/fetch/{id}

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

Authentication

Auth header formats and examples for the three protocols.

Error codes

HTTP statuses, error structure and troubleshooting tips.

Rate limits

RPM / TPM limits and handling 429.