Troubleshooting
Symptom-first index — find what you are seeing and jump to the cause.
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"
200 means the URL and key are both fine and the problem is in your client. Anything else is covered below.
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 | Display name used instead of an api id | Models endpoint |
| 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@claudeapikey.dev 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.