OpenAI-compatible API guide
Use the official OpenAI SDK with TokenMilo by changing base_url and api_key — for GPT-6 models and for Claude.
Updated 2026-11-16
1. Endpoints
| Base URL | https://api.tokenmilo.com/v1 |
| Chat Completions | POST https://api.tokenmilo.com/v1/chat/completions |
| Responses | POST https://api.tokenmilo.com/v1/responses |
| Models | GET https://api.tokenmilo.com/v1/models |
Auth: Authorization: Bearer sk-.... Create keys in the console.
2. curl
curl https://api.tokenmilo.com/v1/chat/completions \
-H "Authorization: Bearer $TOKENMILO_API_KEY" \
-H "content-type: application/json" \
-d '{"model": "gpt-6.1-sol", "messages": [{"role": "user", "content": "Hello"}]}'3. Python
# pip install openai
import os
from openai import OpenAI
client = OpenAI(base_url="https://api.tokenmilo.com/v1", api_key=os.environ["TOKENMILO_API_KEY"])
res = client.chat.completions.create(
model="gpt-6.1-sol",
messages=[{"role": "user", "content": "Hello"}],
)
print(res.choices[0].message.content)
r = client.responses.create(model="gpt-6-astra", input="Summarise the benefits of HTTP/3")
print(r.output_text)
# Claude through the same SDK — just change the model ID
res = client.chat.completions.create(
model="claude-sonnet-5-5",
messages=[{"role": "user", "content": "Hello"}],
)4. Node.js
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.tokenmilo.com/v1", apiKey: process.env.TOKENMILO_API_KEY });
const res = await client.chat.completions.create({
model: "gpt-6.1-sol",
messages: [{ role: "user", content: "Hello" }],
});
console.log(res.choices[0].message.content);FAQ
Can I call Claude through the OpenAI API?
Yes, for regular chat via Chat Completions. For prompt caching and other Claude-specific features, use the native Anthropic Messages API.
Related guides
- Quickstart — Get a key and make your first request in minutes.
- Claude API guide (Anthropic Messages) — Endpoints, auth, streaming, prompt caching and errors.
- Claude Code setup — Run Claude Code with a TokenMilo key on macOS, Linux and Windows.
- Codex CLI setup — Use OpenAI Codex CLI with GPT-6 via a custom provider.
- Cursor setup — Add Claude and GPT models to Cursor with your own key.
Need an API key?
Sign up at TokenMilo, top up, and create a key in the console in under a minute.