---
title: "apiToken.sale — API reference (Claude, GPT & Gemini)"
description: "One unified router endpoint for every provider: native Anthropic Messages, OpenAI Responses and Google Gemini APIs plus an OpenAI-compatible route for any catalog model — base URLs, exact model IDs, headers, streaming, tool use, prompt caching and error codes."
url: "https://apitoken.sale/docs"
language: "en"
---
# API reference — apiToken.sale

apiToken.sale is an independent multi-provider gateway built as a **unified router**. One endpoint — `https://router.apitoken.sale` — serves the **native Anthropic Messages API**, the **native OpenAI Responses API** and the **native Google Gemini API**, plus an **OpenAI-compatible universal route** that reaches every catalog model from any OpenAI-compatible client. One prepaid balance and one `sk-pool-…` key at a flat 50% discount work on every lane. Each lane keeps the official error envelope of that protocol. A present official field this endpoint cannot honour is a fail-closed `400` with `documented_limitation` or `unsupported_parameter` and a workaround in the message — never a silent drop.

## Unified endpoint

- **Base URL:** `https://router.apitoken.sale`
- **Key:** the same `sk-pool-…` on every lane, sent in the header style of the protocol: `x-api-key` (Anthropic), `Authorization: Bearer` (OpenAI lanes), `x-goog-api-key` (Gemini).

| Lane | Endpoints | Auth header |
|---|---|---|
| Anthropic Messages (native) | `POST /v1/messages` · `POST /v1/messages/count_tokens` | `x-api-key` + `anthropic-version` |
| OpenAI Responses (native) | `POST /v1/responses` · `POST /v1/responses/input_tokens` · `GET /v1/responses/{id}` | `Authorization: Bearer` |
| OpenAI-compatible (universal) | `POST /v1/chat/completions` | `Authorization: Bearer` |
| Unified catalog | `GET /v1/models` · `GET /v1/models/{id}` | any lane header |
| Gemini (native) | `GET /v1beta/models` · `POST /v1beta/models/{model}:generateContent` · `POST /v1beta/models/{model}:streamGenerateContent` · `POST /v1beta/models/{model}:countTokens` · `POST /v1beta/models/{model}:batchGenerateContent` · `GET /v1beta/batches/{id}` | `x-goog-api-key` |

- **Model dispatch:** native lanes also serve models of the other providers — `POST /v1/messages` accepts GPT and Gemini models, `POST /v1/responses` and `POST /v1/chat/completions` accept Claude and Gemini models. One client protocol, the whole catalog.
- **Namespaced model IDs:** the unified catalog publishes `anthropic/claude-*`, `openai/gpt-*` and `google/gemini-*`. Prefer namespaced IDs on shared lanes; bare native IDs keep working while they are globally unambiguous.
- **Modalities:** text and image input, text output. The OpenAI-compatible lane does not provide OpenAI Platform Batches, Files, audio, realtime, assistants or fine-tuning. Native Gemini Batch and its account-scoped Files subset are available through the Gemini `/v1beta` routes documented below.

## Claude models (Anthropic lane)

Exact Claude model IDs (use the ID unchanged in the `model` field; on shared lanes the namespaced form is `anthropic/<id>`). Prices are official Anthropic $ per 1M tokens; you pay a flat 50% less on every request.

| model ID | Tier | Context | Max output | Official in / out (per 1M) |
|---|---|---|---|---|
| `claude-fable-5-1` | Mythos | 1M tokens | 128K tokens | $10 / $50 |
| `claude-opus-5` | Opus | 1M tokens | 128K tokens | $5 / $25 |
| `claude-fable-5` | Mythos | 1M tokens | 128K tokens | $10 / $50 |
| `claude-opus-4-8` | Opus | 1M tokens | 128K tokens | $5 / $25 |
| `claude-opus-4-7` | Opus | 1M tokens | 128K tokens | $5 / $25 |
| `claude-sonnet-5` | Sonnet | 1M tokens | 128K tokens | $2 / $10 |
| `claude-sonnet-4-6` | Sonnet | 200K tokens | 128K tokens | $3 / $15 |
| `claude-haiku-4-5` | Haiku | 200K tokens | 64K tokens | $1 / $5 |

## GPT models (OpenAI lanes)

GPT-6 Astra is the latest GPT model: `gpt-6-astra` (namespaced `openai/gpt-6-astra`). It supports 872K maximum Codex context, 744K conservative input and 128K output, with reasoning efforts low, medium, high, xhigh and max. Official fresh/cached/cache-write/output rates are $10/$1/$12.50/$50 per 1M tokens; the flat 50% B2C discount gives $5/$0.50/$6.25/$25.

Exact GPT model IDs (namespaced form `openai/<id>`). Prices are official OpenAI $ per 1M tokens with the same flat 50% discount; cached input bills at 10% of input. GPT-5.6 Sol uses promotional $4/$20 through 2026-11-21 and returns to $5/$30 on 2026-11-22 UTC. Requests above 272K input tokens bill at OpenAI long-context rates (2× input, 1.5× output on the whole request). `gpt-5.6` is an alias of `gpt-5.6-sol`.

| model ID | Tier | Context | Max output | Official in / out (per 1M) |
|---|---|---|---|---|
| `gpt-6-astra` | Flagship | 872K tokens | 128K tokens | $10 / $50 |
| `gpt-5.6-sol` | Flagship | 1.05M tokens | 128K tokens | $4 / $20 |
| `gpt-5.6-terra` | Balanced | 1.05M tokens | 128K tokens | $2 / $12 |
| `gpt-5.6-luna` | Fast | 1.05M tokens | 128K tokens | $0.2 / $1.2 |
| `gpt-5.5` | Flagship | 1.05M tokens | 128K tokens | $5 / $30 |
| `gpt-5.4` | Balanced | 1.05M tokens | 128K tokens | $2.5 / $15 |
| `gpt-image-2` | Image | per request | 1 image | $5 / $30 |

## Gemini models (Gemini lane)

Exact Gemini model IDs (namespaced form `google/<id>`). Prices are official Google $ per 1M tokens with the same flat 50% discount; cached input bills at 10% of input. gemini-3.1-pro-preview requests above 200K input tokens bill at long-context rates (2× input, 1.5× output on the whole request).

| model ID | Tier | Context | Max output | Official in / out (per 1M) |
|---|---|---|---|---|
| `gemini-3.8-flash` | Flash | 1M tokens | 64K tokens | $0.75 / $3.75 |
| `gemini-3.7-flash` | Flash | 1M tokens | 64K tokens | $0.75 / $3.75 |
| `gemini-3.6-flash` | Flash | 1M tokens | 64K tokens | $0.75 / $3.75 |
| `gemini-3.5-flash` | Flash | 1M tokens | 64K tokens | $1.5 / $9 |
| `gemini-3-flash-preview` | Flash | 1M tokens | 64K tokens | $0.5 / $3 |
| `gemini-3.1-pro-preview` | Pro | 1M tokens | 64K tokens | $2 / $12 |
| `gemini-3.1-flash-lite` | Flash-Lite | 1M tokens | 64K tokens | $0.25 / $1.5 |
| `gemini-2.5-flash` | Flash | 1M tokens | 64K tokens | $0.3 / $2.5 |
| `gemini-2.5-flash-lite` | Flash-Lite | 1M tokens | 64K tokens | $0.1 / $0.4 |

Per-model detail pages: https://apitoken.sale/models/claude-fable-5-1, https://apitoken.sale/models/claude-opus-5, https://apitoken.sale/models/claude-fable-5, https://apitoken.sale/models/claude-opus-4-8, https://apitoken.sale/models/claude-opus-4-7, https://apitoken.sale/models/claude-sonnet-5, https://apitoken.sale/models/claude-sonnet-4-6, https://apitoken.sale/models/claude-haiku-4-5, https://apitoken.sale/models/gpt-6-astra, https://apitoken.sale/models/gpt-5-6-sol, https://apitoken.sale/models/gpt-5-6-terra, https://apitoken.sale/models/gpt-5-6-luna, https://apitoken.sale/models/gpt-5-5, https://apitoken.sale/models/gpt-5-4, https://apitoken.sale/models/gpt-image-2, https://apitoken.sale/models/gemini-3-8-flash, https://apitoken.sale/models/gemini-3-7-flash, https://apitoken.sale/models/gemini-3-6-flash, https://apitoken.sale/models/gemini-3-5-flash, https://apitoken.sale/models/gemini-3-flash-preview, https://apitoken.sale/models/gemini-3-1-pro-preview, https://apitoken.sale/models/gemini-3-1-flash-lite, https://apitoken.sale/models/gemini-2-5-flash, https://apitoken.sale/models/gemini-2-5-flash-lite.

## First request (native Anthropic lane, curl)

```bash
curl https://router.apitoken.sale/v1/messages \
  -H "x-api-key: $APITOKEN_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-opus-4-8",
    "max_tokens": 1024,
    "messages": [{"role": "user", "content": "Hello"}]
  }'
```

## First request (OpenAI-compatible universal route, curl)

```bash
curl https://router.apitoken.sale/v1/chat/completions \
  -H "Authorization: Bearer $APITOKEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.6-sol",
    "messages": [{"role": "user", "content": "Reply with exactly: connected"}]
  }'
```

This one route serves the whole catalog: swap the model for `anthropic/claude-opus-4-8` or `google/gemini-3.6-flash` without changing code, endpoint or key. The native OpenAI Responses API is also on this host at `POST https://router.apitoken.sale/v1/responses`.

## First request (native Gemini lane, curl)

```bash
curl https://router.apitoken.sale/v1beta/models/gemini-3.6-flash:generateContent \
  -H "x-goog-api-key: $APITOKEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [{"parts": [{"text": "Reply with exactly: connected"}]}]
  }'
```
## Gemini Batch API

Gemini Batch runs independent non-streaming GenerateContent requests asynchronously. Use either `https://router.apitoken.sale` (recommended) or `https://gemini.api.apitoken.sale`; only the hostname changes. All routes use `x-goog-api-key: sk-pool-…`.

| Method | Path | Purpose |
|---|---|---|
| POST | `/v1beta/models/{model}:batchGenerateContent` | Create an operation |
| GET | `/v1beta/batches/{id}` | Poll and read item results |
| GET | `/v1beta/batches?pageSize={n}&pageToken={token}` | List account operations |
| POST | `/v1beta/batches/{id}:cancel` | Request cancellation |
| DELETE | `/v1beta/batches/{id}` | Delete a terminal operation |
| POST | `/upload/v1beta/files` | Start/continue resumable JSONL upload |
| GET/DELETE | `/v1beta/files/{id}` | Read/delete account-scoped file |
| GET | `/v1beta/files/{id}:download` | Stream or range-download an active file |

### Create and poll inline requests

```bash
export APITOKEN_API_KEY="sk-pool-…"
export GEMINI_BASE="https://router.apitoken.sale"

curl -fsS "$GEMINI_BASE/v1beta/models/gemini-3.6-flash:batchGenerateContent" \
  -H "x-goog-api-key: $APITOKEN_API_KEY" \
  -H "content-type: application/json" \
  -H "Idempotency-Key: product-summary-2026-09-01" \
  -d '{"batch":{"displayName":"Product summaries","inputConfig":{"requests":{"requests":[
    {"request":{"contents":[{"parts":[{"text":"Summarize product A."}]}]},"metadata":{"key":"product-a"}},
    {"request":{"contents":[{"parts":[{"text":"Summarize product B."}]}]},"metadata":{"key":"product-b"}}
  ]}}}}'
```

Save the returned `name` (`batches/batch-…`). Poll `GET /v1beta/{name}` with a delay until `done` is true. Official nested inline results live at `response.inlinedResponses.inlinedResponses[]`: each entry contains either a complete `response` or an item-level `error`. `metadata.batchStats` counters are decimal strings. `done: true` does not by itself mean that every item succeeded. Create returns the full Operation, including `metadata.state` as `BATCH_STATE_*` and RFC 3339 timestamps.

`Idempotency-Key` is an apiToken.sale extension. Exact replay returns the existing operation; reuse with different content returns `409 ABORTED`. Without it, every POST creates another job.

### JSONL file input

Each nonempty line is one object, not a JSON array:

```jsonl
{"key":"product-a","request":{"contents":[{"parts":[{"text":"Summarize product A."}]}]}}
{"key":"product-b","request":{"contents":[{"parts":[{"text":"Summarize product B."}]}]}}
```

Start a resumable upload with `POST /upload/v1beta/files`, `X-Goog-Upload-Protocol: resumable`, `X-Goog-Upload-Command: start`, and the required `X-Goog-Upload-Header-Content-Length`. Follow the relative `X-Goog-Upload-URL`; send non-final 8 MiB chunks with exact `X-Goog-Upload-Offset`, use zero-body command `query` after an ambiguous response, and finalize with `upload, finalize`. Pass the returned `files/{id}` as `batch.inputConfig.fileName`.

### Resource lifecycle

- List jobs with `GET /v1beta/batches?pageSize=20`; pass the returned `nextPageToken` on the next call.
- Read the complete `batches/{id}` with `GET /v1beta/{name}`. Request cancellation with `POST /v1beta/{name}:cancel`; already dispatched items may finish. Delete with `DELETE /v1beta/{name}` only after the operation becomes terminal.
- List files with `GET /v1beta/files?pageSize=20`. Get metadata at `GET /v1beta/files/{id}`; full downloads stream without buffering and one standard `Range: bytes=start-end` request returns 206 for resumable bounded reads. Delete with `DELETE /v1beta/files/{id}` only while no live Batch references it.

### Limits and differences from Google

- Inline create body and one JSONL line: 20 MiB. No product ceiling on items in one job. 100 nonterminal jobs/account, 8 MiB per upload chunk, 2 GiB per file, 20 GiB files/account, 48-hour upload TTL, 48-hour queue deadline, 42-day terminal-result retention.
- Paid create requires a positive account balance and answers HTTP `402 FAILED_PRECONDITION` when the prepaid balance cannot cover the job (not `RESOURCE_EXHAUSTED`, not `429`). Each completed item is charged at settlement. Standard Gemini pricing and the normal account discount apply; there is no separate Batch discount or completion-time SLA.
- This is not Vertex AI Batch: no GCS, BigQuery, Google Cloud IAM, webhooks, embedding/update Batch methods, or image-output Batch models.
- `inputConfig.requests` accepts the official `InlinedRequests` wrapper (`requests.requests[]`) and a raw array. Proto-JSON snake_case aliases (`input_config`, `file_name`, `display_name`) are accepted.
- Gateway files belong to the apiToken.sale account, not a Google project. Foreign Google `files/...` are invisible. `fileData` on synchronous generateContent is `400 INVALID_ARGUMENT` / `FILE_URI_UNSUPPORTED` (`fileData cannot be honoured on this endpoint…`). Use JSONL `fileName` for Batch, or synchronous `inlineData`.
- Inline jobs return nested `response.inlinedResponses.inlinedResponses`. File-input jobs remain `done:false` until an ordered encrypted JSONL output file is atomically published, then return `metadata.output.responsesFile`; download that file and correlate each line by `key`.
- Operation times are RFC 3339 UTC. Batch list supports `pageSize`/`pageToken` and returns Operation metadata. `filter` and `returnPartialSuccess` are refused.
- Ultra subscriptions use up to 20 durable Batch slots; every other plan uses 2. Starts on one subscription are separated by a random durable 2–5 second interval. One client job is never split into child jobs.
- Full file downloads stream; single-range downloads support resumption. A file referenced by live work cannot be deleted.

## Official SDKs

Set the base URL and reuse the official SDKs unchanged.

```python
from anthropic import Anthropic
client = Anthropic(base_url="https://router.apitoken.sale", api_key="sk-pool-…")
msg = client.messages.create(
    model="claude-opus-4-8",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello"}],
)
print(msg.content)
```

```typescript
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({ baseURL: "https://router.apitoken.sale", apiKey: "sk-pool-…" });
const msg = await client.messages.create({
  model: "claude-opus-4-8",
  max_tokens: 1024,
  messages: [{ role: "user", content: "Hello" }],
});
```

```python
from openai import OpenAI
client = OpenAI(api_key="sk-pool-…", base_url="https://router.apitoken.sale/v1")
response = client.responses.create(model="gpt-5.6-sol", input="Reply with exactly: connected")
print(response.output_text)
```

## Coding tools

Claude Code, Cursor, Cline, Continue, Zed, Aider, Roo Code, LangChain and LiteLLM all work by pointing the Anthropic base URL at `https://router.apitoken.sale`. For Claude Code: `export ANTHROPIC_BASE_URL=https://router.apitoken.sale` and `export ANTHROPIC_API_KEY=sk-pool-…`. Codex CLI and OpenAI-compatible tools run on the OpenAI lanes at `https://router.apitoken.sale/v1` — see the integration guides: https://apitoken.sale/md/int. Google GenAI SDKs and Gemini-compatible tools run on the native Gemini lane at `https://router.apitoken.sale` with the key sent as `x-goog-api-key`.

## Capability parity (native lanes)

Provider APIs pass through with the lane-specific notes below:

- **Streaming:** `"stream": true` returns standard Anthropic SSE events; OpenAI lanes stream SSE on both Responses and Chat Completions (including `response.image_generation_call.partial_image` when requested); the Gemini lane streams via `:streamGenerateContent`.
- **Tool use / function calling:** Anthropic `tools` and `tool_choice` pass through unchanged. On OpenAI Responses/Chat Completions, `tool_choice` (`none`/`auto`/`required`/named function/hosted `web_search` and `image_generation`; a missing function name is 400), `parallel_tool_calls` including `false`, function-tool and json_schema `strict`, and hosted `web_search`/`image_generation` are forwarded. Chat Completions maps those hosted tools onto the same Responses tools. Multi-turn tool loops work on every lane.
- **Prompt caching:** Anthropic `cache_control` breakpoints are honored and billed at cache read/write rates; GPT prefixes cache automatically at 10% of input.
- **Vision:** image content blocks are supported. OpenAI Responses `image_generation` also accepts jpeg/webp `output_format` and `partial_images` 1..=3; `background=transparent` is rewritten to opaque and `input_fidelity` is dropped so the turn still runs.
- **System prompts, stop sequences, temperature, top_p:** Anthropic semantics unchanged. Default sampling is accepted. Present `store` / `previous_response_id` / `item_reference` on a non-`openai/*` model is `400 documented_limitation`. Native ChatGPT `max_output_tokens`/`max_tokens` cannot be honoured on the Codex wire — omit them; the adapters clip delivered text locally (~4 chars/token) and set Responses `incomplete_details.reason=max_output_tokens`.

## Error codes

Every lane keeps its provider's error envelope: Anthropic lanes return Anthropic's JSON (gateway limitations add `error.details.error_code` / `param`), OpenAI lanes return `{"error":{"message","type","param","code"}}`, and the Gemini lane returns `{"error":{"code","message","status","details"}}`.

| Status | Meaning | What to do |
|---|---|---|
| 400 | Malformed request, `unsupported_parameter`, or `documented_limitation` | Fix the body. If the branch field is `documented_limitation` or `unsupported_parameter`, omit or relocate the named field — the official API of that protocol accepts it; this endpoint does not. Do not retry unchanged. |
| 401 | API key missing, invalid or revoked | Send a valid `sk-pool-…` in the lane's auth header; if revoked, create a new key. On the native Gemini lane the same failure arrives as 400 `INVALID_ARGUMENT` with `error.details` reason `API_KEY_INVALID`, mirroring the official Google API — treat it like a 401. |
| 402 | Prepaid balance too low | Top up any whole-dollar amount; retry after crediting. Anthropic: `billing_error`. OpenAI: `insufficient_quota` on HTTP 402 (not 429). Gemini native: `FAILED_PRECONDITION`. |
| 404 | Unknown or disabled model ID | List enabled IDs with `GET /v1/models`; check for typos or use the namespaced form. |
| 429 | Rate limit or temporary upstream capacity | Honor `Retry-After`; retry with capped exponential backoff and jitter. |
| 5xx | Temporary gateway or upstream failure | Retry with bounded backoff; keep the request ID and avoid duplicate attempts. |

## Legacy per-provider endpoints

Already integrated? The original per-provider hosts remain fully supported with the same key and balance — no migration required:

- Anthropic Messages: `https://api.apitoken.sale`
- OpenAI-compatible: `https://openai.api.apitoken.sale/v1`
- Gemini: `https://gemini.api.apitoken.sale`

New integrations should use the unified router endpoint above — new capabilities land there first.

## Pricing

Prepaid, per-token at official provider rates minus the flat 50% discount on every request, shared by all lanes. No fixed packages or subscriptions; balance never expires. Pricing details: https://apitoken.sale/md/plans.

## Get started

- Create a key: https://apitoken.sale/register (Google or GitHub sign-up gets $5 of platform bonus credit)
- Agent setup runbook (OS, client detection, secure configuration and verification): https://apitoken.sale/md/connect
- All guides (Markdown): https://apitoken.sale/docs/learn
- Machine-readable index: https://apitoken.sale/md
- Support: Telegram and apitokensale@gmail.com (English, Russian)
