Skip to main content
Watch: I Built an AI App Without Leaving Databricks

OpenRouter error

OpenRouter 400 string_too_long: what it means and how to fix it

Error message
400 string_too_long

Retry? Not statedLast verified 1 documented fix1 source

What it means

A single string field in the request (system prompt, user message, etc.) exceeded the provider's per-field character limit.

Causes

  • One string field longer than the provider allows

How to fix it

  1. Fix 1.

    Shorten the offending field to the provider's per-field character limit.

More OpenRouter errors

All 32 OpenRouter errors

HTTP 400 at other providers

Compare 400 across providers

FAQ

What does the OpenRouter error "400 string_too_long" mean?

A single string field in the request (system prompt, user message, etc.) exceeded the provider's per-field character limit.

How do I fix OpenRouter "400 string_too_long"?

Shorten the offending field to the provider's per-field character limit.

Should I retry OpenRouter "400 string_too_long"?

Not stated. The official docs do not say whether this error is retryable.

Which other AI APIs return HTTP 400?

Per their official error docs: Amazon Bedrock (400 ValidationException; 400 ServiceQuotaExceededException; 400 IncompleteSignature; 400 InvalidAction; 400 NotAuthorized; 400 RequestExpired), Anthropic API (400 invalid_request_error; 400 invalid_request_error (spend limit reached)), Azure OpenAI (400 Bad Request; 400 content_filter), Cohere API (400 Bad Request; 400 Bad Request (too many tokens)), DeepSeek API (400 - Invalid Format), Gemini API (400 invalid_request; 400 failed_precondition; 400 parameter_unknown; 400 INVALID_ARGUMENT; 400 FAILED_PRECONDITION), Groq API (400 Bad Request), Mistral API (400 Bad request), OpenAI API (400 invalid_request_error (Invalid service_tier argument); 400 BadRequestError), Vertex AI (400 INVALID_ARGUMENT / FAILED_PRECONDITION), xAI API (400 Bad Request).

Sources

Last verified against 1 source: OpenRouter's official docs and official SDK repositories.

Newsletter

Know when the APIs change

One email per week. New model releases, API changes, what broke, and how developers are working around it.