cURL / HTTP
Call the AllToken API directly from the terminal.
Basic request
cURL
| 1 | curl https://api.alltoken.ai/v1/chat/completions \ |
| 2 | -H "Authorization: Bearer $ALLTOKEN_API_KEY" \ |
| 3 | -H "Content-Type: application/json" \ |
| 4 | -d '{ |
| 5 | "model": "deepseek-chat", |
| 6 | "messages": [ |
| 7 | {"role": "user", "content": "Hello!"} |
| 8 | ] |
| 9 | }' |
Streaming with cURL
Set "stream": true and pass --no-buffer to receive tokens as they arrive:
cURL streaming
| 1 | curl --no-buffer https://api.alltoken.ai/v1/chat/completions \ |
| 2 | -H "Authorization: Bearer $ALLTOKEN_API_KEY" \ |
| 3 | -H "Content-Type: application/json" \ |
| 4 | -d '{ |
| 5 | "model": "deepseek-chat", |
| 6 | "stream": true, |
| 7 | "messages": [ |
| 8 | {"role": "user", "content": "Tell me a joke"} |
| 9 | ] |
| 10 | }' |