Skip to content

feat(sync): add Cortecs model sync - #3903

Open
ASMAE20 wants to merge 3 commits into
anomalyco:devfrom
ASMAE20:feat/add-cortecs-model-sync
Open

feat(sync): add Cortecs model sync#3903
ASMAE20 wants to merge 3 commits into
anomalyco:devfrom
ASMAE20:feat/add-cortecs-model-sync

Conversation

@ASMAE20

@ASMAE20 ASMAE20 commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Summary

Add Cortecs model sync

  • sync the Cortecs model catalog from https://api.cortecs.ai/v1/models
  • convert API prices from EUR to USD per million tokens
  • add newly available models and update existing pricing, limits, modalities, and capabilities
  • use canonical base_model metadata where available

Test plan

  • bun models:sync cortecs
  • bun models:sync cortecs --dry-run
  • bun validate

@github-actions

Copy link
Copy Markdown
Contributor

Action items

  • [high] [violation] packages/core/src/sync/providers/cortecs.ts:72 - Check: Do not invent limit.output when the API only exposes context. Why: output is set to model.context_size, which then overrides correct base_model completion caps (e.g. Gemini Flash base 65_5361_048_576, GPT-5 family base 128_000400_000/1_050_000, Claude Opus 5 base 128_0001_000_000). Action: When max output is unknown, omit limit.output so factored models inherit metadata (and only write output when existing/hand-authored or the API provides a real max).
  • [high] [violation] providers/cortecs/models/claude-4-5-sonnet.toml:1 - Check: Provider models must use base_model when models/ metadata exists. Why: Several Claude IDs still ship full inline defs despite canonical metadata (claude-4-5-sonnetanthropic/claude-sonnet-4-5, claude-4-6-sonnetanthropic/claude-sonnet-4-6, claude-opus4-5/6/7anthropic/claude-opus-4-5/6/7, claude-sonnet-4anthropic/claude-sonnet-4-0). Exact-slug resolution cannot find these aliases. Action: Add Cortecs ID→canonical aliases in the sync (and re-sync) so these files factor like claude-haiku-4-5 / claude-opus-5.
  • [high] [possible mistake] providers/cortecs/models/gpt-4.1.toml:2 - Check: reasoning must match the model, not a mis-tagged gateway flag. Why: New/updated GPT-4.1/GPT-4o entries set reasoning = true (and empty reasoning_options) while models/openai/gpt-4*.toml and native OpenAI entries are reasoning = false. Same pattern likely affects other non-reasoning models if supported_features is trusted blindly. Action: Verify Cortecs feature tags; for non-reasoning bases, do not override reasoning to true (prefer base metadata when the API flag conflicts).
  • [high] [possible mistake] packages/core/src/sync/providers/cortecs.ts:92 - Check: reasoning_options must reflect Cortecs’ documented OpenAI-compatible controls for the same surface. Why: New reasoning models default to existing?.reasoning_options ?? [], so claude-opus-5, claude-sonnet-5, claude-sonnet-4, GPT-5 / GPT-5.6 / gpt-oss-20b, etc. get [] while same-provider peers keep effort (and Claude peers also budget_tokens), matching providers/cortecs/provider.toml. Action: Stop blank-defaulting new models; seed options from provider-documented controls / same-family Cortecs peers (e.g. Claude effort+budget, GPT/DeepSeek/gpt-oss effort) or parse API metadata when present.
  • [medium] [possible mistake] providers/cortecs/models/glm-4.7-flash.toml:2 - Check: reasoning, interleaved, and base metadata must be consistent. Why: Diff sets reasoning = false while keeping [interleaved] field = "reasoning_content", and zhipuai/glm-4.7-flash is reasoning = true. Action: Verify Cortecs’ feature flag; either restore reasoning (and options) or drop interleaved when reasoning is truly unavailable.

@github-actions

Copy link
Copy Markdown
Contributor

Action items

  • [high] [violation] providers/cortecs/models/gemini-2.5-flash.toml:11 - Check: limit.output must reflect the provider max completion size, not the context window, especially when base_model already defines output. Why: Several new factored models set limit.output equal to Cortecs context_size (e.g. Gemini Flash 1_048_576 vs base 65_536; GPT-5 family 400_000/1_050_000 vs base 128_000; Claude Opus/Sonnet 5 1_000_000 vs base 128_000; GPT-4.1 mini/nano 1_047_576 vs base 32_768; GPT-4o/4o-mini 128_000 vs base 16_384). That inflates usable max tokens for callers. Same pattern appears in gemini-3.1-flash-lite.toml, gemini-3.5-flash.toml, gpt-5*.toml, gpt-5.6-*.toml, gpt-4.1-*.toml, gpt-4o*.toml, claude-opus-5.toml, and claude-sonnet-5.toml. Action: Drop those incorrect limit.output overrides (or set verified Cortecs completion caps) so models inherit base output, then re-sync and confirm the bad values do not return.
  • [high] [possible mistake] providers/cortecs/models/claude-opus4-7.toml:7 - Check: reasoning_options must match Cortecs’ verified request surface, not be copied across the whole Claude family. Why: Patch 2 adds budget_tokens to Opus 4.7/4.8, Opus 5, and Sonnet 5. Prior Cortecs notes for Opus 4.7/4.8 said only reasoning_effort / output_config.effort is exposed and “no explicit budget.” Native Anthropic and OpenRouter entries for these IDs are effort-only (no budget_tokens). Action: Remove budget_tokens from claude-opus4-7, claude-opus4-8, claude-opus-5, and claude-sonnet-5 unless you can cite Cortecs model/API evidence that thinking.budget_tokens is accepted for those IDs; keep effort-only (or empty) until verified.
  • [medium] [violation] packages/core/src/sync/providers/cortecs.ts:88 - Check: Sync must not invent completion limits from context_size, and must not keep bad authored outputs forever. Why: The first sync used output: existing?.limit?.output ?? model.context_size, which created the bad overrides above. The follow-up output: authored?.limit?.output stops new inventions only when no authored output exists; once a bad limit.output is on disk, later syncs preserve it. Action: For factored models, omit unknown output (inherit base). For standalone models, only write output when Cortecs exposes a real completion cap; never default to context_size. After fixing the code, clear residual bad outputs and re-run sync.
  • [medium] [violation] providers/cortecs/models/nvidia-nemotron-3-nano-30b-a3b.toml:1 - Check: Provider models must use base_model when matching models/ metadata exists. Why: Full inline definitions duplicate provider-agnostic facts for models that already have metadata: nvidia/nemotron-3-nano-30b-a3b and nvidia/llama-3.1-nemotron-ultra-253b (Cortecs IDs nvidia-nemotron-3-nano-30b-a3b, llama-3.1-nemotron-ultra-253b-v1). Auto-resolve misses them because of the nvidia- prefix / -v1 suffix. Action: Add Cortecs base-model aliases (like claude-sonnet-4) and emit base_model with only provider-specific overrides (cost, limits, modalities, reasoning_options).

@bodo6778

Copy link
Copy Markdown

Thank you for opening this PR! Hope it gets merged soon!

@ASMAE20
ASMAE20 force-pushed the feat/add-cortecs-model-sync branch from 98ea05b to 5da7ab5 Compare August 3, 2026 08:48
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Action items

  • [high] [violation] packages/core/src/sync/providers/cortecs.ts:70 - Check: Provider sync must not invent completion limits from context size; API-authoritative fields only. Why: limit.output is taken only from authored files (and previously defaulted to context_size). Cortecs exposes context_size, not max completion tokens, so the sync wrote/kept output equal to the full context window and will omit output on new standalone models. That permanently overrides correct lab completion caps after base_model merge. Action: Stop authoring limit.output unless Cortecs documents a real completion cap; inherit lab/base output. Re-sync/fix every model whose output was set to context (e.g. Gemini 1_048_576, Claude 5 1_000_000, GPT-5.x 400_000/1_050_000, Haiku 200_000).
  • [high] [violation] providers/cortecs/models/gemini-2.5-flash.toml:10 - Check: Relay reasoning_options must follow lab + same-surface peers; [] means no caller control, not uncertainty (AGENTS.md / audit skill). Why: New/updated Gemini entries use reasoning_options = [] while Google and OpenRouter expose real controls (2.5: toggle + budget_tokens; 3.x: effort minimal|low|medium|high). Same pattern on Qwen3.5/3.6 ([] vs lab/peer toggle±budget), Gemma-4, and other controlled reasoners. Action: Author host-accurate options from lab/peers (or Cortecs wire docs), not empty arrays; fix Gemini, Qwen3.5/3.6, Gemma-4, and other reasoning = true models defaulted to [].
  • [high] [violation] providers/cortecs/models/claude-opus4-7.toml:7 - Check: budget_tokens only for real reasoning-budget APIs; not Claude 4.7+ adaptive effort. Why: Patch 2 added budget_tokens min 1024 to Opus 4.7/4.8, Opus 5, and Sonnet 5. First-party Anthropic entries for these are effort-only (4.7/4.8/Opus 5: low|medium|high|xhigh|max; Sonnet 5: toggle + those efforts)—no budget. Prior Cortecs comments for 4.7/4.8 said no budget is exposed. Action: Remove budget_tokens from Claude 4.7+ / 5 Cortecs files; align effort/toggle with lab/peers and what Cortecs actually maps.
  • [high] [violation] providers/cortecs/models/pixtral-12b-2409.toml:1 - Check: Non-lab hosts must use base_model; add complete models/<lab>/… when missing. Why: Cortecs is a multi-model relay, but many new entries are full inline definitions for nameable lab models (e.g. Pixtral vs models/mistral/pixtral-12b.toml, Nemotron Nano 30B vs models/nvidia/nemotron-3-nano-30b-a3b.toml, Llama 3.1 Nemotron Ultra vs models/nvidia/llama-3.1-nemotron-ultra-253b.toml, plus other Mistral/Meta/Amazon/etc. IDs). Sync only factors when resolveModelMetadataBaseModel matches, so most third-party IDs stay full definitions. Action: For every nameable third-party model, add/complete lab metadata and emit override-only provider files with base_model; extend ID→canonical mapping where Cortecs slugs differ.
  • [high] [violation] packages/core/src/sync/providers/cortecs.ts:54 - Check: reasoning = true ⇒ non-empty policy-compliant reasoning_options; relays must not default []. Why: Standalone path uses existing?.reasoning_options ?? []; base_model path only keeps options when existing.reasoning === true, so new base_model reasoners get no options and new standalones get empty arrays. That reintroduces the empty-options violations on every sync. Action: Derive options from known Cortecs/lab/peer baselines (or require hand-authored options and fail closed); never default relay reasoners to [].
  • [medium] [violation] providers/cortecs/models/kimi-k2.5.toml:1 - Check: Every toggle needs a leading top-of-file wire-path comment. Why: Kimi K2.5/K2.6 keep toggle but the PR dropped the prior thinking.type = enabled|disabled comments; sync only preserves a leading header, so mid-file notes are lost. Action: Restore a leading header on each toggle model documenting the exact Cortecs request field.
  • [medium] [possible mistake] providers/cortecs/models/deepseek-v4-pro.toml:7 - Check: DeepSeek V4 baseline is toggle + high/max, not invented L/M/H. Why: Cortecs still authors effort = low|medium|high with no toggle; lab is toggle + high|max, OpenRouter peers use high|xhigh. Supporting comments were removed. Action: Verify Cortecs wire behavior; if it proxies DeepSeek controls, switch to toggle + high/max (with wire comment); if it only accepts L/M/H, document that host-specific mapping in a leading comment.
  • [low] [possible mistake] providers/cortecs/models/claude-opus-5.toml:4 - Check: Relay effort sets should match lab/peers unless the host documents a narrower surface. Why: Claude 4.7+/5 lab entries include xhigh/max (Sonnet 5 also has toggle); Cortecs only lists low|medium|high. Action: Confirm Cortecs reasoning_effort values for these IDs and expand (or document the narrower map) accordingly.

@ASMAE20
ASMAE20 force-pushed the feat/add-cortecs-model-sync branch from 5da7ab5 to f38fa76 Compare August 3, 2026 09:07
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Action items

  • [high] [violation] packages/core/src/sync/providers/cortecs.ts:78 - Check: Relay reasoning_options must follow lab/same-surface peers; [] means no caller control, not uncertainty (AGENTS.md Reasoning options). Why: For standalone reasoners the sync does existing?.reasoning_options ?? [], and many synced reasoners are left as [] even when lab/peers expose controls (e.g. Gemini toggle/budget, Qwen3.5 toggle/budget, GPT effort). Re-running sync will keep baking false empties. Action: Stop defaulting to []. Preserve only verified host options; for new reasoners require lab/peer-derived options (or skip auto-create until authored). Fix catalog entries that currently claim [] without evidence of no control.

  • [high] [violation] providers/cortecs/models/gemini-2.5-flash.toml:2 - Check: Multi-model relay of controlled reasoners must not author empty reasoning_options. Why: Final files use reasoning_options = [] for google/gemini-2.5-flash, gemini-2.5-pro, gemini-3.1-flash-lite, gemini-3.5-flash, and Alibaba qwen3.5-* / qwen3.6-*, while first-party/OpenRouter peers expose toggle and/or budget_tokens (or effort). Action: Author Cortecs-real options from lab + peers (and providers/cortecs/provider.toml wire mapping); remove unjustified [].

  • [high] [violation] providers/cortecs/models/gemini-2.5-flash.toml:11 - Check: Provider limit.output must be a real completion cap, not context size. Why: Sync wrote output = context_size (e.g. Gemini Flash 1_048_576 vs lab 65_536; GPT-5 family 400_000 / GPT-5.6 1_050_000 vs lab 128_000). Patch 2 only keeps authored?.limit?.output, so these wrong values stick. Action: Drop bogus limit.output overrides so base limits inherit (or set verified caps). Change sync so unknown output is omitted for base_model rows, never copied from context_size.

  • [high] [violation] providers/cortecs/models/claude-opus4-7.toml:7 - Check: budget_tokens only when this host has a real reasoning-budget field; not for Claude 4.7+ adaptive effort. Why: Patch 2 adds budget_tokens min 1024 on claude-opus4-7 / claude-opus4-8 (and related). Lab + OpenRouter peers are effort-only (lowmax/xhigh); prior Cortecs notes said no budget for 4.7+. Action: Remove budget_tokens on 4.7/4.8+. Align effort with lab/peers (xhigh/max if Cortecs forwards them). Do not auto-copy older Claude budget onto adaptive models.

  • [high] [violation] providers/cortecs/models/pixtral-12b-2409.toml:1 - Check: Non-lab hosts must use base_model; add complete models/<lab>/… when missing. Why: Many third-party models are full inline definitions despite nameable labs (e.g. pixtral-*mistral/pixtral-*, DeepSeek/Mistral/Meta/Qwen/Nemotron/Nova stacks, gemma-3-27b-it, etc.). Cortecs is a relay. Action: For each nameable lab model, add/complete lab metadata if needed and factor provider files to override-only (cost, real deltas, reasoning_options). Keep full inline only for true host-unique IDs.

  • [medium] [violation] providers/cortecs/models/kimi-k2.5.toml:1 - Check: Every toggle needs a leading top-of-file wire-path comment. Why: Sync dropped the prior Kimi toggle comments; final kimi-k2.5 / kimi-k2.6 still have type = "toggle" with no leading wire comment (thinking.type). Action: Restore a leading header such as # Toggle: thinking.type = enabled|disabled (and ensure sync preserves leading headers).

  • [medium] [possible mistake] providers/cortecs/models/gpt-5.toml:4 - Check: GPT-style relay effort should match lab/peer sets for that model, not a fixed L/M/H. Why: New/updated GPT and gpt-oss rows use only low|medium|high, while OpenAI lab includes none / minimal / xhigh / max by model. Provider notes say Cortecs maps OpenAI reasoning_effort. Action: Verify Cortecs accepted values per model; expand to the lab set Cortecs actually forwards, or document host-narrowing with evidence.

  • [medium] [possible mistake] providers/cortecs/models/deepseek-v4-pro.toml:5 - Check: DeepSeek V4 baseline is lab/peer controls (toggle + high/max), not invented L/M/H. Why: Files keep effort = low|medium|high without toggle; lab is toggle + high|max, OpenRouter peers use high/xhigh. Action: Confirm Cortecs wire mapping for V4; if it proxies DeepSeek thinking controls, match lab (toggle + high/max). Do not keep L/M/H unless Cortecs docs/tests show those exact values.

  • [low] [possible mistake] providers/cortecs/models/deepseek-v4-pro.toml:12 - Check: EUR→USD cache prices should stay plausible vs prior Cortecs/lab cache rates. Why: cache_read jumps from 0.003625 to 0.432 on V4 Pro (Flash 0.00280.037) under EUR_TO_USD = 1.114. That is a large discontinuity vs lab cache pricing. Action: Verify API unit/field for cache_read_cost and the FX conversion; correct if the endpoint is per-token or a different fee.

@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Action items

  • [high] [violation] providers/cortecs/models/nvidia-nemotron-3-nano-30b-a3b.toml:1 - Check: Non-lab hosts must use base_model (and add complete models/<lab>/… when missing). Why: Cortecs is a multi-model relay, but many new/updated entries are full inline definitions for nameable lab models. Clear existing targets include nvidia/nemotron-3-nano-30b-a3b, nvidia/llama-3.1-nemotron-ultra-253b (llama-3.1-nemotron-ultra-253b-v1), mistral/pixtral-12b (pixtral-12b-2409), mistral/mistral-nemo (mistral-nemo-instruct-2407), plus other third-party IDs still authored as standalone (gemma-3-27b-it, ministral-*, nova-*, qwen3-vl-235b-a22b, qwen2.5-vl-72b-instruct, deepseek-r1-0528, hermes-*, etc.). Action: Point each third-party entry at canonical lab metadata (add complete lab files when absent); keep provider files override-only (cost, host reasoning_options, real deltas). Extend resolveCortecsBaseModel aliases where Cortecs IDs differ from lab slugs.
  • [high] [violation] providers/cortecs/models/claude-opus4-7.toml:10 - Check: budget_tokens only for real reasoning-budget surfaces; Claude 4.7+ is adaptive effort-only. Why: Patch 2 adds budget_tokens min 1024 on claude-opus4-7, claude-opus4-8, claude-opus-5, and claude-sonnet-5. First-party/OpenRouter peers for 4.7/4.8/Opus 5 are effort-only (no budget); prior Cortecs comments also said 4.7/4.8 expose no budget. This invents a control this generation does not have. Action: Drop budget_tokens on Claude 4.7+ / Claude 5 entries; keep effort only. Align effort values with lab/same-surface peers (lab uses low|medium|high|xhigh|max for these, not just L/M/H) if Cortecs actually forwards them.
  • [high] [violation] packages/core/src/sync/providers/cortecs.ts:75 - Check: Do not set limit.output from context size; preserve only real max-output. Why: Sync used output = context_size (then later freezes authored output). That wrote wrong provider overrides such as Gemini output = 1_048_576 (lab 65_536), GPT-5 output = 400_000 (lab 128_000), GPT-5.6-* output = 1_050_000 (lab 128_000), and many standalone models with output == context. Consumers will treat full context as max completion. Action: Stop defaulting output to context_size. For factored models, omit limit.output unless Cortecs differs from lab; for standalone models, author verified max-output (or inherit via base_model). Fix already-written bad limit.output overrides.
  • [high] [violation] providers/cortecs/models/deepseek-v4-flash-0731.toml:2 - Check: On relays, reasoning_options = [] means no caller control—not uncertainty—and must match lab/same-host peers when controls exist. Why: New V4 Flash 0731 is [] while same-provider deepseek-v4-flash / deepseek-v4-pro publish effort, OpenRouter peers publish effort, and DeepSeek first-party is toggle + high|max. Empty understates controls. Action: Set host-accurate options (at minimum match other Cortecs DeepSeek V4 entries; prefer lab toggle + high|max if Cortecs exposes those). Do not leave [] because the control set was not verified.
  • [medium] [violation] packages/core/src/sync/providers/cortecs.ts:88 - Check: Relay sync must not invent empty reasoning_options for every reasoner. Why: existing?.reasoning_options ?? [] (and runner fallback to []) stamps “no control” on new reasoning models without evidence. That produced empty options across Gemini, Qwen3.5/3.6, GLM, Nemotron, and other reasoners even when lab/peers expose controls and providers/cortecs/provider.toml documents reasoning_effort / Kimi thinking.type mappings. Action: Preserve hand-authored options; for new models, seed from lab/same-surface peers or leave for hand-authorship—never default to [] from uncertainty. Re-audit empty reasoners after the fix.
  • [medium] [violation] providers/cortecs/models/kimi-k2.5.toml:1 - Check: Every toggle needs a leading top-of-file wire comment. Why: Sync re-serialization drops the prior # Cortecs maps thinking.type = enabled|disabled headers on kimi-k2.5 / kimi-k2.6 while keeping type = "toggle". AGENTS requires the exact wire path above the first key because mid-file comments are stripped. Action: Restore a leading header such as # Toggle: thinking.type = enabled|disabled on each toggle model, and teach the sync to re-emit that header (or stop rewriting files that only need comment preservation).
  • [medium] [possible mistake] providers/cortecs/models/pixtral-12b-2409.toml:6 - Check: API supported_features must not force reasoning = true on non-reasoners when using full inline definitions. Why: Several standalone entries mark reasoning = true (e.g. pixtral-12b-2409, llama-3.1-8b-instruct, older Llama/Mistral instruct IDs) while lab metadata for the same families is non-reasoning. Without base_model, the feature flag becomes catalog truth and requires bogus reasoning_options. Action: Prefer base_model so lab reasoning wins; only override when Cortecs truly exposes a reasoner control for that ID.

@ASMAE20

ASMAE20 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

@rekram1-node

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.

2 participants