TokiLabsDocs
Reference

API examples

The API matches the official OpenAI and Anthropic formats. Existing code only needs a new base_url and key; nothing else changes.

One key works with every model. Your key is stored only in your own browser and is never uploaded to any server.

Endpoints

MethodPathDescription
POST/v1/messagesAnthropic Messages (native Claude format)
POST/v1/chat/completionsOpenAI Chat Completions
POST/v1/responsesOpenAI Responses (used by Codex)
GET/v1/modelsModels available to the current key

Authentication: the OpenAI format uses Authorization: Bearer sk-...; the Anthropic format uses x-api-key: sk-.... Both headers are accepted.

OpenAI format

Terminal
pip install openai
main.py
from openai import OpenAI

client = OpenAI(
    base_url="https://api.tokilabs.xyz/v1",
    api_key="sk-your-key",
)

resp = client.chat.completions.create(
    model="gpt-6.1-sol",
    messages=[{"role": "user", "content": "Introduce yourself in one sentence"}],
)
print(resp.choices[0].message.content)

Anthropic format

The Anthropic SDK base_url does not include /v1.
Terminal
pip install anthropic
main.py
import anthropic

client = anthropic.Anthropic(
    base_url="https://api.tokilabs.xyz",
    api_key="sk-your-key",
)

msg = client.messages.create(
    model="claude-sonnet-5-5",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Introduce yourself in one sentence"}],
)
print(msg.content[0].text)

Read from environment variables

Both official SDKs read environment variables automatically. Once OPENAI_BASE_URL (set to https://api.tokilabs.xyz/v1) and OPENAI_API_KEY are set, you do not need the endpoint or key in code:

Python
from openai import OpenAI
client = OpenAI()  # Uses OPENAI_BASE_URL and OPENAI_API_KEY automatically
The Anthropic SDK reads its key from ANTHROPIC_API_KEY, while Claude Code uses ANTHROPIC_AUTH_TOKEN. When using the Anthropic SDK in code, also set ANTHROPIC_API_KEY.