Commit graph

2030 commits

Author SHA1 Message Date
Armin Ronacher
abe508e1b8 Release v1.1.0 2026-10-07 23:33:33 +02:00
Armin Ronacher
a2eef9eb60 fix(ai): pin Kimi K3 Moonshot pricing and expect Haiku 5.5 adaptive thinking
models.dev now lists the input rate as Kimi K3's cache write cost on Moonshot, which does not bill cache writes. Claude Haiku 5.5 uses adaptive thinking, so the metadata test now expects it.
2026-10-07 22:41:41 +02:00
Armin Ronacher
dce4ae6f79 docs: audit changelogs for v1.1.0 2026-10-07 22:20:04 +02:00
Armin Ronacher
943a10e744 fix(ai): keep prompt-length pricing tiers from all model catalogs
models.dev loaders for opencode, opencode-go, google, minimax, and others built costs by hand and dropped tiers; they now use getModelsDevCost. OpenRouter prompt-length overrides and Vercel AI Gateway per-rate tiers are parsed into request-wide tiers. Rates a tier does not list keep the base price. OpenRouter time-of-day overrides are skipped.
2026-10-07 21:54:18 +02:00
Armin Ronacher
f76c1db662 feat(ai): add Claude Haiku 5.5
Adds claude-haiku-5-5 to the anthropic provider with its prompt-length pricing tier (5x above 100k input tokens), adaptive thinking with xhigh/max effort, per-message effort, and mid-conversation system messages and tool changes. Bedrock requests detect Haiku 5.5 for adaptive thinking, native xhigh, block binding, and prompt caching.
2026-10-07 21:44:58 +02:00
Mario Zechner
7fb59f995b fix(ai): retry Mistral finish_reason error
Mistral reports transient server failures as finish_reason "error". Its
error message now includes "server error" so the retry classifier treats
it as retryable.

closes #10487
2026-10-07 09:06:19 +00:00
Mario Zechner
8d8ae2fc24 fix(ai): fall back to a free port for Anthropic OAuth callback
Try 53692 first so forwarded setups keep working, then let the OS pick a
free loopback port when 53692 cannot be bound (e.g. Hyper-V/WSL port
exclusions on Windows). The authorize URL, paste prompt and token exchange
use the bound redirect URI.

closes #10571
2026-10-07 07:47:22 +00:00
Armin Ronacher
6b58544540 fix(ai): type empty OpenAI classifier catalogs 2026-10-07 08:35:06 +02:00
Armin Ronacher
ce8972a0e9 feat(ai,coding-agent): add OpenAI Decisions classifier and classifier images
Adds the openai-decisions classifier API with gpt-6-luna on the openai provider. bool questions map to predicates with the criteria in the instructions, refusals fail the result, and gateway timeouts (504) are not retried. The model needs an API key and is hidden from availability while openai uses Sign in with ChatGPT.

Adds optional images to ClassifierContext. Models without image input and APIs that cannot send images return an error result. Codemode's models.classify() accepts images.

Moves the shared classifier HTTP code out of system-one-shared.ts into classifier-shared.ts.
2026-10-07 08:27:56 +02:00
Mario Zechner
fe11328b0d fix(ai): compare faux prompt-cache usage per message
The faux provider's prompt-cache usage estimate compared the previous and
current prompt as two joined strings, character by character, on every
call. It now compares the prompts message by message and compares
characters only from the first differing message. Usage numbers are
unchanged.
2026-10-06 20:58:35 +02:00
Mario Zechner
f284a2460c fix(ai): time responses with private fields; use the real stream in proxy and test mocks
Replaces the WeakMap workaround. streamProxy and the agent and coding-agent test
mocks reimplemented AssistantMessageEventStream as plain EventStream subclasses;
they now use createAssistantMessageEventStream().
2026-10-06 20:26:27 +02:00
Mario Zechner
3ba22ce17a fix(ai): keep AssistantMessageEventStream assignable from plain event streams
The response timing added private fields, which made test and host streams built on
EventStream no longer assignable to StreamFn. Keep the start in a WeakMap instead.
2026-10-06 20:08:35 +02:00
Armin Ronacher
43d3763991 fix(ai): replace bundled Radius catalog with gateway catalog
Models disabled by an organization owner were still listed because the
fetched catalog was merged into the shipped default catalog.
2026-10-06 19:46:54 +02:00
Mario Zechner
36a686ee8d feat: record response, tool execution, and durable task times
pi-ai's AssistantMessageEventStream sets AssistantMessage.durationMs with a
monotonic clock for every API implementation. The agent loop and the durable
tool task set ToolResultMessage.durationMs around execute(). Durable task
records carry startedAt/endedAt stamped by the Session. The coding agent's bash
renderer shows Took from the recorded duration, also after a reload.

closes #10549
2026-10-06 19:28:54 +02:00
Justin Santer
2989eb581f
fix(ai): send reasoning effort to OpenAI models on Bedrock Converse (#10142)
buildAdditionalModelRequestFields only handled Claude, so the configured
thinking level never reached OpenAI models on Bedrock and they always ran at
Bedrock's default effort. gpt-oss now gets the flat reasoning_effort, clamped
to low/medium/high. Other GPT models (GPT-5.x, GPT-6) get nested
reasoning.effort, with minimal sent as low since Bedrock rejects it.

closes #9331
2026-10-06 18:06:46 +02:00
David Brailovsky
311f0e020d fix(ai): update output limit assertions for token estimate 2026-10-06 15:58:16 +00:00
David Brailovsky
27075fe075 fix(ai): estimate request context at 3.5 characters per token
Increase estimated input size to leave more room when calculating
output limits. Verified against OpenRouter DeepSeek V4 Flash: the
same large input now succeeds with an explicit output limit.

Fixes #10497
2026-10-06 17:37:24 +02:00
David Brailovsky
8b5708dbb1 fix(ai): retry transient server-busy provider errors
Recognize server_busy and servers are currently busy as retryable errors.

Fixes #10543
2026-10-06 15:59:24 +02:00
Lucas Meijer
0cf65d2bf7
fix(ai): let caller headers override Codex originator and User-Agent (#10429)
StreamOptions.headers documents that caller values override provider
defaults, and every other provider applies model/caller headers after its
User-Agent default. The Codex provider set originator and User-Agent after
merging caller headers, so they could not be overridden. Set the defaults
first; Authorization and chatgpt-account-id stay fixed.

Co-authored-by: Lucas Meijer <308974+lucasmeijer@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: David Brailovsky <davidbrai@gmail.com>
2026-10-06 10:01:19 +02:00
Lucas Meijer
9ad083102a
feat(ai): let apps name themselves in OpenAI logins (#10433)
LoginOptions.agentName replaces pi's name in the Sign in with ChatGPT
agent_name_hint and the Codex browser login originator.
2026-10-06 09:27:40 +02:00
Armin Ronacher
f6127a1bf9
feat(coding-agent): use llama.cpp classifier models natively (#10382)
This adds llama.cpp support for classifiers. Classifier models (Julia-1, Laya, Kev, lev, OpenJev) are listed as typesafe-system-one classifiers instead of chat models; other models keep the llama-cpp-classify fallback. Only 501 and 404 mark a model as chat, and classifier models restored from the model store are checked again once loaded.
2026-10-06 09:23:07 +02:00
Armin Ronacher
28dcce2ba4 Add [Unreleased] section for next cycle 2026-10-05 21:23:02 +02:00
Armin Ronacher
7c10bd4337 Release v1.0.4 2026-10-05 21:22:49 +02:00
David Brailovsky
5b6c792b42 fix(ai): retry HTTP/2 pending stream cancellation
Bedrock's HTTP/2 connection can stall until the SDK's 5-minute session
timeout, which fails the request with "The pending stream has been
canceled" (ERR_HTTP2_STREAM_CANCEL). The request was never sent, so it
is safe to retry, but the message was only retried when a DNS cause was
appended.

closes #10379
2026-10-05 13:49:46 +02:00
Armin Ronacher
997d31f286 Add [Unreleased] section for next cycle 2026-10-05 10:21:24 +02:00
Armin Ronacher
d78dc83d63 Release v1.0.3 2026-10-05 10:21:10 +02: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
bde882c747 fix(ai,coding-agent): persist rotated OAuth tokens when a refresh is cancelled
Cancelling a request or model refresh while an OAuth token refresh was in
flight discarded the rotated credential. Providers that rotate refresh tokens
(e.g. Sign in with ChatGPT) had already invalidated the old token, so the next
request failed with refresh_token_invalidated.

The caller's signal now cancels only the wait for the credential lock. Once a
refresh starts, it completes and is persisted, bounded by the refresh timeout.
Request auth and model-list refresh share this path.
2026-10-04 21:48:12 +02:00
Armin Ronacher
200387122c Add [Unreleased] section for next cycle 2026-10-04 02:41:25 +02:00
Armin Ronacher
cd32f7725f Release v1.0.2 2026-10-04 02:41:16 +02:00
Armin Ronacher
750105c80e docs(ai,coding-agent): move #9776 changelog entries to Unreleased 2026-10-04 02:36:48 +02:00
Duncan Ogilvie
76dfb88f63
feat(ai): add per-thinking-level sampling parameters (#9776) 2026-10-04 01:29:01 +02:00
Armin Ronacher
4c6fb7cfe8 Add [Unreleased] section for next cycle 2026-10-03 14:21:11 +02:00
Armin Ronacher
a7229ddc21 Release v1.0.1 2026-10-03 14:20:57 +02:00
Armin Ronacher
49b9df4895 fix(coding-agent): default NVIDIA to Nemotron 3 Ultra
NVIDIA no longer serves nvidia/nemotron-3-super-120b-a12b, so the default model and the NVIDIA e2e test now use nvidia/nemotron-3-ultra-550b-a55b.
2026-10-03 14:14:51 +02:00
Armin Ronacher
4215d4d6be docs(ai,coding-agent): audit changelog entries since v1.0.0
Add missing entries for the Together DeepSeek V4 Pro fix and the Nix flake, duplicate user-facing ai and tui changes into coding-agent, and add the New Features section.
2026-10-03 14:10:22 +02:00
Armin Ronacher
69f0be6f0a fix(ai): drop stale thinking blocks on Bedrock Claude replays
Send thinking.block_binding with prefix_mismatch_behavior=drop_block and
the thinking-binding-controls-2026-08-01 beta for Bedrock Claude Opus 4.7+,
Sonnet 5+, and Fable 5, matching the Anthropic provider. Opus 4.6 and
Sonnet 4.6 reject the field, and GovCloud is skipped.

closes #10324
2026-10-02 22:38:43 +02:00
Armin Ronacher
c71a496ff9
feat(coding-agent): add Nix flake (#9137)
Add a Nix flake that builds Pi from the checkout on aarch64/x86_64 Linux
and macOS. The build is offline: provider model data is hydrated from a
pi.dev model catalog revision pinned in nix/model-catalog.json, and the
runtime dependency tree comes from packages/coding-agent/install-lock with
internal packages built from source.

The Nix workflow keeps the catalog pin current on main, builds release
tags on all systems, and fast-forwards the stable branch to each release
that builds. The release script refreshes the pin before tagging.
2026-10-02 18:30:51 +02:00
David Brailovsky
4665fafb4d fix(ai): keep models.dev pricing tiers for Amazon Bedrock models
Bedrock OpenAI models were costed at the short-context rate above 272k
input tokens because the generator dropped the models.dev tiers.

closes #10326
2026-10-02 18:25:43 +02:00
David Brailovsky
eeac84ca92 fix(ai): fail Sign in with ChatGPT when the callback port is taken
When port 1455 was held by another pending login (another pi session
or the Codex CLI), login fell back to a paste prompt, but the browser
callback reached the other listener, which rejected it with "OAuth
state mismatch". Fail before opening the browser with a port-in-use
error instead.

fixes #10265
2026-10-02 17:44:05 +02:00
David Brailovsky
221cbcb02e docs(ai,coding-agent): document Cloudflare Clef classifiers
List @cf/cloudflare/clef and @cf/cloudflare/clef-flash under
cloudflare-workers-ai in the classifier models table and add changelog
entries crediting #10316 and #10322.
2026-10-02 16:58:49 +02:00
Nathan Disidore
4812cb268e
feat(ai): add Cloudflare Clef classifiers to Workers AI (#10316)
builds on https://github.com/earendil-works/pi/pull/10322 by @RealAlexandreAI
2026-10-02 16:52:58 +02:00
David Brailovsky
c10bfb0d79 fix(ai): use dashed Claude model IDs for Cloudflare AI Gateway
The gateway's /anthropic passthrough forwards the model ID to Anthropic
unchanged. models.dev lists the gateway's Claude models with dotted
versions (claude-opus-5.5), which Anthropic rejects with a 404. Convert
dots to dashes (claude-opus-5-5) when generating the catalog.
2026-10-02 16:12:00 +02:00
Armin Ronacher
b271b0a524 feat(ai): define Anthropic mid-conversation tools inline
Switch native Anthropic tool changes to the inline-tools-2026-09-15 beta. Later tools are defined by value in tool_addition blocks, so the top-level tool list stays fixed and same-name redefinitions no longer fall back to resending the full tool list. The deferred placeholder is kept.

Upgrade @anthropic-ai/sdk to 0.129.0 and deprecate hasToolRedefinitions().
2026-10-02 12:30:48 +02:00
David Brailovsky
3874b3e989 fix(ai): retry "Selected model is at capacity" provider errors
closes #10278
2026-10-02 11:38:35 +02:00
Carlos Villela
28eaccb8e8
fix(ai): update Together DeepSeek V4 Pro model ID (#10336) 2026-10-02 10:18:11 +02:00
Armin Ronacher
86dfceec40 Add [Unreleased] section for next cycle 2026-10-01 20:52:38 +02:00
Armin Ronacher
a13d35a742 Release v1.0.0 2026-10-01 20:52:21 +02:00
Armin Ronacher
bc2d8dc1c4 fix(ai): drop mismatched item ids when replaying grammar tool calls
Foreign tool call ids are normalized to fc_*, but grammar tools such as
codemode replay as custom_tool_call, which requires ctc_* ids. This broke
switching OpenAI models through Radius after a codemode call
(earendil-works/radius#115).
2026-10-01 20:42:40 +02:00
Armin Ronacher
92fc452c52 docs: audit changelogs and add new features for next release 2026-10-01 20:41:15 +02:00