Troubleshooting
Symptom-first index — find what you are seeing and jump to the cause.
Check access before retrying
- Check whether the intended entitlement is active and note its expiry.
- Confirm the key uses the intended group. Timed Claude plans use Claude Unlimited; Codex access is separate.
- List models with that same key, select a returned ID, and send one small request.
Use Models and key groups or the agent setup checklist if you are unsure which step failed.
Nothing works at all
Establish the baseline before debugging anything else:
curl -s -o /dev/null -w "%{http_code}\n" https://aiprimetech.io/v1/models \
-H "Authorization: Bearer $CLAUDEAPIKEY"
After a successful model-list response, check the selected model against the list and send one small generation request. Generation can still fail because of model availability, entitlement, limits or client configuration.
By symptom
| Symptom | Likely cause | Fix |
|---|---|---|
404 on every call | Base URL has the wrong /v1 handling | Base URLs |
401 with a key you just created | Wrong header for the format, or a trailing space | Authentication |
402 | No credits, or plan expired | Top up · Plans |
400 max_tokens | Messages requires max_tokens; Chat Completions does not | Messages |
model_not_found | Wrong ID, wrong key group, or model unavailable for that key | Models and key groups |
| Streaming connects but yields nothing | Parsing the other format's event shape | Streaming |
| Reply cut off mid-sentence | stop_reason: max_tokens | Raise max_tokens |
| Works in curl, fails in the SDK | SDK appends its own path to your base URL | Base URLs |
| Usage not showing in dashboard | Requests going to a different key or endpoint | Check ANTHROPIC_API_KEY is unset — Claude Code |
Frequent 429 | Agent parallelism too high | Rate limits |
| Bill higher than expected | Context growth across turns | Context management |
Reading the error body
The status code tells you the class of problem; the error.type and error.message fields tell you which one. Log the whole body — a 400 with "missing max_tokens" and a 400 with "invalid role" need completely different fixes.
Still stuck
Contact support@aiprimetech.io with the endpoint, the model id, the status code and the error body. Never include your API key — if you already pasted it somewhere, revoke it first.