API error codes

Common error codes when calling Kimi API and how to resolve them.

Error code reference

Error CodeMeaningResolution
400Bad RequestCheck request body format, parameter names and types. Common causes: malformed JSON, missing required parameters, values out of range.
401UnauthorizedVerify API Key is correct, not expired or disabled. Confirm header format: Authorization: Bearer <your-api-key>.
403Forbidden (insufficient balance)Account balance depleted — top up in console. Account may also be restricted; contact support if needed.
404Not FoundCheck request URL path and model name. Confirm endpoint is https://api.moonshot.ai/v1/....
429Too Many RequestsExceeded rate limit. Reduce frequency, implement exponential backoff, or contact support for higher limits.
500Internal Server ErrorTemporary server issue — retry later. If persists, contact [email protected] with request_id.

General troubleshooting tips

  1. Check the full error message: The response JSON includes error.message with detailed description.
  2. Note the request_id: Helps support quickly locate the issue.
  3. Refer to official documentation: Ensure calls match docs at platform.moonshot.ai.
  4. Implement retry logic: For 429 and 500 errors, use exponential backoff.