Documentation

Drop-in replacements for OpenAI and Anthropic APIs. Same SDK, different base URL.

Quick start

  1. Sign up at qubith.ai/signup.
  2. Buy a token package (any tier — tokens never expire).
  3. Create an API key from your dashboard. The key is shown once — save it.
  4. Point your existing SDK at https://ai.qubith.in/v1 and 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": "..."}.

Limits

Need higher limits? Contact us.