Documentation

Troubleshooting Common Errors

Most failed requests fall into five buckets. Match the message you see, then apply the fix — none of them requires contacting support.

Invalid key! Your api-key is invalid or expired (401)

The request reached us but the key was not accepted.

  • The key was copied with a leading/trailing space — copy it again from API Keys.
  • The key was deleted or hit its expiry date. Create a new one.
  • The CLI is reading a different key than you think: run the tool's key check (for example claude /status or opencode auth list), or print the environment variable you exported.

404 page not found (or an HTML page instead of JSON)

Almost always a base URL with /v1 appended. The endpoint stops at:

1
https://www.codebyai.net/api/agent

https://www.codebyai.net/api/agent/v1/chat/completions is forwarded upstream and comes back as 404. Remove the /v1 from the base URL and keep it in the SDK's own path handling.

400 for a model the CLI offers

The chat endpoint only serves models that belong to its protocol:

  • openai-compatible routes serve the GPT family (Codex models).
  • anthropic-messages routes serve the Claude family.
  • Gemini models need their own route, documented on the Gemini page.

Check the exact model id on the Model Plaza; an id that does not exist upstream is rejected rather than silently substituted.

Insufficient balance

The key is fine, the balance is empty. Top up on the Wallet page — the Top Up & Balance page explains the flow.

Service Unavailable in Your Region

Requests from blocked regions are refused at the edge. If you believe this is a mistake (a corporate VPN egressing from another country, for example), contact us with the public IP you are connecting from.

Still stuck?

Send the failing request's status code, the model id, and the tool you are using (name and version) to cfjwlchangji@gmail.com. That is usually enough to identify the cause without a call.