OpenAI-compatible setup
TokenDesk channels speak the OpenAI Chat Completions shape (and, where quoted, Anthropic Messages). After you prepay you receive a base URL, an API key and the model ids for your channel. Replace the placeholders below with those values.
1. Curl
curl https://BASE_URL/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-6.2-sol",
"messages": [{"role":"user","content":"Say hello in one sentence."}]
}'
2. Python (official OpenAI SDK)
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://BASE_URL/v1",
)
r = client.chat.completions.create(
model="gpt-6.2-sol",
messages=[{"role": "user", "content": "Say hello in one sentence."}],
)
print(r.choices[0].message.content)
print("model returned:", r.model)
3. Environment variables for agents
Coding agents (Claude Code, Codex CLIs, Cursor) usually read a base URL and key from the environment. Exact variable names differ by tool — set whatever your agent documents to the values from your quote. See Using Claude Code with a cheaper Claude channel.
4. What to check on the first response
- HTTP 200 and a normal completion.
- The returned
modelfield matches what you requested (no silent swap). - Token usage in the response looks plausible for your prompt.
- Streaming works if you need it (
stream: true).
Base URLs are issued per account and can change if we migrate infrastructure. Always use the value in your latest quote or welcome message — do not hard-code a hostname from this page.
Get a written quote
Tell us your models, supply type, monthly volume and peak TPM/RPM. We reply with the channel, rate, contracted capacity and minimum top-up.