cURL / HTTP
터미널에서 AllToken API를 직접 호출합니다.
기본 요청
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": "안녕하세요!"} |
| 8 | ] |
| 9 | }' |
cURL로 스트리밍
"stream": true를 추가하고 --no-buffer를 사용하면 토큰을 즉시 확인할 수 있습니다:
cURL 스트리밍
| 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": "농담 하나 해주세요"} |
| 9 | ] |
| 10 | }' |