Quickstart
Our API is wire-compatible with OpenAI's. Any client, SDK or tool that lets you set a custom base URL will work without modification.
- 1Create a key on the API Keys page in your console. Copy it immediately — the full value is shown once and cannot be retrieved later.
- 2Change the base URL in your code to the gateway address below.
- 3Replace your official API key with the one you just created, and leave every other parameter as it is.
Endpoints
Pick the base URL matching your SDK's protocol — the client appends the endpoint path to it. The same API key works for both.
# Base URL
https://apihub.ltd/v1
# Chat Completions
https://apihub.ltd/v1/chat/completions
# Responses
https://apihub.ltd/v1/responses# Base URL
https://apihub.ltd
# Messages
https://apihub.ltd/v1/messagesThe OpenAI base URL already includes /v1, and clients append /chat/completions or /responses to it; the Anthropic base URL is the root, and clients append /v1/messages. If a duplicated /v1 causes a 404, adjust the base URL accordingly.
Authentication
Every request carries your API key in an HTTP header. Use whichever form matches your protocol.
Authorization: Bearer YOUR_API_KEY
Content-Type: application/jsonx-api-key: YOUR_API_KEY
anthropic-version: 2023-06-01
Content-Type: application/jsonStreaming
Set stream to true to receive SSE chunks. The event format matches the official one exactly and terminates with data: [DONE].
curl https://apihub.ltd/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-5",
"messages": [{"role": "user", "content": "Hello!"}],
"stream": true
}'
# data: {"choices":[{"delta":{"content":"He"}}]}
# data: {"choices":[{"delta":{"content":"llo"}}]}
# data: [DONE]Error codes
Error responses mirror the official shape, so your existing error handling keeps working.
| Status | Meaning | What to do |
|---|---|---|
| 401 | Key is invalid, disabled or expired | Check the key was copied in full, or verify its status in the console. |
| 402 | Insufficient balance | Add credit, or check whether the key hit its own spend limit. |
| 403 | Key may not access the requested model | Review the model allowlist configured on that key. |
| 404 | Model not found or not enabled | Check the model parameter against the pricing page. |
| 429 | Rate limit exceeded | Lower concurrency or request rate, and retry with exponential backoff. |
| 500 / 502 | Upstream provider error | We fail over automatically; contact support if it persists. |
Third-party clients
These all work out of the box — just set a custom base URL and API key in their settings.
- Desktop and web clients such as Cherry Studio, ChatBox and LobeChat
- Coding assistants such as Cursor, Continue and Cline
- Workflow and RAG platforms such as Dify, n8n and FastGPT
- Any in-house application built on the official OpenAI SDK
Can't find what you need?
Contact support