Set up Codex & OpenAI clients
Point OpenAI Codex and any OpenAI-compatible client at TokAPI.
TokAPI implements the OpenAI Responses and Chat Completions APIs, so OpenAI Codex and any OpenAI-compatible SDK or tool work by changing two values: the base URL and the API key.
Base URL and key
| Setting | Value |
|---|---|
| Base URL | https://api.tokapi.ai |
| API key | sk-lazytech-... |
| Auth header | Authorization: Bearer sk-lazytech-... |
Environment variables
Most OpenAI-compatible clients read these:
export OPENAI_BASE_URL="https://api.tokapi.ai/v1"
export OPENAI_API_KEY="sk-lazytech-..."Endpoints
Use the OpenAI-compatible endpoints:
POST /v1/responses— the Responses API (recommended).POST /v1/chat/completions— the Chat Completions API.
Use OpenAI model IDs such as gpt-5.5 or gpt-5.4.
Example — Responses API
curl https://api.tokapi.ai/v1/responses \
-H "Authorization: Bearer sk-lazytech-..." \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.5",
"input": "Write a haiku about fast tokens."
}'Example — Chat Completions API
curl https://api.tokapi.ai/v1/chat/completions \
-H "Authorization: Bearer sk-lazytech-..." \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.4",
"messages": [{ "role": "user", "content": "Hello!" }]
}'Set "stream": true to receive Server-Sent Events. See the
API Reference for the full endpoint list.