API Docs
Get Started

Choose a Protocol

Choosing between OpenAI-compatible and Anthropic-compatible, how Chat Completions and Responses differ, and the Responses-only models.

UnioAPI serves each protocol natively: whichever protocol you choose, you use that protocol's request, response, streaming events and error structure, with the same field semantics as the official API.

Endpoint overview

Protocol familyEndpointPurpose
OpenAI-compatiblePOST /v1/chat/completionsChat completions, non-streaming and SSE
OpenAI-compatiblePOST /v1/responsesResponses, non-streaming, SSE and WebSocket
OpenAI-compatibleGET /v1/modelsList callable models, capability tags and endpoints
Anthropic-compatiblePOST /v1/messagesMessage generation, non-streaming and named SSE

How to choose

  • OpenAI models (gpt-*): use OpenAI-compatible with base URL https://api.unioapi.com/v1. Works with OpenAI SDKs and tools such as Codex, Cursor, TRAE and OpenCode.
  • Claude models (claude-*): use Anthropic-compatible with base URL https://api.unioapi.com and send the anthropic-version header. Works with Anthropic SDKs and Claude Code.
  • One API key works on every endpoint. The endpoints each model offers are listed in endpoint_capabilities of GET /v1/models.

Chat Completions vs Responses

Both endpoints call OpenAI models and both run requests as-is in the official OpenAI format. They differ exactly as in the official API:

Chat CompletionsResponses
Request shapemessages arrayinput (string or item array)
Streamingdata-only SSE ending with [DONE]named SSE events, no [DONE]; WebSocket also available
12-hour cache writesNot availableAvailable — see Caching & TTL
Responses-only modelsReturn 404Callable
Server-stored Responses—Not stored; send the full input every time — see POST /v1/responses

service_tier takes the same values and rules on both endpoints — see Service Tiers.

Responses-only models

gpt-5.5-pro, gpt-5.4-pro and gpt-5.2-pro list only openai.responses in endpoint_capabilities. Calling them through Chat Completions returns the same error as the official API:

{
  "error": {
    "message": "This model is only supported in v1/responses and not in v1/chat/completions.",
    "type": "invalid_request_error",
    "param": "model",
    "code": null
  }
}

The HTTP status is 404. Use POST /v1/responses instead.

Calling a model over the other vendor's protocol

If a model's endpoint_capabilities also lists the other vendor's endpoint (for example a Claude model listing openai.chat_completions), requests through that endpoint are converted to the model's native form:

  • Only the meaning of that protocol's public fields is guaranteed; fields whose meaning cannot be kept return 400 unsupported_parameter (400 invalid_request_error in the Anthropic shape);
  • Only the standard tier is available (service_tier omitted, auto or default; speed omitted or standard); other values return 400;
  • For calls that depend on every field, use the model vendor's own protocol.

Boundaries

  • Brand names only indicate the compatible protocol family; they do not imply official partnership or endorsement.
  • Stateful Responses operations (retrieve, delete or cancel by ID) return 404 and background: true returns 400 — see POST /v1/responses.