Skip to content

feat: add per-model output caps and dynamic reasoning effort - #915

Open
penica wants to merge 6 commits into
mostlygeek:mainfrom
penica:feature/output-caps-and-reasoning
Open

feat: add per-model output caps and dynamic reasoning effort#915
penica wants to merge 6 commits into
mostlygeek:mainfrom
penica:feature/output-caps-and-reasoning

Conversation

@penica

@penica penica commented Jul 11, 2026

Copy link
Copy Markdown

Summary

Adds configurable per-model output-token caps and dynamic reasoning-effort handling for llama.cpp-backed models.

  • Applies configured output caps across Chat Completions, Completions, and Responses.
  • Adds per-model reasoning-effort budgets: none, low, medium, high, and xhigh.
  • Supports Chat Completions reasoning_effort and Responses reasoning.effort; top-level Responses reasoning_effort remains a compatibility alias.
  • Exposes configured limits and reasoning metadata through llama-swap /v1/models extension fields.
  • Documents endpoint mappings, llama.cpp dynamic-reasoning requirements, fixed-budget incompatibility, and extension-field status.
  • Adds Responses alias-pipeline coverage for upstream reasoning transformation.

Compatibility

Dynamic reasoning selection requires official llama.cpp build b8605 or newer. Explicit effort is rejected when the model uses fixed --reasoning-budget or LLAMA_ARG_THINK_BUDGET.

When effort is omitted or default, llama-swap sends no thinking overrides, preserving upstream/default behavior.

Validation

  • go test -count=1 ./internal/config ./internal/process ./internal/server
  • git diff --check main...HEAD
  • Manual validation against official llama.cpp covered Chat and Responses mappings, aliases, unsupported-upstream errors, and fixed-budget handling.

Albin Penic added 4 commits July 11, 2026 12:31
Add capabilities.max_output_tokens metadata and enforce it for OpenAI-compatible generation requests.

- expose configured limits through /v1/models and aliases
- cap chat, completions, and responses token parameters
- document and test configuration and request enforcement
Expose and enforce configured per-model reasoning effort through llama-swap's OpenAI-compatible API.

- advertise derived input limits and reasoning metadata for models and aliases
- forward verified dynamic budgets and reject unavailable explicit selections
- validate reasoning configurations, document usage, and cover request handling
Accept OpenAI's nested reasoning.effort selector on Responses requests while retaining llama-swap's top-level compatibility alias.

- reject ambiguous requests that supply both selector shapes
- remove consumed selectors before applying llama.cpp reasoning controls
- document model metadata extensions and endpoint-specific behavior
Document OpenAI request shapes and cover nested Responses reasoning for configured aliases.

- restore Model customization list indentation
- add output-cap and reasoning compatibility guidance
- verify alias resolution reaches upstream reasoning transformation
@coderabbitai

coderabbitai Bot commented Jul 11, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: dfca131a-265c-4e80-a3a3-2acc5278a237

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@greptile-apps

greptile-apps Bot commented Jul 11, 2026

Copy link
Copy Markdown

Greptile Summary

This PR adds configurable output caps and reasoning-effort handling for llama.cpp-backed models. The main changes are:

  • Per-model max_output_tokens config and request capping.
  • Reasoning-effort budgets and llama.cpp dynamic-budget rewriting.
  • /v1/models metadata for output limits and reasoning support.
  • Docs, schema updates, and tests for the new config paths.

Confidence Score: 5/5

The changed flow looks mergeable after a small schema cleanup.

  • Request capping and reasoning rewriting match the server path flow.
  • Runtime config validation is strict enough for loaded configs.
  • The schema can still approve a reasoning config that runtime loading rejects.

config-schema.json

Important Files Changed

Filename Overview
internal/process/process_command.go Adds llama.cpp build detection and request rewriting for explicit reasoning-effort selections.
internal/server/filters.go Adds max-output-token capping after configured JSON filters and resolves caps through aliases.
internal/config/model_config.go Adds reasoning config fields and runtime validation for effort names, defaults, and token budgets.
config-schema.json Adds schema fields for output caps and reasoning, but misses the runtime dependency on max_output_tokens.
internal/server/api.go Extends model-list metadata with output-token and reasoning fields.

Reviews (1): Last reviewed commit: "docs: clarify reasoning effort compatibi..." | Re-trigger Greptile

Comment thread config-schema.json
penica added 2 commits July 11, 2026 15:13
Keep configuration schema validation aligned with runtime reasoning requirements.

- require max_output_tokens to be positive when reasoning is configured
- cover rejected missing-cap and accepted positive-cap schema cases
…nd-reasoning

# Conflicts:
#	internal/config/model_config.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant