Quick Start: Your First API Call in 5 Minutes
Target audience: Developers Last updated: 2026-08-06
This guide walks you through making your first API call from scratch and seeing a model response in 5 minutes.
You can find the platform API endpoint in the console. The OpenAI Compatible route prefix is
/v1, and authentication usesAuthorization: Bearer sk-xxx. You can also check your available Base URL on the "API Key" page in the console.
Prerequisites
Before you begin, make sure you have:
- An active platform account (register an organization account yourself, or complete registration as a member user using an activation code)
- Available balance / quota on the account (charges are always deducted from the owning organization's balance; if the quota is 0, contact your organization)
Step 1: Get Your API Key
In v2, API Keys are created by the admin user in the console:
-
If you are the admin user:
- Log in to the console
- Go to the "API Key" page
- Click "Create API Key", give it a name (e.g.,
my-first-key), and select a group (required) - Copy and save the Key immediately after creation (it looks like
sk-xxxxxxxx) — it is only displayed in full once
-
If you are a member user: You can create Keys on the "API Key" page (group selection is limited to those authorized by the admin user); the admin user can also create and distribute Keys on your behalf.
Member users can create Keys on the "API Key" page (a group must be selected, and only groups authorized by the admin user are available); the admin user can also create and distribute Keys on your behalf.
Note: An API Key is equivalent to a password. Never commit it to a code repository or share it publicly.
After obtaining your Key, you also need to determine what to put in the model field — see the next step.
Step 2: Get the Model Call Name
You can find standard model names (e.g., deepseek-v4-flash) on the model plaza, the "default model configuration" page in the console, or via the /v1/models API. In most cases, you can use the model name directly.
If the admin user has enabled group identifier routing, the "call guide" page will also display call names with a group identifier prefix (e.g., 5MHXZWKA/deepseek-v4-flash), which targets a specific group. When this feature is not enabled, calls with a group identifier prefix will be rejected.
For detailed routing rules, see Call Guide and Routing. The examples in this guide use the plain model name.
Step 3: Send Your First Request (curl)
Replace YOUR_API_KEY with your Key and model with the call name you copied from the call guide, then run the following command in your terminal:
curl https://<your-api-endpoint>/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-v4-flash",
"messages": [
{"role": "user", "content": "用一句话介绍你自己"}
]
}'If everything is set up correctly, you will receive a response similar to this:
{
"id": "chatcmpl-xxx",
"object": "chat.completion",
"model": "deepseek-v4-flash",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "我是一个 AI 助手,可以帮你解答问题、编写代码、处理文本。"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 12,
"completion_tokens": 20,
"total_tokens": 32
}
}Congratulations — you have completed your first API call!
Step 4: Call with Python
For a more realistic development experience, use the official OpenAI SDK (just change base_url and api_key):
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://<your-api-endpoint>"
)
resp = client.chat.completions.create(
model="deepseek-v4-flash",
messages=[
{"role": "user", "content": "用一句话介绍你自己"}
]
)
print(resp.choices[0].message.content)Install the dependency: pip install openai
Common Troubleshooting
| Symptom | Possible Cause | Solution |
|---|---|---|
401 Unauthorized |
Incorrect Key or missing Bearer prefix |
Check the Authorization header format |
403 / Insufficient balance or quota |
The owning organization's balance is 0, or the member user's quota is capped | Contact the organization to top up / increase the quota |
| Model unavailable / not found | Incorrect call name, or the model is not within your account's available scope | Copy the call name from the call guide and confirm your available scope |
Group identifier returns fingerprint_routing_disabled / group_not_allowed |
The group is not in the available scope, the account is unavailable, or group identifier routing is not enabled | See Call Guide and Routing |
429 |
Quota / rate limit exhausted | Reduce request frequency; see Error Codes and Troubleshooting |
For a complete list of error codes, see Error Codes and Troubleshooting.
Next Steps
- Learn about routing rules → Call Guide and Routing
- Explore more parameters and streaming output → API Call Basics
- Integrate with an SDK / framework → SDK Integration
- Connect Claude Code / Cursor → Third-Party Tool Integration