Quickstart
Make your first TOKI API request with an OpenAI-compatible client.
Before You Start
- Register and sign in at tokiai.ai.
- If you need quota, go to Product Center and choose a Token Plan.
- Open the API Keys page and click Create Key.
- Copy the generated API key and store it securely.
Your API key can be used to call the API. Store it in an environment variable or secret manager, and never expose it in frontend code, public repositories, or client packages.
Make Your First Request
TOKI API follows common OpenAI API request and response formats. You can use standard HTTP requests or an OpenAI-compatible SDK by changing the base URL and API key.
Using the OpenAI SDK (Node.js)
First, install the official OpenAI SDK:
npm install openaiThen, configure it to use the TOKI base URL:
import OpenAI from 'openai';
const openai = new OpenAI({
baseURL: 'https://www.tokiai.ai/v1',
apiKey: process.env.TOKI_API_KEY,
});
const completion = await openai.chat.completions.create({
model: 'deepseek/deepseek-chat-v3',
messages: [
{ role: 'user', content: 'Hello, what can you do?' }
],
});
console.log(completion.choices[0].message.content);The model value should be a model identifier shown on the model page or in the console. Context length, input and output types, and pricing can differ by model.
Using cURL Directly
You can also use the HTTP API with any language:
curl https://www.tokiai.ai/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $TOKI_API_KEY" \
-d '{
"model": "deepseek/deepseek-chat-v3",
"messages": [
{"role": "user", "content": "Hello!"}
]
}'Next Steps
- Authentication — Learn about API key management
- Token Plan — Learn about package purchase and quota usage
- Rate Limits — Understand rate limiting policies
- Models — Explore available models