Quick Start
First Request
Replace `your-apihub-key` with your real key, then run the curl below to confirm the connection works.
Last updated: 2026-08-03
Got a 401? Check authentication. Got 403 or a balance error? Check your account limits. View error codes
1
Set an environment variable
Set the key as an env var to avoid it appearing in shell history.
macOS / Linux
export APIHUB_KEY="your-apihub-key"Windows PowerShell
$env:APIHUB_KEY="your-apihub-key"2
Send the request
Use the minimal curl below to verify the connection before configuring any tool.
curl
curl https://www.apihub.ink/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $APIHUB_KEY" \
-d '{
"model": "deepseek-v4-flash",
"messages": [{"role": "user", "content": "Hello from ApiHub"}]
}'Windows PowerShell
$body = @{
model = "deepseek-v4-flash"
messages = @(@{ role = "user"; content = "Hello from ApiHub" })
} | ConvertTo-Json -Depth 5
Invoke-RestMethod -Method Post -Uri "https://www.apihub.ink/v1/chat/completions" -Headers @{ Authorization = "Bearer $env:APIHUB_KEY" } -ContentType "application/json" -Body $body3
Check the response
A successful response returns HTTP 200 with an OpenAI-compatible JSON body. The model reply is in choices[0].message.content.
Success response
{
"id": "chatcmpl_xxx",
"object": "chat.completion",
"model": "deepseek-v4-flash",
"choices": [{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! ApiHub is ready."
},
"finish_reason": "stop"
}]
}Verification
- HTTP 200 returned, and choices[0].message.content is present.
Common Errors
- 401 → check the key; 403 → check balance; 404/400 → check model ID and domain.