#10880·marimo

Inline completion fails with thinking models: "Model token limit (1024) exceeded before any response was generated"

Author: tomschelsenCreated Sep 17, 2026Updated Sep 17, 2026
Labelsbug

Describe the bug

Bug

Marimo logs:

[E ... ai:352] Error in AI inline completion: Model token limit (1024) exceeded before any response was generated. Increase the max_tokens model setting, or simplify the prompt to result in a shorter response that will fit within the limit.

This is not a context-window issue — the serving model's max_model_len is 262144.

Root cause

  • Inline completion hardcodes its output budget and ignores ai.max_tokens: INLINE_COMPLETION_MAX_TOKENS = 1024 in marimo/_server/api/endpoints/ai.py.
  • Lots of hybrid-thinking models default to thinking mode ON, which vLLM applies via the model chat template. The model spends the entire 1024-token budget on reasoning and emits no final code, so Pydantic AI raises the error above.
  • Marimo currently has no way to disable thinking on these requests (CustomProvider._default_thinking returns None for OpenAI-compatible providers, and AnyProviderConfig has no chat_template_kwargs / enable_thinking passthrough).

Confirmed thinking is the cause: the same request with "chat_template_kwargs": {"enable_thinking": false} returns code and fits within 1024 tokens.

Expected behavior

Inline completion works with thinking models, or degrades gracefully instead of erroring.

Suggested fix

Either:

  • Make inline completion thinking-aware — disable thinking for these requests (e.g. send chat_template_kwargs={"enable_thinking": false} where supported, and/or suppress reasoning). Autocomplete should be fast and non-reasoning anyway, or:
  • Make INLINE_COMPLETION_MAX_TOKENS configurable under [ai] rather than hardcoded to 1024.

Will you submit a PR?

  • Yes

Environment

  • marimo: 0.24.2
  • model: Qwen3.8-27B-FP8 via vLLM (OpenAI-compatible provider)
  • vLLM: v0.28.0

Code to reproduce

  1. Serve a thinking model with vLLM.
  2. Configure a custom OpenAI-compatible provider in marimo pointing at it.
  3. Type in a cell to trigger inline autocomplete.
  4. Observe the error in the terminal.