cURL

Every endpoint from the command line.

Chat completions

shell
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":"Hello"}],"max_completion_tokens":64}'

Messages

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":"Hello"}]}'

Embeddings

shell
curl https://api.topbilling.in/v1/embeddings \
  -H "Authorization: Bearer $TB_API_KEY" -H "content-type: application/json" \
  -d '{"model":"<embedding-model-id>","input":["Hello"]}'

Streaming

shell
curl -N 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":"Hello"}],"stream":true,"stream_options":{"include_usage":true}}'

Models

shell
curl https://api.topbilling.in/v1/models -H "Authorization: Bearer $TB_API_KEY"