Quickstart — API key
Tokligence speaks the API formats your tools already use. The same account and key work across three drop-in compatible surfaces — point any client at the matching endpoint:
| Format | Endpoint | Used by |
|---|---|---|
| OpenAI Chat Completions | POST https://llm-api.tokligence.ai/v1/chat/completions | OpenAI SDKs, most apps |
| OpenAI Responses | POST https://llm-api.tokligence.ai/v1/responses | Codex CLI |
| Anthropic Messages | POST https://llm-api.tokligence.ai/v1/messages | Claude Code, Anthropic SDKs |
Base URL: https://llm-api.tokligence.ai/v1
Auth: Authorization: Bearer <your-api-key>
- Create an account and get an API key from the dashboard.
- Set the base URL and key in your client — nothing else changes.
Python (OpenAI SDK)
from openai import OpenAI
client = OpenAI(
api_key="tk-...",
base_url="https://llm-api.tokligence.ai/v1",
)
resp = client.chat.completions.create(
model="deepseek-v4-flash", # see /models for the full list
messages=[{"role": "user", "content": "Hello!"}],
)
print(resp.choices[0].message.content)
cURL
Every command below is copy-paste ready for your OS and shell. First, save your key to an environment variable so it isn't pasted into each command:
- macOS / Linux (bash)
- Windows (PowerShell)
- Windows (cmd)
export TOKLIGENCE_API_KEY="tk-..."
$env:TOKLIGENCE_API_KEY="tk-..."
set TOKLIGENCE_API_KEY=tk-...
Then make your first call. Each tab is wrapped for its shell — select the whole block and paste it. The shells differ only in quoting and how the key variable is referenced.
- macOS / Linux (bash)
- Windows (PowerShell)
- Windows (cmd)
curl https://llm-api.tokligence.ai/v1/chat/completions \
-H "Authorization: Bearer $TOKLIGENCE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"deepseek-v4-flash","messages":[{"role":"user","content":"Hello!"}]}'
In PowerShell, use Invoke-RestMethod. Passing a JSON body to curl.exe through PowerShell's argument quoting is unreliable across versions (it can send the backslashes literally and produce invalid JSON). With Invoke-RestMethod the body is a plain single-quoted string handed straight to -Body, so there is nothing to escape:
$headers = @{ "Authorization" = "Bearer $env:TOKLIGENCE_API_KEY" }
$body = '{"model":"deepseek-v4-flash","messages":[{"role":"user","content":"Hello!"}]}'
Invoke-RestMethod `
-Uri "https://llm-api.tokligence.ai/v1/chat/completions" `
-Method Post `
-Headers $headers `
-ContentType "application/json" `
-Body $body
The JSON is double-quoted with the inner quotes backslash-escaped, and the key is read with %...%:
curl https://llm-api.tokligence.ai/v1/chat/completions ^
-H "Authorization: Bearer %TOKLIGENCE_API_KEY%" ^
-H "Content-Type: application/json" ^
-d "{\"model\":\"deepseek-v4-flash\",\"messages\":[{\"role\":\"user\",\"content\":\"Hello!\"}]}"
Coding agents (Claude Code, Codex & Cursor)
Because Tokligence serves the native Anthropic Messages and OpenAI Responses formats, coding agents work against it with no proxy or translation layer — just an environment variable or a config file.
The agent endpoints forward your request to the provider that serves the model. Use a model that natively supports the format you're calling — for example deepseek-v4-flash works for both Claude Code (/v1/messages) and Codex (/v1/responses). Browse the catalogue at llm.tokligence.ai/models.
Claude Code
Point Claude Code at Tokligence with three environment variables, then run it as usual:
- macOS / Linux (bash)
- Windows (PowerShell)
- Windows (cmd)
export ANTHROPIC_BASE_URL="https://llm-api.tokligence.ai"
export ANTHROPIC_AUTH_TOKEN="tk-..." # your Tokligence API key
export ANTHROPIC_MODEL="deepseek-v4-flash" # see /models
claude
To make it stick, add the three export lines to your shell profile (~/.zshrc / ~/.bashrc).
$env:ANTHROPIC_BASE_URL="https://llm-api.tokligence.ai"
$env:ANTHROPIC_AUTH_TOKEN="tk-..." # your Tokligence API key
$env:ANTHROPIC_MODEL="deepseek-v4-flash" # see /models
claude
These variables last for the current PowerShell session. To persist them, use setx (opens a new session to take effect) or set them under System → Environment Variables. Running Claude Code inside WSL is also fully supported — there, use the bash tab.
set ANTHROPIC_BASE_URL=https://llm-api.tokligence.ai
set ANTHROPIC_AUTH_TOKEN=tk-...
set ANTHROPIC_MODEL=deepseek-v4-flash
claude
These set values last for the current cmd session. To persist them, use setx or set them under System → Environment Variables. Running Claude Code inside WSL is also fully supported — there, use the bash tab.
Claude Code sends Anthropic Messages requests to https://llm-api.tokligence.ai/v1/messages, with full tool use and streaming.
Codex
Codex uses the OpenAI Responses API. Add a provider to the Codex config file and select it. The file content is identical on every OS — only its location and how you set the key differ:
model = "deepseek-v4-flash" # see /models
model_provider = "tokligence"
[model_providers.tokligence]
name = "tokligence"
base_url = "https://llm-api.tokligence.ai/v1"
wire_api = "responses"
env_key = "TOKLIGENCE_API_KEY" # Codex reads the key from this env var
- macOS / Linux (bash)
- Windows (PowerShell)
- Windows (cmd)
Config file: ~/.codex/config.toml
export TOKLIGENCE_API_KEY="tk-..." # your Tokligence API key
codex "explain this repository"
Config file: %USERPROFILE%\.codex\config.toml
$env:TOKLIGENCE_API_KEY="tk-..." # your Tokligence API key
codex "explain this repository"
Config file: %USERPROFILE%\.codex\config.toml
set TOKLIGENCE_API_KEY=tk-...
codex "explain this repository"
Codex sends Responses requests to https://llm-api.tokligence.ai/v1/responses, including streaming and reasoning.
Cursor
Cursor is cross-platform — the same setup works on macOS, Linux, and Windows. In Settings → Models, enable an OpenAI-compatible custom provider and fill in:
- Base URL —
https://llm-api.tokligence.ai/v1 - API key — your Tokligence key (
tk-...) - Model — add a model from the catalogue, e.g.
deepseek-v4-flash(see /models)
Cursor then talks to Tokligence over the OpenAI Chat Completions surface.
Discovering models
GET https://llm-api.tokligence.ai/v1/models
Or browse them with live prices at llm.tokligence.ai/models.
Autonomous agents can skip signup and pay per call in USDC via x402.
Next
Most models in the catalogue think before they answer, and that thinking is billed as output tokens. If an answer ever comes back empty, slower than you expected, or pricier than you expected, that is almost always why — see Controlling reasoning.