Use the standard OpenAI SDK to access GPT-4o, Claude, DeepSeek, and GLM models through a single endpoint. 100% API compatible - change only base_url. No vendor lock-in, no SDK changes, no code rewrites.
An OpenAI-compatible API implements the exact same REST API specification as OpenAI's official API. This means:
/v1/chat/completions, /v1/embeddingsfrom openai import OpenAI
client = OpenAI(
api_key="sk-openai-key",
base_url="https://api.openai.com/v1" # OpenAI direct
)
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Hello!"}]
)
from openai import OpenAI
client = OpenAI(
api_key="sk-token1-key",
base_url="https://discount-token.com/v1" # Changed!
)
response = client.chat.completions.create(
model="gpt-4o", # Same model name
messages=[{"role": "user", "content": "Hello!"}]
)
# OR switch to a cheaper model with zero code changes:
# model="deepseek-chat" # 94% cheaper
# model="claude-3-5-sonnet" # Different provider
# model="glm-4-plus" # Bilingual tasks
| Feature | OpenAI API | Token1.US | Notes |
|---|---|---|---|
| Chat Completions | Yes | Yes | Identical format |
| Streaming (SSE) | Yes | Yes | Token-by-token output |
| Function Calling | Yes | Yes | Tools/functions parameter |
| Vision (Image Input) | Yes | Yes | GPT-4o, Claude models |
| JSON Mode | Yes | Yes | Structured output |
| Logprobs | Yes | Yes | Token probabilities |
| Multiple Completions | Yes | Yes | n parameter |
| Seed Parameter | Yes | Yes | Reproducible outputs |
| Multi-model access | GPT only | All models | GPT + Claude + DeepSeek + GLM |
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(
model="deepseek-chat",
api_key="sk-token1-key",
base_url="https://discount-token.com/v1"
)
response = llm.invoke("What is the capital of France?")
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: 'sk-token1-key',
baseURL: 'https://discount-token.com/v1'
});
const response = await client.chat.completions.create({
model: 'claude-3-5-sonnet',
messages: [{ role: 'user', content: 'Hello!' }]
});
curl https://discount-token.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-your-key" \
-d '{
"model": "gpt-4o",
"messages": [{"role": "user", "content": "Hello!"}]
}'
from llama_index.llms.openai import OpenAI
llm = OpenAI(
model="deepseek-chat",
api_key="sk-token1-key",
base_url="https://discount-token.com/v1"
)
gpt-4o - $2.50/$10.00 per 1M tokens, 128K contextgpt-4o-mini - $0.15/$0.60 per 1M tokens, 128K contextclaude-3-5-sonnet - $3.00/$15.00 per 1M tokens, 200K contextclaude-3-5-haiku - $0.80/$4.00 per 1M tokens, 200K contextdeepseek-chat (V3) - $0.14/$0.28 per 1M tokens, 128K contextdeepseek-reasoner (R1) - $0.55/$2.19 per 1M tokens, 128K contextglm-4-plus - $0.70/$0.70 per 1M tokens, 128K contextglm-4-flash - FREE, 128K contextYour code is not tied to any single AI provider. Switch between GPT, Claude, DeepSeek, and GLM by changing one parameter. If a provider has an outage, failover to another instantly.
Route simple tasks to budget models (DeepSeek-V3 at $0.14/1M) and reserve expensive models (GPT-4o) for complex tasks. Typical savings: 70-85%.
One account, one API key, one invoice. No need to manage separate accounts with OpenAI, Anthropic, DeepSeek, and Zhipu AI.
All models use the same API format. Your team only needs to learn one API. Documentation, error handling, and SDK code work across all models.
base_url in your application configurationBASE_URL=https://discount-token.com/v1
No. The request and response formats are identical to OpenAI's API. Parameters like temperature, max_tokens, top_p, frequency_penalty, and presence_penalty all work the same way. Streaming responses use the same SSE format.
Yes. Any tutorial, course, or documentation that uses the OpenAI API works with Token1.US. Simply replace the base_url and API key. The OpenAI Python and JavaScript SDK documentation applies directly.
Token1.US routes requests to the appropriate provider. If one provider is down, you can instantly switch to another model by changing the model parameter. For example, switch from gpt-4o to claude-3-5-sonnet for immediate fallback.
Token1.US adds minimal latency (typically <50ms) through its global CDN. For most use cases, the difference is imperceptible. Streaming time-to-first-token is typically 200-500ms, comparable to direct API access.
Start Using OpenAI-Compatible API