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.
Your first request
- Create a workspace key in your dashboard.
- Set it as
OPENAPI_API_KEYin your server environment. - Configure your agent program to use the API endpoint and a model ID from the catalog.
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.
Authorization: Bearer openapi_key_xxxxxxxxxxxxxxxxxxxxxModel catalog
List models, providers, context windows, and current rates. The response is cacheable for 60 seconds.
curl https://api.openapi.shop/v1/models \
-H "Authorization: Bearer $OPENAPI_API_KEY"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.
{
"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.
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.
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
| HTTP | Meaning | Next step |
|---|---|---|
| 400 | Invalid request | Check the request schema |
| 401 | Invalid key | Check or regenerate your key |
| 403 | Key lacks scope | Use a key with the chat scope |
| 402 | Insufficient credits | Top up in billing |
| 404 | Model not found | Check the catalog model ID |
| 429 | Rate limited | Respect Retry-After and retry with backoff |
| 503 | No healthy provider | Retry 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.