Chat Completions API

Create chat completions with automatic credit tracking.

Create Chat Completion

POST /v1/chat/completions

Creates a chat completion. This endpoint is OpenAI-compatible and works with any OpenAI SDK.

Request

curl https://api.usequota.app/v1/chat/completions \
  -H "Authorization: Bearer sk-quota-your-api-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o",
    "messages": [
      {"role": "user", "content": "Hello!"}
    ]
  }'

Supported Models

ProviderModels
OpenAIgpt-4o, gpt-4o-mini, gpt-4-turbo
Anthropicanthropic/claude-sonnet-4, anthropic/claude-haiku-3.5
Googlegoogle/gemini-2.5-pro, google/gemini-2.5-flash

Response

Returns an OpenAI-compatible response with an additional credits_used field:

{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "created": 1705456789,
  "model": "gpt-4o",
  "choices": [...],
  "usage": {
    "prompt_tokens": 10,
    "completion_tokens": 50,
    "total_tokens": 60
  },
  "credits_used": 3
}