docs/api/getting-started.mdx
This guide walks you through creating an API key and making your first Chat Completions request.
curl or any HTTP client (Python, Node.js, etc.)Replace YOUR_API_KEY with the key you just created:
curl -X POST https://api.cline.bot/api/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "anthropic/claude-sonnet-4-6",
"messages": [
{"role": "user", "content": "What is the capital of France?"}
],
"stream": false
}'
You should get a JSON response like this:
{
"id": "gen-abc123",
"model": "anthropic/claude-sonnet-4-6",
"choices": [
{
"message": {
"role": "assistant",
"content": "The capital of France is Paris."
},
"finish_reason": "stop",
"index": 0
}
],
"usage": {
"prompt_tokens": 14,
"completion_tokens": 8
}
}
The choices[0].message.content field contains the model's reply. The usage field shows how many tokens were consumed.
For real-time output, set stream: true. The response arrives as Server-Sent Events:
curl -X POST https://api.cline.bot/api/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "anthropic/claude-sonnet-4-6",
"messages": [
{"role": "user", "content": "Write a haiku about programming."}
],
"stream": true
}'
Each chunk arrives as a data: line. The stream ends with data: [DONE].
To test without spending credits, use one of the free models:
curl -X POST https://api.cline.bot/api/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "minimax/minimax-m2.5",
"messages": [
{"role": "user", "content": "Hello! What can you help me with?"}
],
"stream": false
}'
| Problem | Solution |
|---|---|
401 Unauthorized | Check that your API key is correct and included in the Authorization header |
402 Payment Required | Your account has insufficient credits. Add credits at app.cline.bot |
| Empty response | Make sure messages is a non-empty array with at least one user message |
| Connection timeout | Verify your network can reach api.cline.bot. Check proxy settings if on a corporate network |