Yêu cầu đầu tiên
Kiểm tra kết nối trước khi cấu hình công cụ.
Chuẩn bị
Hoàn thành kết nối ChatGPT và chờ bridge báo Ready. Mở mục API keys trong dashboard, tạo key riêng cho client và lưu ở vị trí an toàn.
Kiểm tra danh sách model
Ví dụ dưới dùng cổng mặc định 3211. Thay URL bằng endpoint dashboard hiển thị và thay <API_KEY> bằng key của CoworkerAPI. Ví dụ curl dùng cú pháp Bash. Trong PowerShell, dùng ví dụ riêng ở dưới.
curl "http://127.0.0.1:3211/v1/models" \
-H "Authorization: Bearer <API_KEY>"Response phải có model chatgpt-web. Route này xác nhận gateway và API key; chưa xác nhận ChatGPT tạo được câu trả lời.
Gửi một câu hỏi
curl "http://127.0.0.1:3211/v1/chat/completions" \
-H "Authorization: Bearer <API_KEY>" \
-H "Content-Type: application/json" \
-d '{"model":"chatgpt-web","messages":[{"role":"user","content":"Reply with OK."}]}'Trong dashboard, theo dõi trạng thái request và thời gian xử lý. Giữ widget mở cho tới khi request hoàn tất. Sau đó cấu hình client với cùng endpoint và key.
PowerShell
$headers = @{ Authorization = "Bearer <API_KEY>" }
Invoke-RestMethod -Uri "http://127.0.0.1:3211/v1/models" -Headers $headers
$body = @{ model = "chatgpt-web"; messages = @(@{ role = "user"; content = "Reply with OK." }) } | ConvertTo-Json -Depth 5
Invoke-RestMethod -Method Post -Uri "http://127.0.0.1:3211/v1/chat/completions" -Headers $headers -ContentType "application/json" -Body $bodyXử lý lỗi
401— Xác thực- Kiểm tra API key, header và key có còn hiệu lực hay không.
404— Route hoặc model- Kiểm tra base URL, route và model alias trong dashboard.
429— Giới hạn yêu cầu- Kiểm tra giới hạn số yêu cầu mỗi phút và số yêu cầu đồng thời của API key trước khi gửi lại. Gateway không đo quota tài khoản ChatGPT.
504— Hết thời gian chờ- Kiểm tra widget, hội thoại kích hoạt, tunnel và nhật ký. Không gửi lặp nhiều lần khi request cũ còn đang xử lý.
First request
Verify the connection before configuring your tool.
Before you begin
Complete the ChatGPT connection and wait for the bridge to show Ready. Open API keys in the dashboard, create a key for your client, and store it securely.
List models
These examples use the default port, 3211. Replace the URL with the endpoint shown in your dashboard and replace <API_KEY> with a CoworkerAPI key. The curl examples use Bash syntax. For PowerShell, use the separate example below.
curl "http://127.0.0.1:3211/v1/models" \
-H "Authorization: Bearer <API_KEY>"The response should include chatgpt-web. This verifies the gateway and key, but does not yet verify ChatGPT inference.
Send a question
curl "http://127.0.0.1:3211/v1/chat/completions" \
-H "Authorization: Bearer <API_KEY>" \
-H "Content-Type: application/json" \
-d '{"model":"chatgpt-web","messages":[{"role":"user","content":"Reply with OK."}]}'Watch the request status and duration in the dashboard. Keep the widget open until the request completes. Then configure your client with the same endpoint and key.
PowerShell
$headers = @{ Authorization = "Bearer <API_KEY>" }
Invoke-RestMethod -Uri "http://127.0.0.1:3211/v1/models" -Headers $headers
$body = @{ model = "chatgpt-web"; messages = @(@{ role = "user"; content = "Reply with OK." }) } | ConvertTo-Json -Depth 5
Invoke-RestMethod -Method Post -Uri "http://127.0.0.1:3211/v1/chat/completions" -Headers $headers -ContentType "application/json" -Body $bodyTroubleshooting
401— Authentication- Check the key, authentication header, and whether the key is still active.
404— Route or model- Check your base URL, route, and model alias in the dashboard.
429— Request limit- Check the API key’s requests-per-minute and concurrent-request limits before retrying. The gateway does not measure ChatGPT account quotas.
504— Timeout- Check the widget, activation conversation, tunnel, and logs. Avoid repeated retries while an earlier request is still processing.