An AI API (Application Programming Interface) lets your software talk to powerful AI models like ChatGPT, DeepSeek, or GLM. Instead of building your own AI from scratch (which costs millions), you send text to an API and get an intelligent response back.
Think of it like a restaurant: your app is the customer, the API is the waiter, and the AI model is the kitchen. You order via the API, and it brings back the "cooked" response.
Before making any API call, you need an API key — it's like a password that identifies your app.
You can also sign up directly with DeepSeek, OpenAI, or others — but you'll need separate accounts and API keys for each provider.
Python is the most popular language for AI development. Here's the simplest possible API call:
pip install openai
import os
from openai import OpenAI
# Set your API key (use environment variables in production!)
client = OpenAI(
api_key="your-tokenease-api-key",
base_url="https://tokenease.io/v1"
)
# Make your first API call
response = client.chat.completions.create(
model="deepseek",
messages=[
{"role": "user", "content": "Hello! What's the capital of France?"}
]
)
# Print the response
print(response.choices[0].message.content)
python first_api_call.py
If everything works, you should see something like:
The capital of France is Paris.
Don't have Python installed? You can test APIs directly from your terminal with cURL:
curl https://tokenease.io/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-tokenease-api-key" \
-d '{
"model": "deepseek",
"messages": [{"role": "user", "content": "Say hello!"}]
}'
cURL is great for quick tests, but for real applications, use a proper programming language.
When you call the API, you get a JSON response. Here's what each part means:
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1722938400,
"model": "deepseek",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "The capital of France is Paris."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 12,
"completion_tokens": 8,
"total_tokens": 20
}
}
| Field | Meaning |
|---|---|
choices[0].message.content | The AI's reply text |
usage.prompt_tokens | How many tokens your question used |
usage.completion_tokens | How many tokens the AI's answer used |
usage.total_tokens | Total cost = prompt + completion |
finish_reason | "stop" = normal finish, "length" = hit token limit |
One of the best things about TokenEase is you can switch models by changing just one parameter:
# DeepSeek (great for coding & reasoning)
model="deepseek"
# GLM-5.1 (excellent Chinese + English)
model="glm"
# Qwen-Plus (strong all-rounder)
model="qwen"
# Kimi K3 (longest context window)
model="kimi"
# Doubao Pro (ByteDance's best model)
model="doubao"
Same code, same API format — just change the model name. This makes it incredibly easy to test which model works best for your use case.
{"error": "Invalid API key"}
Fix: Check your API key is correct and starts with tk_. Make sure you're using the full key without extra spaces.
{"error": "Rate limit exceeded"}
Fix: You're calling the API too fast. Add a small delay between requests or upgrade your plan.
{"error": "Model 'deepseek-v3' not found"}
Fix: Use the exact model name. On TokenEase, the available models are: deepseek, glm, qwen, kimi, doubao.
Fix: Check your internet connection. If using a VPN, try without it. The base URL should be https://tokenease.io/v1.
Now that you've made your first API call, here are projects to try:
API calls are measured in "tokens" (roughly 1 token ≈ 0.75 words). Here's what typical usage costs on TokenEase:
| Use Case | Tokens | Cost |
|---|---|---|
| Short chat message | ~200 | $0.0001 |
| Blog post generation | ~2,000 | $0.001 |
| Code review | ~5,000 | $0.003 |
| Daily developer usage | ~50,000 | $0.03 |
Your $1 free credit is enough for about 1 million tokens — enough to experiment extensively before paying anything.
Base URL: https://tokenease.io/v1
Auth: Bearer tk_xxxxxxxx
Models: deepseek, glm, qwen, kimi, doubao
Format: OpenAI-compatible
Free Credit: $1 (≈1M tokens)
Python: pip install openai
Docs: https://tokenease.io
TokenEase provides unified access to China's best AI models at 40% lower cost than competitors. One API key. Six providers. Zero complexity.