Source: https://aiprimetech.io/vi/docs/sdks/curl/ [Trang chủ](/vi/) / [Tài liệu](/vi/docs/) / cURL # cURL Các ví dụ không cần thư viện phụ thuộc cho mọi endpoint — hữu ích khi gỡ lỗi và kiểm tra CI. Sao chép trang [ Xem dưới dạng Markdown](/vi/docs/sdks/curl.md) [ Hỏi ChatGPT](https://chatgpt.com/?q=Read%20https%3A//aiprimetech.io/docs/sdks/curl.md%20and%20answer%20questions%20about%20it.%20Start%20with%20a%20short%20summary.) [ Hỏi trong Claude](https://claude.ai/new?q=Read%20https%3A//aiprimetech.io/docs/sdks/curl.md%20and%20answer%20questions%20about%20it.%20Start%20with%20a%20short%20summary.) ## Liệt kê mô hình ``` Copycurl https://aiprimetech.io/v1/models \ -H "Authorization: Bearer $CLAUDEAPIKEY" ``` ## Messages ``` Copycurl https://aiprimetech.io/v1/messages \ -H "x-api-key: $CLAUDEAPIKEY" \ -H "anthropic-version: 2023-06-01" \ -H "content-type: application/json" \ -d '{ "model": "claude-sonnet-4-6", "max_tokens": 1024, "system": "Be concise.", "messages": [{"role": "user", "content": "What is a CDN?"}] }' ``` ## Chat Completions ``` Copycurl https://aiprimetech.io/v1/chat/completions \ -H "Authorization: Bearer $CLAUDEAPIKEY" \ -H "content-type: application/json" \ -d '{ "model": "claude-sonnet-4-6", "messages": [ {"role": "system", "content": "Be concise."}, {"role": "user", "content": "What is a CDN?"} ] }' ``` ## Truyền dữ liệu theo luồng ``` Copycurl -N https://aiprimetech.io/v1/messages \ -H "x-api-key: $CLAUDEAPIKEY" \ -H "anthropic-version: 2023-06-01" \ -H "content-type: application/json" \ -d '{"model":"claude-sonnet-4-6","max_tokens":512,"stream":true, "messages":[{"role":"user","content":"Count to five"}]}' ``` -N tắt cơ chế đệm của chính curl. Nếu không có tùy chọn này, toàn bộ luồng sẽ xuất hiện cùng lúc và trông như tính năng truyền luồng bị lỗi. ## Kiểm tra tình trạng trong CI ``` Copy"c">#!/usr/bin/env bash set -euo pipefail code=$(curl -s -o /dev/null -w "%{http_code}" https://aiprimetech.io/v1/models \ -H "Authorization: Bearer $CLAUDEAPIKEY") [ "$code" = "200" ] || { echo "gateway check failed: $code" >&2; exit 1; } echo "gateway ok" ``` [LỗiDiễn giải trạng thái](/vi/docs/api-reference/errors/)[Khắc phục sự cốKhi curl hoạt động nhưng SDK không hoạt động](/vi/docs/guides/troubleshooting/) [TrướcTypeScript](/vi/docs/sdks/typescript/)[Tiếp theoGo](/vi/docs/sdks/go/)