🎁 New Sign up free, 10 calls on us. Up to $1, no card needed.

Protocols

Synthorai exposes three input protocols on the same base URL. Choose the one that matches your SDK; the gateway handles protocol translation to the upstream provider transparently.

Protocol Matrix

EndpointSDKIdeal for
POST /v1/chat/completions OpenAI SDK Universal — works for every provider.
e.g. gpt-5.4-mini, qwen3.5-flash, gemini-2.5-flash, claude-sonnet-4-6
POST /v1/responses OpenAI SDK (Responses) Tool use, reasoning, structured output.
e.g. gpt-5.4, gpt-5.4-mini, gpt-5.3-codex
POST /v1/messages Anthropic SDK Claude-native workflows via Anthropic or Bedrock channels.
e.g. claude-sonnet-4-6, claude-opus-4-1

Which should I use?

  • Already using the OpenAI SDK? Keep using it. /v1/chat/completions is the universal path and routes to any configured provider.
  • Already using the Anthropic SDK? Point its baseURL at the gateway and call /v1/messages. Routes to Anthropic or Bedrock-Anthropic channels.
  • Need tool use, reasoning, or structured output on OpenAI models? Use /v1/responses.

All three protocols share the same API key, rate limits, billing, and quota. The only difference is request/response shape — the gateway normalizes everything internally.

Auxiliary endpoints

Beyond the three chat protocols, the gateway also proxies these OpenAI-compatible endpoints:

ParameterTypeDescription
POST /v1/embeddingsembeddingGenerate vector embeddings for text.
POST /v1/images/generationsimageGenerate images from a text prompt.
POST /v1/audio/transcriptionsaudioTranscribe audio to text (multipart/form-data).
POST /v1/audio/speechaudioConvert text to speech audio.
POST /v1/rerankrerankRerank documents against a query.

Streaming

Receive response tokens as they are generated using Server-Sent Events (SSE).

Enable Streaming

Set "stream": true in your request body. The response will be a stream of data: events.

curl https://synthorai.io/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.4-mini",
    "stream": true,
    "messages": [{"role": "user", "content": "Count to 5"}]
  }'

SSE Response Format

data: {"id":"chatcmpl-...","choices":[{"delta":{"content":"1"},"index":0}]}
data: {"id":"chatcmpl-...","choices":[{"delta":{"content":","}}]}
data: {"id":"chatcmpl-...","choices":[{"delta":{"content":"2"}}]}
data: [DONE]

The stream ends with a data: [DONE] event. Parse each line beginning with data: and extract the choices[0].delta.content field.

All of these models — and their per-token prices — are listed on the model price comparison page.