Documentation
Drop-in replacements for OpenAI and Anthropic APIs. Same SDK, different base URL.
Quick start
- Sign up at qubith.ai/signup.
- Buy a token package (any tier — tokens never expire).
- Create an API key from your dashboard. The key is shown once — save it.
- Point your existing SDK at
https://ai.qubith.in/v1and use the key as your bearer token.
OpenAI SDK
Works with both Python and Node.js clients. Just change base_url.
from openai import OpenAI client = OpenAI( base_url="https://ai.qubith.in/v1", api_key="qbk_your_key_here", ) response = client.chat.completions.create( model="trox-prime", messages=[ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Say hi in 5 words."}, ], max_tokens=200, ) print(response.choices[0].message.content)
import OpenAI from "openai"; const client = new OpenAI({ baseURL: "https://ai.qubith.in/v1", apiKey: process.env.QUBITH_API_KEY, }); const reply = await client.chat.completions.create({ model: "trox-prime", messages: [{ role: "user", content: "Hello!" }], max_tokens: 200, }); console.log(reply.choices[0].message.content);
Anthropic SDK
Same setup pattern — just point your Anthropic client at our base URL.
import anthropic client = anthropic.Anthropic( base_url="https://ai.qubith.in", api_key="qbk_your_key_here", ) message = client.messages.create( model="trox-prime", max_tokens=1024, system="You are a helpful assistant.", messages=[{"role": "user", "content": "Say hi in 5 words."}] ) print(message.content[0].text)
cURL
No SDK needed. Both protocols work over plain HTTPS.
curl https://ai.qubith.in/v1/chat/completions \ -H "Authorization: Bearer qbk_your_key_here" \ -H "Content-Type: application/json" \ -d '{ "model": "trox-prime", "messages": [{"role": "user", "content": "Hello!"}], "max_tokens": 200 }'
Streaming
Both protocols support streaming via Server-Sent Events. Just set stream: true in the request body.
# OpenAI streaming — works out of the box for chunk in client.chat.completions.create( model="trox-prime", messages=[{"role": "user", "content": "Tell a story"}], stream=True, ): print(chunk.choices[0].delta.content or "", end="")
Endpoints
All endpoints accept and return JSON. Bearer token in the Authorization header.
POST/v1/chat/completionsOpenAI-compatible chat
POST/v1/messagesAnthropic-compatible messages
GET/v1/modelsList available models
GET/v1/meUser profile + quota
GET/v1/keysList API keys
POST/v1/keysCreate API key (shown once)
DELETE/v1/keys/:idRevoke an API key
GET/v1/usageRecent usage log
GET/v1/billing/plansList available packages
POST/v1/billing/razorpay/create-orderStart a Razorpay checkout
POST/v1/billing/razorpay/verifyConfirm payment client-side
Errors
Standard HTTP status codes with a JSON body containing {"ok": false, "error": "..."}.
401 invalid_key— missing or invalid API key. Check theAuthorizationheader.402 no_quota— your account is out of tokens. Buy more.429 rate_limited— too many requests. Back off and retry. TheRetry-Afterheader is included.503 overloaded— server at concurrent request cap. Retry shortly.503 upstream_cap_reached— we've hit the monthly quota cap.Retry-Aftertells you when to come back.
Limits
- 60 requests/min per API key
- 100,000 tokens/min per API key
- 8 concurrent upstream calls (server-wide)
- 8,000 max_tokens per response on the Power tier
Need higher limits? Contact us.