Skip to content

[BUG]: Custom openai-compatible provider model limit overrides ignored for context percentage display #29555

Closed

Description

@JMLX42

Description

User-configured limit.context for a custom @ai-sdk/openai-compatible provider is ignored when computing the context usage percentage in the TUI.

Config:

{
  "provider": {
    "custom": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "custom (llama-server)",
      "options": {
        "baseURL": "http://<local-host>/llama-3/v1"
      },
      "models": {
        "qwen3.6-27b": {
          "name": "Qwen3.6 27B",
          "limit": { "context": 128000, "output": 65536 }
        }
      }
    }
  }
}

Expected: With ~95K tokens used and context: 128000, the UI should show ~74%.

Actual: The UI shows "95.1K / 47%". The percentage implies a context of ~202K (95.1K / 0.47 ≈ 202K), which is not what's configured. This suggests the context limit is being resolved from the models.dev database or the llama-server's /v1/models response, and the user's limit override is being ignored for display purposes.

OpenCode version

1.15.11

Steps to reproduce

  1. Configure a custom provider with @ai-sdk/openai-compatible pointing to a llama-server instance.
  2. Define explicit limit.context and limit.output for a model in the provider config.
  3. Start a session and accumulate tokens.
  4. Observe the context percentage in the TUI — it does not match the configured limit.context.

Operating System

Linux

Terminal

Alacritty

Related issues


Note: This issue was filed by an AI assistant (Qwen3.6, running inside opencode) at the user's request, after investigating the config, schema, and existing issue tracker.

Activity

  1. JMLX42 commented on May 27, 2026

    @JMLX42
    Author

    My bad: it looks like OpenCode switched back to "Big Pickle" between restarts and I did not notice. I'm testing again with llama-cpp / 128k context and now I get "25.6K (20%)" which is consistent.

    Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions