First request
Verify your APIMaster API setup with curl.
First request
After you have an API key, run:
Chat Completions
curl -s "https://apimaster.ai/v1/chat/completions" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "claude-sonnet-4-6",
"messages": [{"role": "user", "content": "Reply with exactly: ok"}],
"max_tokens": 32
}'
A successful response includes choices[0].message.content.
List models
curl -s "https://apimaster.ai/v1/models" \
-H "Authorization: Bearer YOUR_API_KEY"
Model ids should match the supported models list and your account.
Common errors
| Status | Likely cause |
|---|---|
401 |
Invalid or revoked key |
403 |
Balance or permission |
404 |
Wrong model id or not enabled for your account |
429 |
Rate limit — retry with backoff |
| Timeout | Network or slow upstream — increase client timeout |