Commit graph

39 commits

Author SHA1 Message Date
Christian Klotz
d7f7e0dfee
fix(coding-agent): resolve model references through one provider selection policy (#10913)
* fix(coding-agent): resolve model references through one provider selection policy

Model references from --model, --models/enabledModels, /model, and auth credential printing now share one resolver. It collects every candidate before choosing a provider, so catalog order never decides, a :<thinking> suffix cannot change the provider, and an ambiguous exact match no longer falls through to a fuzzy match.

provider/id still prefers the named provider's exact or fuzzy match. A gateway exposing provider/id as a raw model id is used when the named provider has no match, or lacks credentials while the gateway has them. Several gateways without a unique authenticated one are reported as ambiguous.

fixes #10160

* docs(coding-agent): shorten model selection notes in CLI reference

* docs(coding-agent): condense #10160 changelog entry

* fix(coding-agent): move model reference resolution into model-resolver

* fix(coding-agent): warn when a model scope pattern matches several providers

* docs(coding-agent): trim model resolver comments to the reasons

* fix(coding-agent): build custom model ids from the resolver's not-found target
2026-10-14 11:00:21 +01:00
Justin Santer
a37306d437
feat(ai): support Azure Foundry Chat Completions deployments (#9714)
* feat(ai): support Azure Foundry Chat Completions deployments

The Azure provider only implemented the Responses API, so Foundry
deployments that speak Chat Completions could not be used. On Chat
Completions the deepseek/deepseek-v4-pro model sends `thinking` and
`prompt_cache_key`, both of which Azure rejects with 400.

The provider now dispatches openai-completions alongside
azure-openai-responses. A stream wrapper resolves the Azure endpoint
onto the model first, since the shared openai-completions
implementation reads it off the model.

The request-shape differences are catalog compat rather than api code:
reasoning_effort instead of DeepSeek's thinking field, no prompt cache
parameters, reasoning_content kept on assistant turns so the prefix
Foundry cached stays byte-identical, and effort clamped to the
low/medium/high the deployment accepts.

The provider is renamed from azure-openai-responses to azure, since it
now serves more than the Responses API. The azure-openai-responses api
id is unchanged. Breaking: auth.json and models.json entries keyed on
azure-openai-responses must move to azure, and existing sessions see a
different provider on their next turn.

closes #9645

* feat(ai): apply the Azure deployment name map to Chat Completions

The Responses path already sent the deployment name from
AZURE_OPENAI_DEPLOYMENT_NAME_MAP. The Chat Completions path sent the
catalog model id, so any deployment not named after the model 404'd.

The Azure provider now swaps the deployment name into the request via
onPayload before dispatch, then runs the caller's own onPayload on it.
model.id stays the catalog id. The map helpers move to
azure-openai-config.ts so the provider can share them without
importing the SDK.

* docs(ai,coding-agent): add changelog entries for the Azure provider rename

Breaking: the azure-openai-responses provider is now azure. Users rename
the key in auth.json, models.json, and settings.json; SDK users switch to
getModel("azure", ...) and providers/azure.

Also note Azure Foundry Chat Completions support (DeepSeek V4 Pro).

---------

Co-authored-by: David Brailovsky <davidbrai@gmail.com>
2026-10-05 09:46:48 +02:00
Armin Ronacher
12c416e1a6 feat(ai,coding-agent): add GPT-6.1 Sol and make it the Codex default
Add gpt-6.1-sol to the OpenAI, Azure OpenAI Responses, and OpenAI Codex
providers with official pricing ($2 input, $0.10 cached input, $2.50
cache writes, $10 output, long-context tier above 272k). The model
rejects reasoning.effort "none", so off is unsupported and clamps to
the lowest effort.
2026-09-29 19:43:27 +02:00
Armin Ronacher
a328aa89ad
feat(ai,coding-agent): unify image and classifier model infrastructure (#9948) 2026-09-23 17:41:19 +02:00
Armin Ronacher
1a584a7a56 feat(ai,coding-agent): add Grok 4.7 support 2026-09-22 00:07:34 +02:00
Cristina Poncela Cubeiro
8fa7eebd23 fix: persist default to scoped if non-empty 2026-08-25 17:49:28 +02:00
Cristina Poncela Cubeiro
1c28f3032e
fix(ai): update cloudflare gateway sonnet test id (#8260) 2026-08-17 19:52:37 +02:00
Milosz Jankiewicz
70e878d4cf
feat(ai): route xAI models through Responses and default to Grok 4.6 (#8124)
* feat(ai): route xAI models through Responses and default to Grok 4.6

Send built-in xAI catalog models through the Responses API with
store: false and include reasoning.encrypted_content so encrypted
reasoning is requested and replayed, including future models.dev
additions. Thinking levels come from models.dev reasoning_options
(grok-4.6 exposes xhigh); models without verified options
(grok-build-0.1) keep reasoning always on and never send unsupported
"none"/"minimal" efforts. Narrow the xAI provider to the Responses API,
send pi's runtime User-Agent on xAI requests for provider-side
attribution, and make Grok 4.6 the default xAI model.

* fix(ai): drop duplicate xAI encrypted-reasoning tests

Azure already covers the shared replay path; keep the xAI-specific include-without-effort case next to the existing request tests.

---------

Co-authored-by: Jaaneek <Jaaneek@users.noreply.github.com>
2026-08-16 17:47:38 +02:00
Mario Zechner
e429d90b80 fix(coding-agent): update Z.AI Coding Plan defaults
closes #8096
2026-08-14 13:07:48 +02:00
Mehmet Aras
c03d78bdce
feat(ai): add Qwen Token Plan Individual provider (#7659) 2026-08-06 17:18:02 +02:00
Mario Zechner
fed6009cc9 fix(coding-agent): make model refresh cancellation caller-owned
Add generation-safe catalog publication, cancellable auth and storage operations, locally consistent credential mutations, and cache-first interactive model flows.
2026-08-04 00:03:52 +02:00
Cristina Poncela Cubeiro
b04faa2dae
fix: --model collects authed providers (#7366)
* fix: --model collects authed providers

* changeloggg

---------

Co-authored-by: Mario Zechner <badlogicgames@gmail.com>
2026-08-03 13:59:55 +02:00
Christian Klotz
a3ee1d286e
fix(coding-agent): expose unavailable scoped models (#7032)
* fix(coding-agent): expose unavailable scoped models

Keep missing configured models editable in the scoped-model selector. This fixes #6949.

* fix(coding-agent): reuse model scope diagnostics

* fix(coding-agent): classify model scope diagnostics
2026-07-25 07:19:56 +02:00
David Brailovsky
da8dd87260 fix(coding-agent): resolve bracketed scoped model ids as literals
fixes #6210
2026-07-23 08:23:24 +00:00
Mario Zechner
9993c96907 feat(coding-agent): replace model registry with model runtime
Move provider auth and OAuth flows onto pi-ai Models, compose models.json and extension overlays through ModelRuntime, and retain ModelRegistry as an extension compatibility facade.
2026-07-14 17:48:45 +02:00
Mario Zechner
fbdd46389c feat(ai): add max thinking level 2026-07-09 22:30:53 +02:00
Vegard Stikbakke
ca09b2b1a8 fix(coding-agent): skip unauthenticated default model
closes #6231
2026-07-02 10:48:11 +02:00
Vegard Stikbakke
040f0a5197 feat(coding-agent): expose model resolution helpers
closes #6201
2026-07-01 10:22:35 +02:00
Mario Zechner
774288587f fix(coding-agent): update OpenAI default model 2026-06-25 15:18:18 +02:00
Armin Ronacher
1b2c32c653 fix(coding-agent): resolve authenticated slash model ids
closes #5643
2026-06-12 18:32:42 +02:00
Armin Ronacher
1fc80f4f6c fix(coding-agent): preserve custom fallback thinking
closes #5552
2026-06-12 17:26:42 +02:00
haoqixu
aa03982169 fix(coding-agent): parse :thinking suffix from custom model IDs in fallback path
Fixes #5552
2026-06-10 02:01:35 +08:00
Mario Zechner
25a4a8ed1e Add Ant Ling provider 2026-06-02 16:37:44 +02:00
Mario Zechner
2e02c74dcb chore: pin dependencies and use native TypeScript 2026-05-20 12:46:17 +02:00
Mario Zechner
3e5ad67e0f chore: migrate pi packages to earendil works scope 2026-05-07 15:59:42 +02:00
Mario Zechner
91154d9757 fix: update stale CI test expectations 2026-04-24 20:22:16 +02:00
简简简简
8705fbee54
fix(models): align minimax and zai defaults (#2445)
Update the coding-agent default model picks for ZAI, Cerebras,
and MiniMax so new sessions prefer the current model lineup.

Add the missing MiniMax-M2.1-highspeed direct provider entries
and normalize MiniMax Anthropic-compatible context limits so the
catalog matches the provider's supported model set.
2026-03-20 10:00:57 +01:00
Markus Ylisiurunen
f8d731a134 fix codex context window and add a few tests 2026-03-05 22:54:16 +01:00
Scott
6f4bd814b8
fix(coding-agent): allow provider-scoped custom model ids (#1759) 2026-03-03 14:20:49 +01:00
Mario Zechner
7364696ae6 fix(coding-agent): prefer provider/model split over gateway model id matching
When resolving --model zai/glm-5, the resolver now correctly interprets
'zai' as the provider and 'glm-5' as the model id, rather than matching
a vercel-ai-gateway model whose id is literally 'zai/glm-5'.

If the provider/model split fails to find a match, falls back to raw id
matching to still support OpenRouter-style ids like 'openai/gpt-4o:extended'.
2026-02-22 14:40:36 +01:00
Mario Zechner
4793f7c92d fix(coding-agent): make resolveCliModel sync, update docs and changelog 2026-02-12 19:04:51 +01:00
Armin Ronacher
56342258e1 fix(coding-agent): honor --model selection, thinking, and --api-key 2026-02-12 18:58:45 +01:00
Mario Zechner
61fe132946 fix(coding-agent): stabilize pinned git parsing and model default test 2026-02-05 21:43:27 +01:00
Mario Zechner
19f3c23f6d Fix PR #689: Add changelog attribution, coding-agent changelog, fix test types, add provider to test suites
- Fix ai/CHANGELOG.md: add PR link and author attribution
- Add coding-agent/CHANGELOG.md entry for vercel-ai-gateway provider
- Fix model-resolver.test.ts: use anthropic-messages API type to match generated models
- Add vercel-ai-gateway to test suites: tokens, abort, empty, context-overflow, unicode-surrogate, tool-call-without-result, image-tool-result, total-tokens, image-limits
2026-01-13 16:46:00 +01:00
Timo Lins
65eb738c90 Rename to vercel-ai-gateway for clarity 2026-01-13 16:42:34 +01:00
Timo Lins
164a69a601 Add Vercel AI Gateway support 2026-01-13 16:42:34 +01:00
Fero
cbd3a8cb87
fix: use defaultThinkingLevel from settings when enabledModels lacks explicit suffix (#540)
When enabledModels is configured without thinking level suffixes (e.g.,
'claude-opus-4-5' instead of 'claude-opus-4-5:high'), the scoped model's
default 'off' thinking level was overriding defaultThinkingLevel from
settings.

Now thinkingLevel in ScopedModel is optional (undefined means 'not
explicitly specified'). When passing to SDK, undefined values are filled
with defaultThinkingLevel from settings.
2026-01-07 18:11:03 +01:00
Mario Zechner
d6283f99dc refactor(hooks): split session events into individual typed events
Major changes:
- Replace monolithic SessionEvent with reason discriminator with individual
  event types: session_start, session_before_switch, session_switch,
  session_before_new, session_new, session_before_branch, session_branch,
  session_before_compact, session_compact, session_shutdown
- Each event has dedicated result type (SessionBeforeSwitchResult, etc.)
- HookHandler type now allows bare return statements (void in return type)
- HookAPI.on() has proper overloads for each event with correct typing

Additional fixes:
- AgentSession now always subscribes to agent in constructor (was only
  subscribing when external subscribe() called, breaking internal handlers)
- Standardize on undefined over null throughout codebase
- HookUIContext methods return undefined instead of null
- SessionManager methods return undefined instead of null
- Simplify hook exports to 'export type * from types.js'
- Add detailed JSDoc for skipConversationRestore vs cancel
- Fix createBranchedSession to rebuild index in persist mode
- newSession() now returns the session file path

Updated all example hooks, tests, and emission sites to use new event types.
2025-12-30 22:42:22 +01:00
Aliou Diallo
9a7863fc98
fix(coding-agent): handle OpenRouter models with colons in IDs (#242) 2025-12-19 15:26:12 +01:00