APIHub

Documentation

From creating a key to running in production — usually a few minutes.

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.

  1. 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.
  2. 2Change the base URL in your code to the gateway address below.
  3. 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.

OpenAI / GPT protocol (recommended)
# Base URL
https://apihub.ltd/v1

# Chat Completions
https://apihub.ltd/v1/chat/completions

# Responses
https://apihub.ltd/v1/responses
Anthropic / Claude protocol
# Base URL
https://apihub.ltd

# Messages
https://apihub.ltd/v1/messages

The 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.

OpenAI
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
Anthropic
x-api-key: YOUR_API_KEY
anthropic-version: 2023-06-01
Content-Type: application/json

Streaming

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.

StatusMeaningWhat to do
401Key is invalid, disabled or expiredCheck the key was copied in full, or verify its status in the console.
402Insufficient balanceAdd credit, or check whether the key hit its own spend limit.
403Key may not access the requested modelReview the model allowlist configured on that key.
404Model not found or not enabledCheck the model parameter against the pricing page.
429Rate limit exceededLower concurrency or request rate, and retry with exponential backoff.
500 / 502Upstream provider errorWe 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