API Reference

Authentication

Send the Aporto API key as a Bearer token on every request:

Authorization: Bearer $APORTO_API_KEY
Content-Type: application/json

The API base is https://api.aporto.tech. OpenAI SDKs use https://api.aporto.tech/v1 as their base URL. Keep keys on the server.

Compatibility paths

CompatibilityPathModel catalog marker
Model discoveryGET /v1/models—
OpenAI Chat CompletionsPOST /v1/chat/completionsopenai
OpenAI ResponsesPOST /v1/responsesopenai-response
Native Gemini generateContentPOST /v1beta/models/{model}:generateContentgemini

Check the endpoint markers beside each model in Models & Pricing. A model is not guaranteed to support every path.

Streaming

For Chat Completions, set "stream": true. The response is a server-sent event stream and finishes with [DONE].

curl -N https://api.aporto.tech/v1/chat/completions \
  -H "Authorization: Bearer $APORTO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"'"$APORTO_MODEL"'","messages":[{"role":"user","content":"Hello"}],"stream":true}'

Responses-compatible models emit Responses API events when stream is true. For native Gemini streaming, use :streamGenerateContent?alt=sse. Clients must consume the body incrementally and should close it when the caller cancels.

Usage and billing

Compatible responses include provider usage data such as input and output token counts. Billing uses the gateway's metered usage and the active tariff for the selected model. Treat client-side estimates as estimates; the account balance and usage history are authoritative.

See Billing for the tariff source and currency calculation.

Errors

StatusMeaningAction
400Invalid request or unsupported parameterCheck the request body and endpoint
401Missing or invalid API keyCheck the Bearer token
404Unknown model or pathRefresh model discovery and endpoint compatibility
429Account, model, or upstream rate limitRespect Retry-After when present and retry with backoff
5xxGateway or upstream failureRecord the request ID and retry only when safe

Error bodies can include more specific gateway or upstream details. Do not depend on provider wording as a stable machine-readable contract.

If a request is rejected for insufficient balance, follow the returned error and add funds in the dashboard; the status code can depend on the compatibility path.

Rate limits and retries

There is no single published request-per-minute number for every model. Limits can vary by account, model, and upstream provider. A 429 response is the runtime signal.

Use exponential backoff with jitter for 429 and transient 5xx responses. Do not automatically retry a generation request when the first request may have completed: duplicate output and duplicate billing are possible.