Get started/API Reference

API Reference

Base URL

text
https://dirtcheapai.com/api/v1

Authentication

http
Authorization: Bearer key_xxx

Endpoints

MethodEndpointNotes
POST`/chat/completions`OpenAI-compatible chat requests
POST`/messages`Anthropic-compatible messages
POST`/messages/count_tokens`Count tokens for Anthropic payloads
POST`/responses`OpenAI-compatible Responses API
GET`/models`Current public model catalog
GET`/balance`Remaining balance and package state

POST /chat/completions

Use this when your client already speaks the OpenAI Chat Completions format.

bash
curl https://dirtcheapai.com/api/v1/chat/completions 
  -H Content-Type: application/json 
  -H Authorization: Bearer key_xxx 
  -d '{
    model: gpt-5.4,
    messages: [
      { role: user, content: Summarize this file. }
    ]
  }'

POST /messages

Use this when your client expects Anthropic Messages format.

bash
curl https://dirtcheapai.com/api/v1/messages 
  -H Content-Type: application/json 
  -H Authorization: Bearer key_xxx 
  -H anthropic-version: 2023-06-01 
  -d '{
    model: claude-opus-4.6,
    max_tokens: 512,
    messages: [
      { role: user, content: Hello }
    ]
  }'

POST /messages/count_tokens

Estimate token usage for an Anthropic-style request before you send it.

POST /responses

Use this for clients built around the OpenAI Responses API.

GET /models

Returns the current model catalog from the public API.

GET /balance

Returns the current balance and package state for the API key in the header.