Skip to content
Documentation
SDK Reference / cURL / HTTP
SDK Reference · cURL / HTTP

cURL / HTTP

Appelez l'API AllToken directement depuis le terminal.


Requête de base

cURL
1curl https://api.alltoken.ai/v1/chat/completions \
2 -H "Authorization: Bearer $ALLTOKEN_API_KEY" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "model": "minimax-m2.7",
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
1curl --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": "minimax-m2.7",
6 "stream": true,
7 "messages": [
8 {"role": "user", "content": "Raconte-moi une blague"}
9 ]
10 }'