cURL / HTTP
AllToken API direkt vom Terminal aufrufen.
Einfache Anfrage
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": "Hallo!"} |
| 8 | ] |
| 9 | }' |
Streaming mit cURL
Fügen Sie "stream": true hinzu und verwenden Sie --no-buffer, um Tokens sofort zu sehen:
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": "Erzähl mir einen Witz"} |
| 9 | ] |
| 10 | }' |