OpenAI-compatible API quickstart: from curl to the official SDK
Looking for an OpenAI-compatible API you can hit in the next five minutes? Point any OpenAI client at https://router.apitoken.sale/v1 with one sk-pool key and the same prepaid balance that already covers Claude. Responses and Chat Completions both stream over SSE, and GPT-6 Astra / GPT-5.6 usage bills at official OpenAI token rates minus your flat 50% discount.
·
Your first GPT-5.6 response in three steps
The whole migration from OpenAI's API to this endpoint is a base URL and a header swap. There is no new SDK to learn, no adapter layer, and no separate account for GPT — the key you may already use for Claude is the same credential here, and the same prepaid balance meters both providers.
- 01Create a free account and generate one API key — it looks like sk-pool-… and already covers supported Claude, Gemini and Kimi models on their own protocol surfaces.
- 02Point your client at https://router.apitoken.sale/v1 and authenticate with Authorization: Bearer — do not send x-api-key; that header belongs to the Anthropic Messages surface and will be rejected here.
- 03Confirm the enabled model set with GET https://router.apitoken.sale/v1/models — the unified catalog namespaces IDs by provider (anthropic/*, openai/*, google/*) — then send the Responses request below.
curl https://router.apitoken.sale/v1/responses \
-H "Authorization: Bearer $APITOKEN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.6-sol",
"input": "Reply with exactly: connected"
}'If the body comes back with output text, you are done — every other client you own is a one-line configuration change away from working the same way.
See also: How to buy a GPT API key
Two constructor arguments switch the official SDK
The official OpenAI SDKs work unchanged. Only base_url and the key change, and the key should live in a server-side environment variable in production — never in client-side code or a committed file.
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["APITOKEN_API_KEY"],
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)Frameworks that hard-code the Chat Completions shape — older LangChain chains, LiteLLM configs, most open-source chat UIs — work on the same host with the same model ID and key:
completion = client.chat.completions.create(
model="gpt-5.6-sol",
messages=[{"role": "user", "content": "Hello"}],
)
print(completion.choices[0].message.content)Which surface should new code target? Responses. Both endpoints stream over SSE with identical models, pricing and discount, but Responses is the surface current OpenAI tooling builds around — it keeps reasoning items and tool calls in one typed stream and exposes conveniences like response.output_text. Chat Completions exists for clients and frameworks that expect the classic messages array; nothing you build on one surface locks you out of the other.
Model IDs, per-token prices and the 272K trap
The served set is pinned and priced in the engine, and GET https://router.apitoken.sale/v1/models is always the live answer. Today the line covers GPT-6 Astra, three GPT-5.6 tiers plus two previous-generation models kept for compatibility:
| Model ID | Tier | Official in / out ($ per 1M) | Cached input |
|---|---|---|---|
| gpt-6-astra | GPT-6 Astra | $10 / $50 | $1 |
| gpt-5.6-sol (alias: gpt-5.6) | Flagship | $4 / $20 (temporary) | $0.40 |
| gpt-5.6-terra | Balanced | $2 / $12 | $0.20 |
| gpt-5.6-luna | Fast | $0.20 / $1.20 | $0.02 |
| gpt-5.5 | Previous flagship | $5 / $30 | $0.50 |
| gpt-5.4 | Previous balanced | $2.50 / $15 | $0.25 |
- Sol's temporary official input/cached/cache-write/output rates are $4/$0.40/$5/$20 through 2026-11-21 inclusive, or $2/$0.20/$2.50/$10 after the flat 50% discount. Standard $5 input and $30 output return on 2026-11-22 UTC.
- Pick by tier: gpt-5.6-sol for the hardest reasoning, gpt-5.6-terra as the daily driver, gpt-5.6-luna for high-volume cheap calls. The alias gpt-5.6 selects Sol, not Astra.
- Reasoning effort is adjustable per request — none through xhigh on every model, plus max on the GPT-5.6 line.
- Every model accepts text and image input and streams over SSE on both Responses and Chat Completions.
- Official tool_choice (none/auto/required/named function/hosted web_search and image_generation), parallel_tool_calls including false, and hosted web_search/image_generation are forwarded; Chat Completions maps those hosted tools onto the same Responses tools.
- Cached input is priced separately and far cheaper than fresh input ($0.40 vs $4 per 1M on promotional Sol) — keeping a stable prompt prefix across calls is real money, not a micro-optimization.
- Your flat 50% B2C discount applies here exactly as it does to Claude usage — one balance, one rate, half off official spend.
The 272K threshold is the trap: above it, OpenAI long-context rates apply to the whole request — 2× on input and 1.5× on output, not just the overflow. On promotional Sol, 270K input plus 2K output costs $1.12 official; 273K plus 2K costs $2.244. Split oversized contexts or trim history before you cross the boundary.
What this endpoint is — and is not
This is an independent OpenAI-compatible service, not the OpenAI Platform. It serves model discovery, streaming Responses and Chat Completions, hosted web_search and image_generation on those text routes, plus dedicated GPT Image 2 generation and edit routes. Audio, file, realtime, assistants, batch and fine-tuning endpoints are not available — if your app depends on those, it is not a candidate for migration. For text, vision, tool calling and the hosted search/image tools above, the surface here is complete: nothing in a standard generate-or-stream or tool loop touches an endpoint that is missing.
- tool_choice none/auto/required, named function, and hosted web_search/image_generation are forwarded (a missing function name is 400).
- parallel_tool_calls including false is forwarded; native serializes function calls when false.
- include:["web_search_call.action.sources"] returns sources on completed search items.
- Responses image_generation forwards output_format jpeg/webp and partial_images 1..=3 (SSE response.image_generation_call.partial_image). background=transparent is rewritten to opaque and input_fidelity is dropped — those fields 400 on this ChatGPT image tool. Separate GPT Image 2 /v1/images/* routes still accept only PNG output.
- Native max_output_tokens/max_tokens cannot be honoured on the Codex wire (400 documented_limitation); omit them. The adapters clip delivered text locally (~4 chars/token) and set incomplete_details.reason=max_output_tokens on Responses.
- Hosted tools other than web_search and image_generation (hosted_shell, code_interpreter, file_search, computer, mcp, skills) are 400 documented_limitation with a named param and a workaround.
Errors arrive in the standard OpenAI envelope — {"error":{"message","type","param","code"}} — so existing error-handling code keeps working. Four status codes cover almost everything you will see while integrating:
- 401 — the key is wrong, revoked, or you sent x-api-key instead of Authorization: Bearer. Reproduce with curl outside your app to isolate which half is broken.
- 400 documented_limitation / unsupported_parameter — a present official field this endpoint cannot honour. The message names the field and the workaround; omit it. Do not retry the identical body.
- 402 insufficient_quota — the shared prepaid balance needs a top-up. HTTP 402, not 429: OpenAI SDKs retry 429. type and code stay insufficient_quota.
- 404 — the model ID is not enabled on your key; check GET https://router.apitoken.sale/v1/models instead of assuming a name from OpenAI's docs exists here.
GPT-6 Astra: latest GPT model
GPT-6 Astra is the latest GPT model in this model catalog. Official fresh/cached/cache-write/output rates are $10/$1/$12.50/$50 per 1M tokens, or $5/$0.50/$6.25/$25 after the flat 50% B2C discount. Codex supports 872K maximum context, 744K conservative input and 128K output. Reasoning efforts are low, medium, high, xhigh and max. Above 272K input, input/cache rates double and output is 1.5×; Fast doubles the applicable rates. The GPT-5.6 examples below retain their own rates.
Frequently asked questions
Can I use my existing OpenAI SDK with a custom base URL?
Yes — pass api_key and base_url="https://router.apitoken.sale/v1" to the official client and everything else stays the same. Keep the key in a server-side environment variable in production.
Does one API key really cover GPT, Claude, Gemini and Kimi?
Yes. One sk-pool key and one prepaid balance serve all four providers; you use the protocol and auth header documented for each surface (Bearer here, x-api-key on the Anthropic Messages endpoint).
Responses API or Chat Completions for a new project?
Responses. Both stream over SSE with the same models and pricing, but Responses is the surface current OpenAI SDKs and tooling build around; Chat Completions exists for clients that expect the classic shape.
Do tool_choice, parallel_tool_calls and hosted web_search/image_generation work?
Yes. Official tool_choice (including required and named tools), parallel_tool_calls including false, and hosted web_search/image_generation are forwarded on Responses; Chat Completions maps those hosted tools onto the same Responses tools. Request include:["web_search_call.action.sources"] for search sources. Native max_output_tokens is clipped locally because the ChatGPT wire rejects it.
Why do I get a 401 on the OpenAI-compatible endpoint?
Almost always the auth header: this endpoint wants Authorization: Bearer sk-pool-…, and the x-api-key header from Anthropic-style setups returns a 401 here.
Use Google or GitHub to create your key and get $5 of platform bonus credit before you top up.