Quickstart

From a new account to your first request in a few minutes.

  1. Create an account, create a project, then add credits under Billing (top up, or redeem a promo code) and create an API key. New accounts start with zero credit, and every request spends live credits.
  2. Send your first request:
shell
export TB_API_KEY=tb_live_...
curl https://api.topbilling.in/v1/chat/completions \
  -H "Authorization: Bearer $TB_API_KEY" -H "content-type: application/json" \
  -d '{"model":"<model-id>","messages":[{"role":"user","content":"Say hello"}]}'
  1. Or the Anthropic-compatible endpoint:
shell
curl https://api.topbilling.in/v1/messages \
  -H "x-api-key: $TB_API_KEY" -H "anthropic-version: 2023-06-01" -H "content-type: application/json" \
  -d '{"model":"<model-id>","max_tokens":64,"messages":[{"role":"user","content":"Say hello"}]}'
  1. Open Usage to see the request, its tokens and its charge. Replace <model-id> with a model from Models.

In your language

POST /v1/chat/completions
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["TB_API_KEY"],
    base_url="https://api.topbilling.in/v1",
)

response = client.chat.completions.create(
    model="<model-id>",
    messages=[{"role": "user", "content": "Say hello"}],
)
print(response.choices[0].message.content)
There is no sandbox or free test mode: every request is served by the model you name and charged to your credits at the published price.