TokenRa
中文Get API Key

Getting started

Quickstart

Three steps from a new account to a working API call.

Create an API key

Create an account, open the console and create a key under API Keys. Keys start with sk-. Keep them on your server, never in browser code.

Store the key in an environment variable

Every example in these docs reads the key from TOKENRA_API_KEY.

SHELL
# macOS / Linux
export TOKENRA_API_KEY="sk-..."

# Windows PowerShell
$env:TOKENRA_API_KEY = "sk-..."

Send your first request

This calls deepseek-v4.1-flash through POST /v1/chat/completions. Any OpenAI SDK works once base_url is https://tokenra.io/v1.

POST /v1/chat/completions
curl https://tokenra.io/v1/chat/completions \
  -H "Authorization: Bearer $TOKENRA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v4.1-flash",
    "messages": [
      {"role": "system", "content": "You are a concise technical assistant."},
      {"role": "user", "content": "Explain in two sentences what an API gateway does."}
    ]
  }'

Set TOKENRA_API_KEY first. Python: pip install openai. JavaScript: save as .mjs and run with Node.js 18+. Java: JDK 17+, run java ClassName.java.

Next steps

  • Stream long answers with "stream": true.
  • Switch models by changing model; IDs are in the model list.
  • Video and image models have their own endpoints, see Seedance 2.0 Pro and GPT Image 2.5 Flare.
  • Claude Code and other Anthropic clients: set ANTHROPIC_BASE_URL=https://tokenra.io and ANTHROPIC_AUTH_TOKEN to your key.