cURL / HTTP
Appelez l'API AllToken directement depuis le terminal.
Requête de base
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": "Bonjour !"} |
| 8 | ] |
| 9 | }' |
Streaming avec cURL
Ajoutez "stream": true et utilisez --no-buffer pour voir les tokens en temps réel :
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": "Raconte-moi une blague"} |
| 9 | ] |
| 10 | }' |