I can not configure the limit for litellm #1831

Closed
opened 2026-02-16 17:32:51 -05:00 by yindo · 4 comments
Owner

Originally created by @m-da-costa on GitHub (Sep 25, 2025).

Originally assigned to: @rekram1-node on GitHub.

Sorry if my question is a basic one but I cannot configure the context window (limits) for my litellm instance. Se examples:
config.json

    "litellm": {
      "npm": "@ai-sdk/openai-compatible",
      "options": {
        "baseURL": "https://my.domain.com/v1"
      },
      "models": {
        "cerebras/qwen-3-coder-480b": {
          "tools": true,
          "reasoning": true,
          "context_window": 120000,
          "limit": {
            "context": 120000,
            "output": 64000
          }
        },
      }
    }
Image
Originally created by @m-da-costa on GitHub (Sep 25, 2025). Originally assigned to: @rekram1-node on GitHub. Sorry if my question is a basic one but I cannot configure the context window (limits) for my litellm instance. Se examples: `config.json` ``` "litellm": { "npm": "@ai-sdk/openai-compatible", "options": { "baseURL": "https://my.domain.com/v1" }, "models": { "cerebras/qwen-3-coder-480b": { "tools": true, "reasoning": true, "context_window": 120000, "limit": { "context": 120000, "output": 64000 } }, } } ``` <img width="1048" height="912" alt="Image" src="https://github.com/user-attachments/assets/dc8d9283-621c-4618-9b5d-d5de1b04bf90" />
yindo closed this issue 2026-02-16 17:32:51 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Sep 25, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #1551: Similar issue with Qwen 3 Coder 480b where context limits are not properly respected, causing "Please reduce the length of the messages or completion" errors
  • #1735: Reports that max_tokens defaults to 32000 when using custom providers with openai-compatible, and discusses how limit configuration in config.json should work as a workaround
  • #971: Model options are not forwarded for openai-compatible providers unless provider.name option is given, which may affect limit configurations

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Sep 25, 2025): This issue might be a duplicate of existing issues. Please check: - #1551: Similar issue with Qwen 3 Coder 480b where context limits are not properly respected, causing "Please reduce the length of the messages or completion" errors - #1735: Reports that max_tokens defaults to 32000 when using custom providers with openai-compatible, and discusses how limit configuration in config.json should work as a workaround - #971: Model options are not forwarded for openai-compatible providers unless provider.name option is given, which may affect limit configurations Feel free to ignore if none of these address your specific case.
Author
Owner

@rekram1-node commented on GitHub (Sep 25, 2025):

@m-da-costa put:

includeUsage: true

in the provider options

ex:

 "litellm": {
      "npm": "@ai-sdk/openai-compatible",
      "options": {
        "baseURL": "https://my.domain.com/v1",
        "includeUsage": true
      },
      "models": {
        "cerebras/qwen-3-coder-480b": {
          "tools": true,
          "reasoning": true,
          "context_window": 120000,
          "limit": {
            "context": 120000,
            "output": 64000
          }
        },
      }
    }
@rekram1-node commented on GitHub (Sep 25, 2025): @m-da-costa put: includeUsage: true in the provider options ex: ``` "litellm": { "npm": "@ai-sdk/openai-compatible", "options": { "baseURL": "https://my.domain.com/v1", "includeUsage": true }, "models": { "cerebras/qwen-3-coder-480b": { "tools": true, "reasoning": true, "context_window": 120000, "limit": { "context": 120000, "output": 64000 } }, } } ```
Author
Owner

@rekram1-node commented on GitHub (Sep 25, 2025):

going forward we will set this automatically but until next release you should be able to follow waht I mentioned above^^

@rekram1-node commented on GitHub (Sep 25, 2025): going forward we will set this automatically but until next release you should be able to follow waht I mentioned above^^
Author
Owner

@m-da-costa commented on GitHub (Sep 26, 2025):

Ty so much @rekram1-node

@m-da-costa commented on GitHub (Sep 26, 2025): Ty so much @rekram1-node
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#1831