Skip to content

feat(api): no-thinking gateway model IDs (FCC port, Fase 8.1) - #4145

Merged
diegosouzapw merged 1 commit into
release/v3.8.29from
feat/fcc-no-thinking-alias
Jun 18, 2026
Merged

diegosouzapw merged 1 commit into
release/v3.8.29from
feat/fcc-no-thinking-alias

Conversation

@diegosouzapw

Copy link
Copy Markdown
Collaborator

Fase 8.1 — Gateway model IDs no-thinking (porte free-claude-code)

Clientes como o Claude Code sempre anexam um bloco thinking em certos modelos Claude e não oferecem UI para desligá-lo. Esta PR expõe um model id sintético que força o modo no-thinking puramente por seleção de modelo:

claude-3-omniroute-no-thinking/<provider>/<model>

O que faz

  • Request-side (applyNoThinkingAlias): ao receber o alias, reescreve body.model para o <provider>/<model> real e suprime reasoning in-place — thinking:{type:"disabled"} no caminho /v1/messages; descarta reasoning/reasoning_effort no /v1/chat/completions. Acontece antes de qualquer resolução de modelo / combo routing.
  • Catalog-side (appendNoThinkingVariants): /v1/models anuncia a variante apenas para modelos Claude-family que suportam thinking e honram disabled. Modelos que rejeitam disabled (ex.: claude-fable-5) e combos são excluídos — anunciar uma variante que ignora a supressão seria mentira. As variantes herdam o allowlist por API-key do modelo base.
  • Registry override: ModelSpec.noThinkingAlias?: boolean — operador força on/off por modelo (default = auto-regra acima).
  • O normalizeThinkingForModel() existente continua rodando downstream, inalterado.

Arquitetura

Toda a lógica vive no novo open-sse/utils/noThinkingAlias.ts (<cap). Os 2 pontos de integração são wiring fino de helpers testados, cada um no único chokepoint correto:

  • handleChat (src/sse/handlers/chat.ts) — logo após ler body.model, antes da resolução.
  • getUnifiedModelsResponse (catalog.ts) — após o filtro de API-key.

Testes (TDD, RED→GREEN)

12 testes unitários: round-trip do prefixo, supressão no request (ambos os formatos), gating do catálogo (exclusão de fable-5 / combo / double-alias). Mais 73 testes de regressão de model-specs/catalog/thinking verdes.

Escopo / segurança

  • Diff additive: +298 / −2 (as 2 deleções = rebaseline de 2 números no file-size-baseline, com justificativa).
  • Sem SQL cru, sem env nova, sem any novo (any-budget:t11 verde), sem ciclos.
  • claude-3-omniroute-no-thinking/<provider>/<model> documentado em docs/reference/API_REFERENCE.md.

Validação

typecheck:core + typecheck:noimplicit:core (meus arquivos limpos; erros restantes são dívida pré-existente), eslint 0, check:cycles/check:file-size/check:any-budget:t11/check:docs-sync verdes, 12 + 73 testes verdes.

🤖 Generated with Claude Code

Some clients — most notably Claude Code — always attach a `thinking` block
to certain Claude models and offer no UI to turn it off. This adds a synthetic
gateway model id that forces a thinking-capable model into a no-thinking mode
purely by model selection:

    claude-3-omniroute-no-thinking/<provider>/<model>

- New open-sse/utils/noThinkingAlias.ts: prefix predicates + request-side
  applyNoThinkingAlias() (Claude path → thinking:{type:"disabled"}; OpenAI path
  → drop reasoning/reasoning_effort) + catalog-side appendNoThinkingVariants().
- /v1/models advertises the variant only for Claude-family models that support
  thinking AND honor `disabled` (fable-5 et al. excluded). Variants inherit the
  per-API-key allowlist of their base model.
- ModelSpec.noThinkingAlias?: boolean — explicit operator override (on/off).
- Wired at the single chokepoint in each file: handleChat (before model
  resolution) and getUnifiedModelsResponse (after key filtering).
- The existing normalizeThinkingForModel() still runs downstream unchanged.

Tests: 12 unit (prefix round-trip, request suppression both formats, catalog
gating incl. fable-5/combo/double-alias exclusion). file-size rebaselined with
justification (catalog +5, chat +13 — thin wiring of tested helpers).
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@diegosouzapw
diegosouzapw merged commit c5c612e into release/v3.8.29 Jun 18, 2026
4 checks passed
diegosouzapw added a commit that referenced this pull request Jun 18, 2026
… Fase 8.2) (#4146)

Per-provider sliding-window rate-limit fallback (FCC port, Fase 8.2): opt-in (empty map = no-op), burst-free sliding window as a floor for header-less providers; Bottleneck still applies. Integrado em release/v3.8.29 (conflito de file-size-baseline resolvido por união com #4145).
diegosouzapw added a commit to megamen32/OmniRoute that referenced this pull request Jun 18, 2026
Merge release/v3.8.29 and reconcile catalog.ts: the branch had drifted far
behind and its snapshot would have reverted the centralized vision detection
(cheaper-inference#4072), the no-thinking gateway variants (cheaper-inference#4145) and cheaper-inference#4164's own auto/* loop.
Keep all of those and apply only the genuine improvement on top of release:
enrich each cheaper-inference#4164 auto/* /v1/models entry with the combo's advertised
context/output limits (createBuiltinAutoCombo → advertisedContextLength/
advertisedMaxOutputTokens, 128000/8192 fallback) + baseline capabilities, with
a try/catch that emits the minimal cheaper-inference#4164 entry on resolve failure so the id is
never dropped. OpenAI-compatible clients (Hermes) get a context window before
the first request.

Adds tests/unit/models-catalog-auto-combos-4164.test.ts::"cheaper-inference#4189 every auto/*
entry exposes token limits + baseline capabilities" (Rule cheaper-inference#18) and bumps the
catalog.ts file-size baseline 1440->1463 with justification.

Co-authored-by: diegosouzapw <diegosouza.pw@gmail.com>
diegosouzapw pushed a commit that referenced this pull request Jun 18, 2026
Integrated into release/v3.8.29. Thanks @megamen32! Reconciled on your branch: the branch had drifted behind release and would have reverted the centralized vision detection (#4072), the no-thinking gateway variants (#4145) and #4164's auto/* loop — those are kept, and your genuine improvement is applied on top: each auto/* /v1/models entry now carries advertised context/output limits + capabilities (createBuiltinAutoCombo, with a fallback to the minimal entry on resolve failure). Added a regression test (Rule #18) and bumped the catalog.ts file-size baseline 1440→1463 with justification.
@diegosouzapw
diegosouzapw deleted the feat/fcc-no-thinking-alias branch June 19, 2026 12:06
tkgo11 pushed a commit to tkgo11/OmniRoute that referenced this pull request Sep 23, 2026
…r-inference#4145)

No-thinking gateway model IDs (FCC port, Fase 8.1): synthetic claude-3-omniroute-no-thinking/<provider>/<model> catalog id that resolves to the real model with reasoning suppressed. Integrado em release/v3.8.29.
tkgo11 pushed a commit to tkgo11/OmniRoute that referenced this pull request Sep 23, 2026
… Fase 8.2) (cheaper-inference#4146)

Per-provider sliding-window rate-limit fallback (FCC port, Fase 8.2): opt-in (empty map = no-op), burst-free sliding window as a floor for header-less providers; Bottleneck still applies. Integrado em release/v3.8.29 (conflito de file-size-baseline resolvido por união com cheaper-inference#4145).
tkgo11 pushed a commit to tkgo11/OmniRoute that referenced this pull request Sep 23, 2026
Integrated into release/v3.8.29. Thanks @megamen32! Reconciled on your branch: the branch had drifted behind release and would have reverted the centralized vision detection (cheaper-inference#4072), the no-thinking gateway variants (cheaper-inference#4145) and cheaper-inference#4164's auto/* loop — those are kept, and your genuine improvement is applied on top: each auto/* /v1/models entry now carries advertised context/output limits + capabilities (createBuiltinAutoCombo, with a fallback to the minimal entry on resolve failure). Added a regression test (Rule cheaper-inference#18) and bumped the catalog.ts file-size baseline 1440→1463 with justification.
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