CrossModel

Errors & troubleshooting

CrossModel returns errors in the format that matches the protocol you called. OpenAI-compatible endpoints return OpenAI-style error objects; the Anthropic Messages endpoint returns Anthropic-style error objects.

OpenAI-compatible error format

{
  "error": {
    "message": "Missing Bearer token in Authorization header.",
    "type": "authentication_error",
    "param": null,
    "code": "missing_api_key"
  }
}
FieldNotes
messageA human-readable description.
typeThe broad error category.
paramThe offending field, or null when there isn't a specific one.
codeA stable error code — prefer branching on this in code.

Anthropic-compatible error format

{
  "type": "error",
  "error": {
    "type": "authentication_error",
    "message": "Missing API key."
  }
}

The Anthropic format doesn't include a code field. Branch on the HTTP status code and error.type.

Common errors

HTTP statusOpenAI typeCommon codeNotes
400invalid_request_errorinvalid_json, invalid_messages, unsupported_parameter, unsupported_responses_featureMalformed body or parameters.
401authentication_errormissing_api_key, invalid_api_key, api_key_inactive, user_inactiveKey missing, wrong, disabled, or account unavailable.
402billing_errorinsufficient_balance, no_walletOut of balance or no wallet on the account.
404invalid_request_errormodel_not_foundModel doesn't exist, isn't listed, or is currently unavailable.
429rate_limit_errorrate_limit_exceededOver the API key's RPM or TPM limit.
502provider_errorprovider_errorThe model service couldn't complete the request.
503api_errormodel_unavailableModel temporarily unavailable — retry shortly.
500api_errorinternal_error, db_errorServer error.

Request tracing

Successful responses include:

x-request-id: req_cm_...
x-crossmodel-model: vendor/model

When you report a problem, include as much of this as you can:

  • x-request-id
  • the request time
  • the model ID used
  • the HTTP status code
  • the error response body

Streaming errors

When an error happens after a streaming connection is already open, it comes back as an SSE event in the matching protocol:

  • Chat Completions sends a data: chunk with an error field.
  • Responses sends event: error.
  • Messages sends an Anthropic-style error event.

Once you receive a streaming error, treat that generation as failed. The client can let the user retry, or your business layer can start a fresh, complete request.

Debugging order

  1. 401: check the headers, that the key starts with cm-, and that the key is still usable.
  2. 402: check the console balance, top up, and retry.
  3. 404: call /v1/models to confirm the model ID.
  4. 429: lower concurrency or output cap, wait, and try again.
  5. 502 / 503: usually the model service is briefly unavailable — back off and retry.
  6. Persistent failures: contact support with the x-request-id.