pi-mono/packages/coding-agent/src
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
..
bun feat(coding-agent): codemode and MCP 2026-09-29 09:12:50 +02:00
cli fix(coding-agent): ignore empty entries in --models 2026-10-02 13:42:38 +02:00
client fix(coding-agent): restore client compatibility entrypoint 2026-08-28 13:31:05 +02:00
core feat(ai): support Azure Foundry Chat Completions deployments (#9714) 2026-10-05 09:46:48 +02:00
experimental feat(coding-agent): experimental durable vacation planner demo 2026-10-01 19:59:14 +02:00
extensions feat(coding-agent): save codemode image() output to temp files 2026-10-04 23:32:43 +02:00
modes fix(coding-agent): do not report dead terminal stdin errors as crashes 2026-10-05 00:41:56 +02:00
utils feat(coding-agent): save codemode image() output to temp files 2026-10-04 23:32:43 +02:00
cli.ts fix(coding-agent): keep remote harness dependencies development-only 2026-09-05 12:45:04 +02:00
config.ts fix(coding-agent): keep codemode working after the install is updated or removed 2026-10-04 22:49:20 +02:00
index.ts fix(coding-agent): render MCP tool calls before their server connects 2026-10-03 13:54:18 +02:00
main.ts fix(coding-agent): require --model when --provider is given 2026-10-01 10:25:16 +02:00
migrations.ts fix(coding-agent): update repository links to "earendil-works/pi" (#9278) 2026-09-07 14:09:39 +02:00
package-manager-cli.ts feat(coding-agent): remove npm shrinkwrap and recommend the managed installer 2026-10-02 17:16:56 +02:00
rpc-entry.ts feat(coding-agent): set AI_AGENT environment variable (#7493) 2026-08-03 13:45:32 +02:00