Skip to content
API documentation

Connect your agent programs.

OpenAPI proxies model requests through a single REST API at https://api.openapi.shop/v1. Choose a model for each request. The API uses the Chat Completions request and response schema.

26 models7 providersSSE streaming

Your first request

  1. Create a workspace key in your dashboard.
  2. Set it as OPENAPI_API_KEY in your server environment.
  3. Configure your agent program to use the API endpoint and a model ID from the catalog.
terminal
curl https://api.openapi.shop/v1/chat/completions \
  -H "Authorization: Bearer $OPENAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-6-astra",
    "messages": [{ "role": "user", "content": "Hello, world." }]
  }'

Authentication

Pass your workspace key as a bearer token. Keys carry scopes: chat allows completions, models allows catalog reads. /v1/messages also accepts the key in an x-api-key header. Keep keys on your backend, outside browser bundles.

HTTP header
Authorization: Bearer openapi_key_xxxxxxxxxxxxxxxxxxxxx

Model catalog

List models, providers, context windows, and current rates. The response is cacheable for 60 seconds.

terminal
curl https://api.openapi.shop/v1/models \
  -H "Authorization: Bearer $OPENAPI_API_KEY"
Browse models

Chat completions

POST /v1/chat/completions accepts a model ID, message history, and optional generation parameters. Tools, image inputs, and structured output use the same request schema.

request.json
{
  "model": "gpt-6-astra",
  "messages": [
    {
      "role": "system",
      "content": "You are a precise assistant."
    },
    {
      "role": "user",
      "content": "Summarize this contract."
    }
  ],
  "temperature": 0.4,
  "max_tokens": 1024,
  "stream": false
}

Messages (Anthropic-compatible)

POST /v1/messages accepts the Anthropic Messages schema, including system, max_tokens, tools, and stream: true. Any model in the catalog works here: requests for non-Anthropic models are translated to the Chat Completions schema and the response is translated back.

terminal
curl https://api.openapi.shop/v1/messages \
  -H "x-api-key: $OPENAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-6-astra",
    "max_tokens": 512,
    "messages": [{ "role": "user", "content": "Hello." }]
  }'

Responses

POST /v1/responses accepts the Responses API schema: input (a string or a message array) and max_output_tokens. Every catalog model is reachable through it, and stream: true returns response.* events. System instructions are not forwarded upstream.

terminal
curl https://api.openapi.shop/v1/responses \
  -H "Authorization: Bearer $OPENAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-6-luna",
    "input": "Hello.",
    "max_output_tokens": 512
  }'

Streaming

Set stream: true to receive server-sent events. Each event contains an output delta. The stream ends with a [DONE] sentinel.

Errors and retries

HTTPMeaningNext step
400Invalid requestCheck the request schema
401Invalid keyCheck or regenerate your key
403Key lacks scopeUse a key with the chat scope
402Insufficient creditsTop up in billing
404Model not foundCheck the catalog model ID
429Rate limitedRespect Retry-After and retry with backoff
503No healthy providerRetry or select a fallback

Privacy

OpenAPI does not retain request or response bodies by default. Metadata needed for billing and abuse prevention is retained for 30 days. Zero-retention routing is available on paid plans. Providers process requests under their own data policies.

Terms

You are responsible for complying with each provider’s usage policies and applicable law. Consumed credits are non-refundable; unused prepaid credits do not expire. Enterprise agreements may set different terms.