Commit Graph

161 Commits

Author SHA1 Message Date
Mario Zechner
564ad70fb8 Merge pull request #5333 from vastxie/zai-coding-cn-provider
feat(ai): add ZAI Coding Plan China provider
2026-06-03 01:07:01 +02:00
Mattia Cerutti
83afcdc24f fix(ai): remove stale codex models 2026-06-03 00:09:30 +02:00
弎水
51df39b9b9 feat(ai): add ZAI Coding Plan China provider 2026-06-02 23:39:56 +08:00
Mario Zechner
25a4a8ed1e Add Ant Ling provider 2026-06-02 16:37:44 +02:00
Mario Zechner
7e72ca47c8 Add MiniMax-M3 to direct minimax providers
closes #5313
2026-06-02 16:00:29 +02:00
Mario Zechner
2125221bfc Fix OpenRouter Kimi reasoning compat
closes #5309
2026-06-02 15:36:52 +02:00
Mario Zechner
6e269edfd0 Restore NVIDIA Qwen 3.5 122B model 2026-06-02 15:10:36 +02:00
Mario Zechner
6014801229 Add NVIDIA NIM provider 2026-06-02 15:09:36 +02:00
Mario Zechner
f429ddbffd Fix OpenAI GPT-5.5 thinking metadata
closes #5243
2026-06-01 00:39:48 +02:00
Michael Yu
40832d1957 fix(ai): suppress deprecated temperature param for Claude Opus 4.7+ 2026-05-31 16:20:22 +08:00
Mario Zechner
a213abb97e Fix OpenRouter Kimi K2.6 developer role
closes #5159
2026-05-29 23:41:14 +02:00
Mario Zechner
ba2d313858 fix(ai): handle OpenCode Kimi reasoning params 2026-05-29 23:27:48 +02:00
Armin Ronacher
4faac05419 fix(ai): handle OpenCode reasoning params 2026-05-29 12:21:37 +02:00
Mario Zechner
0127caea7b Fix OpenRouter DeepSeek V4 xhigh reasoning
closes #4801
2026-05-28 23:56:59 +02:00
Mario Zechner
97ef317389 Fix Kimi and Xiaomi model metadata
Closes #5075, closes #5078. Refs #5087.
2026-05-28 22:19:47 +02:00
Mario Zechner
bfa3d1fa60 Update Claude Opus and GPT thinking metadata 2026-05-28 21:51:55 +02:00
Mario Zechner
458a7bc27c Fix Anthropic empty thinking signature replay
closes #4464
2026-05-28 12:04:33 +02:00
Armin Ronacher
71446c6c2b fix(ai): correct Codex Spark context window
closes #4969
2026-05-26 09:08:40 +02:00
Mario Zechner
d801d88a11 Support adaptive thinking for Anthropic-compatible aliases
closes #4790
2026-05-22 18:30:51 +02:00
Mario Zechner
2e02c74dcb chore: pin dependencies and use native TypeScript 2026-05-20 12:46:17 +02:00
Armin Ronacher
ae9450dc51 chore(ts): use source import extensions 2026-05-20 00:04:03 +02:00
Mario Zechner
b8f51957a0 fix(ai): add Xiaomi reasoning replay compat
closes #4678
2026-05-18 11:15:20 +02:00
Mario Zechner
ed3904ddd3 fix(ai): switch xiaomi models to openai completions
closes #4505
2026-05-18 00:14:31 +02:00
Mario Zechner
266234047a Remove openai-codex fast model variants, they do not work 2026-05-18 00:02:52 +02:00
Mario Zechner
a01cf7afae Merge pull request #4603 from mattiacerutti/fix/openai-codex-model-list
fix(ai): update OpenAI Codex model list
2026-05-17 20:54:53 +02:00
Mattia Cerutti
485afc9c3f fix(ai): map copilot gpt minimal thinking to low 2026-05-17 12:18:50 +02:00
Mattia Cerutti
1af823be9d fix(ai): update OpenAI Codex model list 2026-05-17 03:12:19 +02:00
Mario Zechner
2c708492e3 Release v0.74.1 2026-05-17 01:35:45 +02:00
Apoorv Saxena
e2b69a0bb1 fix(ai): mark inception/mercury-2 thinkingLevelMap.off as null
Mercury 2 in instant mode (reasoning_effort: "none") disables tool calling.
The openai-completions provider hardcodes {reasoning:{effort:"none"}} when no
explicit reasoning level is passed and thinkingLevelMap.off isn't null
(openai-completions.ts:575), so every caller that doesn't opt in to a level
silently breaks Mercury 2's agentic use cases.

Setting thinkingLevelMap.off = null on the Mercury 2 catalog entry causes the
provider to omit the reasoning param entirely, letting Mercury 2's own default
take over. Low/medium/high pass through verbatim; OpenRouter normalizes them
to Mercury's vocabulary.

Prefix-matched on "inception/mercury-2" so future Mercury 2 variants on
OpenRouter inherit the fix.
2026-05-13 19:17:36 +05:30
yanirz
99dc6fcec8 fix(ai): add session affinity and compat fixes for Fireworks provider caching
Fireworks prompt caching is enabled by default (automatic prefix matching),
but on serverless infrastructure, requests hit random replicas. Without
session affinity, the per-replica cache misses, negating cache hit rates
and the discounted cacheRead pricing.

Changes:

- Add sendSessionAffinityHeaders and supportsCacheControlOnTools
  to AnthropicMessagesCompat interface
- Send x-session-affinity header for Fireworks (and Cloudflare AI
  Gateway Anthropic) when sessionId is available and caching is enabled
- Omit cache_control on tool definitions for Fireworks (unsupported
  per https://docs.fireworks.ai/tools-sdks/anthropic-compatibility)
- Default supportsEagerToolInputStreaming to false for Fireworks
  (unsupported field)
- Default supportsLongCacheRetention to false for Fireworks
  (cache_control.ttl not supported)
- Add compat settings to Fireworks models in generate-models.ts
- Update generated models with Fireworks compat settings
- Add integration tests for session affinity and tool compat

Refs: https://docs.fireworks.ai/guides/prompt-caching
Refs: https://docs.fireworks.ai/tools-sdks/anthropic-compatibility
2026-05-10 00:11:36 +02:00
Mario Zechner
7adb8e7634 feat(ai): add Together AI provider 2026-05-08 16:44:18 +02:00
Mario Zechner
9751057be9 Merge pull request #3887 from cristinaponcela/feat/image-outputs
feat: image content
2026-05-08 15:57:06 +02:00
Mario Zechner
783e96a144 fix(ai): disable OpenAI reasoning where supported 2026-05-07 22:52:54 +02:00
Cristina Poncela Cubeiro
ffdf426e33 Merge remote-tracking branch 'upstream/main' into feat/image-outputs 2026-05-07 16:46:17 +02:00
Armin Ronacher
ace3fd7e30 fix(ai): normalize kimi k2p6 alias to kimi-for-coding closes #4218 2026-05-06 11:34:49 +02:00
Cristina Poncela Cubeiro
5731e13a61 Merge branch 'main' into feat/image-outputs 2026-05-04 16:42:51 +01:00
Cristina Poncela Cubeiro
63c61aac6f feat: image models 2026-05-04 17:07:02 +02:00
Cristina Poncela Cubeiro
cbf3c333ef revert 2026-05-04 15:43:45 +02:00
Jake Jia
693888ac47 feat(ai): switch xiaomi default to api billing, add per-region token plan providers (#4112)
Built-in `xiaomi` provider now targets the API billing endpoint (https://api.xiaomimimo.com/anthropic) — a single stable URL for keys issued at platform.xiaomimimo.com. The Token Plan endpoints are exposed as three sibling providers, each with its own env var:

- xiaomi-token-plan-cn: XIAOMI_TOKEN_PLAN_CN_API_KEY
- xiaomi-token-plan-ams: XIAOMI_TOKEN_PLAN_AMS_API_KEY
- xiaomi-token-plan-sgp: XIAOMI_TOKEN_PLAN_SGP_API_KEY

BREAKING CHANGE: users who previously set XIAOMI_API_KEY against the Token Plan AMS endpoint must move to xiaomi-token-plan-ams and set XIAOMI_TOKEN_PLAN_AMS_API_KEY. This also resolves the 401 reported by on #4005, where a platform.xiaomimimo.com key fails against the Token Plan endpoint.

closes #4082
2026-05-03 12:57:11 +02:00
Jakub Synowiec
c8edb256b9 fix(ai): fix mismatch between models.dev and OpenCode Go (Qwen3.5/3.6, MiniMax M2.7) (#4110) 2026-05-03 00:41:55 +02:00
Mario Zechner
c0e046990e fix(ai): use Xiaomi Token Plan Anthropic endpoint
closes #3912
2026-05-02 01:36:34 +02:00
Mario Zechner
80f06d3636 feat: add model thinking level metadata
closes #3208
2026-05-02 01:21:06 +02:00
Jake Jia
a44622670f feat(ai): add Xiaomi MiMo provider (#4005)
* fix(ai): include minimax-cn in cross-provider-handoff matrix

* feat(ai): add Xiaomi MiMo provider

Adds Xiaomi MiMo as an openai-completions-compatible provider.

- packages/ai: register provider in types/KnownProvider, env-api-keys (XIAOMI_API_KEY), generate-models, models.generated.ts, overflow util, README, CHANGELOG
- packages/ai/test: extend stream, tokens, abort, empty, context-overflow, overflow, image-tool-result, tool-call-without-result, total-tokens, unicode-surrogate, cross-provider-handoff matrices with Xiaomi
- packages/coding-agent: default model (mimo-v2.5-pro), display name (Xiaomi MiMo), CLI env var docs, README, docs/providers.md

closes #3912

---------

Co-authored-by: Mario Zechner <badlogicgames@gmail.com>
2026-05-02 00:46:05 +02:00
Mario Zechner
f5b6e4fab0 fix(ai): handle OpenRouter DeepSeek V4 reasoning
Closes #4055

Closes #4047
2026-05-01 22:19:06 +02:00
Mario Zechner
a45577bd00 fix(ai): finalize cloudflare gateway provider support 2026-05-01 00:56:05 +02:00
MC
24fb6b833b feat(ai): add Cloudflare AI Gateway as a provider (#3856)
* feat(ai): add Cloudflare AI Gateway as a provider

Routes through Cloudflare's Unified API (`/compat`) for Workers AI and
Anthropic models, and through the provider-specific `/openai` subpath
for OpenAI models so reasoning models (gpt-5.x, o-series) can hit
`/v1/responses` natively. Once `/compat` adds Responses-API support,
the OpenAI subpath can be folded back in.

Catalog layout:
  workers-ai/@cf/...  -> openai-completions, gateway/.../compat
  anthropic/...       -> openai-completions, gateway/.../compat
  <native-id>         -> openai-responses,   gateway/.../openai
                         (gpt-5.1, claude-... no, sorry: gpt-5.x and o-series only;
                          prefix stripped because the OpenAI SDK posts native ids)

Touches:
  packages/ai/src/types.ts                       add cloudflare-ai-gateway to KnownProvider
  packages/ai/src/env-api-keys.ts                map to CLOUDFLARE_API_KEY
  packages/ai/src/providers/cloudflare.ts        add CLOUDFLARE_AI_GATEWAY_COMPAT_BASE_URL
                                                 and CLOUDFLARE_AI_GATEWAY_OPENAI_BASE_URL
  packages/ai/src/providers/openai-responses.ts  one-line dispatch through resolveCloudflareBaseUrl
                                                 (matches what openai-completions.ts already does)
  packages/ai/scripts/generate-models.ts         branch openai/* vs workers-ai/anthropic/*
  packages/ai/src/models.generated.ts            spliced 34 entries
  packages/ai/test/stream.test.ts                3 e2e blocks (one per upstream)
  packages/coding-agent/*                        defaultModelPerProvider, login, env docs,
                                                 README, providers.md

Verified end-to-end against a real Cloudflare account with unified
billing: 9/9 e2e tests pass across all three upstreams (Workers AI
Kimi K2.6, OpenAI gpt-5.1 reasoning, Anthropic claude-sonnet-4-5).

* refactor(ai): move AI Gateway User-Agent and per-route session-affinity flag to catalog

Mirrors the same per-model metadata refactor done for Workers AI in the
parent branch. All cloudflare-ai-gateway entries get the User-Agent
header. Only workers-ai/* gateway entries set
`compat.sendSessionAffinityHeaders: true` because the gateway
forwards that header to the underlying Workers AI runtime; anthropic/*
upstream and openai/* (openai-responses) don't use it.

  packages/ai/scripts/generate-models.ts: emit headers (always) and
  per-upstream compat (workers-ai only) on each cloudflare-ai-gateway
  entry.
  packages/ai/src/models.generated.ts: re-spliced 35 entries with
  headers + conditional compat.

Behavior unchanged - 9/9 e2e tests pass across all three upstream
families.

* fix(ai): align AI Gateway with telemetry-aware UA helper

Adapts to badlogic/pi-mono#3851's follow-up fix ("honor telemetry for
Cloudflare attribution headers", fbb5eed) which moved the
'User-Agent: pi-coding-agent' header out of per-model catalog metadata
and into a centralized telemetry-honoring helper
(coding-agent/src/core/sdk.ts:getAttributionHeaders).

- packages/coding-agent/src/core/sdk.ts: extend the cloudflare branch of
  getAttributionHeaders to also match cloudflare-ai-gateway and
  gateway.ai.cloudflare.com.

- packages/ai/scripts/generate-models.ts and src/models.generated.ts:
  drop 'headers' from the 35 cloudflare-ai-gateway entries (constant
  CLOUDFLARE_STATIC_HEADERS no longer exists). Per-route
  compat.sendSessionAffinityHeaders is unchanged.

End-to-end behavior unchanged: 9/9 tests still pass across all three
upstream families (Workers AI, Anthropic, OpenAI Responses).

---------

Co-authored-by: Mario Zechner <badlogicgames@gmail.com>
2026-04-30 23:29:37 +02:00
Mario Zechner
fe66edd943 remove gemini cli and antigravity support 2026-04-30 21:24:36 +02:00
Armin Ronacher
7dc1bed478 feat(ai): add Moonshot AI provider model support 2026-04-30 17:21:03 +02:00
Johannes Ebeling
779d0ef39d feat(ai): add Mistral Medium 3.5 model (#4009) 2026-04-30 12:18:17 +02:00
Mario Zechner
c1dd6082ee fix(ai): apply DeepSeek V4 reasoning compat
closes #3940
2026-04-29 23:25:03 +02:00