Recently since last week I am noticing multiple request showing this error:
HTTP 500: {"success":false,"error":"OpenRouter API error: 400 Bad Request - {"error":{"message":"This endpoint's maximum context length is 128000 tokens. However, you requested about 176278 tokens (161278 of text input, 15000 in the output). Please reduce the length of either one, or use the \"middle-out\" transform to compress your prompt automatically.","code":400,"metadata":{"provider_name":null}}} (after 3 attempts)"}
or sometimes this:
400 Bad Request - {"error":{"message":"This endpoint's maximum context length is 128000 tokens. However, you requested about 176278 tokens (161278 of text input, 15000 in the output). Please reduce the length of either one, or use the "middle-out" transform to compress your prompt automatically.","code":400,"metadata":{"provider_name":null}}}
After debugging I found this is again happening only with model "openai/gpt-4o-mini:online". It doesn't happens always which means it is an issue from OpenRouter not at my code level. And the context that is being send is way small we have even hard coded limit of 4000 tokens so this is nothing to do at my code end.
Can we please have a stable system in place please? This is totally breaking down my system badly! And it hurts way too much!!