Skip to content

[BUG] LiteLLM: Requested token count exceeds the model's maximum context length #12279

@robinchrist

Description

@robinchrist

Problem (one or two sentences)

Certain models don't work via our LiteLLM Proxy due to Requested token count exceeds the model's maximum context length error.

Context (who is affected and when)

I see this when using RooCode via our LiteLLM Proxy

Reproduction steps

  1. Configure models via LiteLLM
  2. Use them

Expected result

The task should be executed

Actual result

Task is not executed, error is generated

Variations tried (optional)

No response

App Version

v3.53.0

API Provider (optional)

LiteLLM

Model Used (optional)

No response

Roo Code Task Links (optional)

No response

Relevant logs or errors (optional)

LiteLLM streaming error: 400
litellm.BadRequestError:
Together_aiException - Requested token count exceeds the model's maximum context length of 512000 tokens.
You requested a total of 521014 tokens: 9014 tokens from the input messages and 512000 tokens for the completion.
Please reduce the number of tokens in the input messages or the completion to fit within the limit.
No fallback model group found for original model_group=deepseek-ai/DeepSeek-V4-Pro. 
Fallbacks=[{'MiniMaxAI/MiniMax-M2.5': ['MiniMaxAI/MiniMax-M2.7']}]. Received Model Group=deepseek-ai/DeepSeek-V4-Pro

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions