Commit Graph
60 Commits
Author SHA1 Message Date
coder-automations[bot]andgithub-actions[bot] 11b33b4c26 chore: refresh AI model price book (#32436)
## Price book changes

17 models added, 0 models removed, 19 models changed.

<details>
<summary>Added</summary>

- azure/gpt-6.2-astra
- azure/gpt-6.2-sol
- bedrock/global.openai.gpt-6.2-astra
- bedrock/global.openai.gpt-6.2-sol
- bedrock/openai.gpt-6.2-astra
- bedrock/openai.gpt-6.2-sol
- bedrock/us.openai.gpt-6.2-astra
- bedrock/us.openai.gpt-6.2-sol
- copilot/gemini-4-neon
- copilot/gpt-6.2-astra
- copilot/gpt-6.2-sol
- copilot/mai-code-2
- copilot/mai-code-2-flash
- google/gemini-4-neon
- openrouter/google/gemini-4-neon
- vercel/google/gemini-4-neon
- vercel/scaledown/extract-1
</details>

<details>
<summary>Changed</summary>

- openrouter/deepseek/deepseek-r1-0528
- openrouter/deepseek/deepseek-v4-flash-0731
- openrouter/deepseek/deepseek-v4.1-flash
- openrouter/deepseek/deepseek-v4.1-flash-1017
- openrouter/google/gemma-3-27b-it
- openrouter/google/gemma-4-26b-a4b-it
- openrouter/minimax/minimax-m3.1-flash
- openrouter/moonshotai/kimi-k2.7-code
- openrouter/moonshotai/kimi-k3
- openrouter/moonshotai/kimi-k3.1-pro
- openrouter/qwen/qwen3.5-27b
- openrouter/qwen/qwen3.5-9b
- openrouter/reflection/beam-1.0-501b-a23b
- openrouter/xiaomi/mimo-v2.5-pro
- openrouter/z-ai/glm-5.1
- openrouter/z-ai/glm-5.3-flash
- openrouter/~deepseek/deepseek-flash-latest
- openrouter/~deepseek/deepseek-v4-flash-latest
- openrouter/~moonshotai/kimi-latest
</details>

## Review notes

Regenerated by `make gen/aibridge-prices` from the live
[models.dev](https://models.dev) catalog. Both artifacts come from one
snapshot, so they ship together:

- `coderd/aibridge/prices/data/prices.json`
- `site/src/modules/aiModels/knownModels/knownModelsGenerated.json`

These are customer-visible cost numbers taken from upstream data, so
this PR is never merged automatically. The summary above lists what
moved; check the diff for exact figures before approving.

Opened automatically by the [aigateway-prices-refresh
workflow](https://github.com/coder/coder/actions/runs/44492971443).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-19 14:30:51 +00:00
Ethan feea5ab959 feat: add GPT-6.2 Astra and GPT-6.2 Sol to Agents and AI Gateway (#32370)
Closes CODAGT-1608

This adds `gpt-6.2-astra` and `gpt-6.2-sol` to the Agents known models
catalog, so they're suggested when an admin adds a chat model, and
regenerates the AI Gateway price book from models.dev so the gateway can
price them.

| Model | Input | Output | Cache read | Cache write |
|---|---|---|---|---|
| GPT-6.2 Astra | $8 | $40 | $0.40 | $10 |
| GPT-6.2 Sol | $2 | $10 | $0.10 | $2.50 |

Prices are per 1M tokens, and both models have a 1,050,000 token context
window and 128,000 max output tokens. They're in the catalog for OpenAI
(with a suggested effort of `medium`, same as `gpt-6-astra` and
`gpt-6.1-sol`), OpenRouter and Vercel. models.dev doesn't list them on
Azure or Bedrock yet, so I've left those out for now.

Both models also reject the `none` and `minimal` reasoning efforts. A
model config only sets a default and a maximum effort, so the picker
always offers both, and picking either one fails the turn:

```
Unsupported value: 'none' is not supported with the 'gpt-6.2-astra' model. Supported values are: 'low', 'medium', 'high', 'xhigh', and 'max'.
```

We already send `low` instead for `gpt-6-astra` and `gpt-6.1-sol`, so to
fix, we'll just do the same for the two new models. All four now live in
one list of model ID prefixes, rather than a helper each. I checked this
against the real models: all four return a 400 like the one above for
`none` and `minimal`, and accept `low`. `gpt-6-sol` and `gpt-6.1-terra`
still accept `none`, so they're left alone.

Regenerating the price book also brings in everything else models.dev
changed since the last weekly refresh, mostly on OpenRouter and Vercel:
22 other new entries (4 of them `-pro` and `-fast` variants of these
two), 29 it dropped and 51 price changes. 6 existing catalog entries get
new prices or limits the same way.
2026-11-19 00:33:46 +11:00
cdrciandgithub-actions[bot] eb6094979b chore: refresh AI model price book (#32072)
## Price book changes

32 models added, 18 models removed, 42 models changed.

<details>
<summary>Added</summary>

- anthropic/claude-fable-5-2
- azure/claude-fable-5-2
- bedrock/anthropic.claude-fable-5-2
- bedrock/global.anthropic.claude-fable-5-2
- bedrock/global.moonshotai.kimi-k3.1
- bedrock/us.anthropic.claude-fable-5-2
- bedrock/us.moonshotai.kimi-k3.1
- copilot/claude-fable-5.2
- copilot/gemini-4-carbon
- google/gemini-4-carbon
- openrouter/anthropic/claude-fable-5.2
- openrouter/baidu/ernie-5.5-flash-preview:free
- openrouter/baidu/ernie-light-dt-1.0-intl
- openrouter/google/gemini-4-carbon
- openrouter/google/gemini-omni-1.1-flash
- openrouter/google/gemini-omni-1.2-flash
- openrouter/kt/midm-k-3.0-pro
- openrouter/liquid/lfm-3-1.7b
- openrouter/liquid/lfm-3-1.7b:free
- openrouter/meta/muse-ember
- openrouter/motif-technologies/motif-3
- openrouter/nex-agi/nex-n2.6
- openrouter/thinkingmachines/inkling-2-small:free
- openrouter/unbiased/pareto-26.10-preview
- vercel/alibaba/qwen3.6-35b-a3b
- vercel/anthropic/claude-fable-5.2
- vercel/anthropic/claude-fable-5.2-fast
- vercel/deepseek/deepseek-v4.1-flash-1017-ultrafast
- vercel/google/gemini-4-carbon
- vercel/google/gemini-omni-1.2-flash
- vercel/humansand/ampersand-v0.1
- vercel/meta/muse-ember
</details>

<details>
<summary>Removed</summary>

- openrouter/bytedance-seed/seed-1.6
- openrouter/bytedance-seed/seed-1.6-flash
- openrouter/bytedance-seed/seed-2.0-code
- openrouter/inception/mercury-2
- openrouter/inception/mercury-2.5
- openrouter/inception/mercury-3
- openrouter/minimax/minimax-01
- openrouter/minimax/minimax-m1
- openrouter/minimax/minimax-m2
- openrouter/minimax/minimax-m2-her
- openrouter/minimax/minimax-m2.1
- openrouter/nvidia/nemotron-3.5-content-safety:free
- openrouter/qwen/qwen-2.5-7b-instruct
- openrouter/stealth/crouton-alpha
- openrouter/xingchen-agi/xing4.0-29b-a4b:free
- vercel/bytedance/seed-1.6
- vercel/bytedance/seed-1.8
- vercel/google/gemini-3.1-flash-image-preview
</details>

<details>
<summary>Changed</summary>

- openrouter/anthracite-org/magnum-v4-72b
- openrouter/deepseek/deepseek-chat
- openrouter/deepseek/deepseek-v4-flash
- openrouter/deepseek/deepseek-v4-flash-0731
- openrouter/deepseek/deepseek-v4-flash-vision-exp
- openrouter/deepseek/deepseek-v4-pro
- openrouter/deepseek/deepseek-v4-pro-0813
- openrouter/deepseek/deepseek-v4.1-flash
- openrouter/google/gemma-4-26b-a4b-it
- openrouter/ibm-granite/granite-4.2-8b
- openrouter/inclusionai/ling-3.1-flash
- openrouter/mancer/weaver
- openrouter/meta-llama/llama-3.1-8b-instruct
- openrouter/meta-llama/llama-3.2-3b-instruct
- openrouter/meta-llama/llama-3.3-70b-instruct
- openrouter/minimax/minimax-m2.5
- openrouter/minimax/minimax-m2.7
- openrouter/mistralai/mistral-small-3.2-24b-instruct
- openrouter/moonshotai/kimi-k2.5
- openrouter/moonshotai/kimi-k2.7-code
- openrouter/moonshotai/kimi-k3.1-pro
- openrouter/nvidia/nemotron-3-super-120b-a12b
- openrouter/nvidia/nemotron-3.5-super-vl
- openrouter/openai/gpt-oss-120b
- openrouter/qwen/qwen3-14b
- openrouter/qwen/qwen3-next-80b-a3b-instruct
- openrouter/qwen/qwen3.5-397b-a17b
- openrouter/qwen/qwen3.5-9b
- openrouter/qwen/qwen3.6-27b
- openrouter/reflection/beam-1.0-501b-a23b
- openrouter/undi95/remm-slerp-l2-13b
- openrouter/z-ai/glm-4.5-air
- openrouter/z-ai/glm-5.2
- openrouter/z-ai/glm-5.3-flash
- openrouter/~anthropic/claude-fable-latest
- openrouter/~deepseek/deepseek-flash-latest
- openrouter/~deepseek/deepseek-pro-latest
- openrouter/~deepseek/deepseek-v4-flash-latest
- openrouter/~moonshotai/kimi-latest
- openrouter/~z-ai/glm-flash-latest
- vercel/alibaba/qwen3.8-27b
- vercel/nvidia/nemotron-3.5-lightning
</details>

## Review notes

Regenerated by `make gen/aibridge-prices` from the live
[models.dev](https://models.dev) catalog. Both artifacts come from one
snapshot, so they ship together:

- `coderd/aibridge/prices/data/prices.json`
- `site/src/modules/aiModels/knownModels/knownModelsGenerated.json`

These are customer-visible cost numbers taken from upstream data, so
this PR is never merged automatically. The summary above lists what
moved; check the diff for exact figures before approving.

Opened automatically by the [aigateway-prices-refresh
workflow](https://github.com/coder/coder/actions/runs/43188102112).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-12 09:58:58 +00:00
cdrciandgithub-actions[bot] f820cba82a chore: refresh AI model price book (#31775)
## Price book changes

9 models added, 14 models removed, 40 models changed.

<details>
<summary>Added</summary>

- openrouter/inclusionai/ling-3.0-tiny
- openrouter/ricursiveai/ripple-65b-preview
- openrouter/stealth/crouton-alpha
- openrouter/tencent/hy4
- openrouter/z-ai/glm-5.3-flashx-legal
- vercel/inclusionai/ling-3.1-flash-1019
- vercel/meituan/longcat-2.5
- vercel/tencent/hy4
- vercel/zai/glm-5.3-flashx-legal
</details>

<details>
<summary>Removed</summary>

- openrouter/nousresearch/hermes-3-llama-3.1-405b
- openrouter/nousresearch/hermes-3-llama-3.1-70b
- openrouter/poolside/laguna-s-2.1
- openrouter/poolside/laguna-s-2.1:free
- openrouter/poolside/laguna-xs-2.1
- openrouter/poolside/laguna-xs-2.1:free
- openrouter/thinkingmachines/inkling-small:free
- openrouter/thinkingmachines/inkling:free
- openrouter/upstage/solar-pro-3
- vercel/arcee-ai/trinity-large-thinking
- vercel/meituan/longcat-2.5-preview
- vercel/poolside/laguna-s-2.1-free
- vercel/xiaomi/mimo-v2.5
- vercel/xiaomi/mimo-v2.5-pro
</details>

<details>
<summary>Changed</summary>

- openrouter/deepseek/deepseek-v3.2
- openrouter/deepseek/deepseek-v4-flash-0731
- openrouter/deepseek/deepseek-v4-pro
- openrouter/deepseek/deepseek-v4-pro-0813
- openrouter/deepseek/deepseek-v4.1-flash
- openrouter/google/gemma-4-26b-a4b-it
- openrouter/ibm-granite/granite-4.2-8b
- openrouter/meta-llama/llama-3.1-70b-instruct
- openrouter/meta-llama/llama-3.2-3b-instruct
- openrouter/meta-llama/llama-3.3-70b-instruct
- openrouter/meta-llama/llama-4-maverick
- openrouter/minimax/minimax-m2.5
- openrouter/mistralai/mistral-large-4-0
- openrouter/moonshotai/kimi-k2.7-code
- openrouter/moonshotai/kimi-k3
- openrouter/openai/gpt-oss-120b
- openrouter/openai/gpt-oss-20b
- openrouter/particle-ai/particle-1
- openrouter/qwen/qwen3-235b-a22b-2507
- openrouter/qwen/qwen3-coder-30b-a3b-instruct
- openrouter/qwen/qwen3-next-80b-a3b-instruct
- openrouter/qwen/qwen3.8-27b
- openrouter/z-ai/glm-4.6v
- openrouter/z-ai/glm-4.7
- openrouter/z-ai/glm-5.2
- openrouter/z-ai/glm-5.3-flash
- openrouter/z-ai/glm-5.3-flashx
- openrouter/~deepseek/deepseek-flash-latest
- openrouter/~deepseek/deepseek-pro-latest
- openrouter/~deepseek/deepseek-v4-flash-latest
- openrouter/~moonshotai/kimi-latest
- openrouter/~x-ai/grok-latest
- openrouter/~z-ai/glm-flash-latest
- vercel/deepseek/deepseek-v4-flash-0731
- vercel/deepseek/deepseek-v4-pro
- vercel/deepseek/deepseek-v4.1-flash
- vercel/deepseek/deepseek-v4.1-flash-1017
- vercel/mistral/mistral-large-4
- vercel/moonshotai/kimi-k3.1-pro
- vercel/zai/glm-5.2
</details>

## Review notes

Regenerated by `make gen/aibridge-prices` from the live
[models.dev](https://models.dev) catalog. Both artifacts come from one
snapshot, so they ship together:

- `coderd/aibridge/prices/data/prices.json`
- `site/src/modules/aiModels/knownModels/knownModelsGenerated.json`

These are customer-visible cost numbers taken from upstream data, so
this PR is never merged automatically. The summary above lists what
moved; check the diff for exact figures before approving.

Opened automatically by the [aigateway-prices-refresh
workflow](https://github.com/coder/coder/actions/runs/41999352102).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-11-05 09:48:48 +00:00
Susana Ferreira 8d5026c57a feat(coderd): send the chat organization in Coder Agents AI Gateway requests (#31583)
## Description

Every Coder Agents chat belongs to an organization, but its AI Gateway
requests don't carry it. AI Gateway instead uses the organization of the
user's cost control effective group, which can be a different one. So a
chat in org A can have its budget and cost attributed to org B. This PR
makes Coder Agents send the chat's organization with its delegated
attribution, so AI Gateway can use the chat's organization for the whole
request. AI Gateway starts using it in the next PR in this stack, so
behaviour doesn't change here.

## Changes

- Add `DelegatedOrganizationID` to `aibridge.Attribution`, and fix the
`WorkspaceID` comment, which applies to workspace session tokens too.
- Set it from the chat in `newModel` when routing Coder Agents requests
through AI Gateway.
- Extend `TestNewModelAttributionImmutablePerRequest` to check the
organization.

Related to AIGOV-713

> [!NOTE]
> Generated by Coder Agents on behalf of @ssncferreira.
2026-11-03 16:39:42 +00:00
Sas Swart 15365c69cf feat: use the resolved organization for AI Gateway budgets and cost (1/2) (#31120)
`IsAuthorized` resolves the workspace organization, but uses it only to
reject requests; nothing downstream reads it. The budget check and cost
each resolve the group site-wide, so a user working in an org B
workspace can be billed in org A, and no interception records its
organization.

Resolve the request organization once, in `IsAuthorized`. A workspace
session token resolves to the workspace's organization (source
`workspace`). Any other request, including chatd requests until
AIGOV-713, resolves to the organization of the user's site-wide
effective group (source `effective_group`). Return the source in
`IsAuthorizedResponse`.

Have aibridged pass the organization to `IsBudgetExceeded`, which
resolves the budget inside it, and stamp the organization and source on
`RecordInterception`. Resolve cost's effective group inside the
organization stored on the interception. When there is no organization,
behave site-wide as before.

Move `resolveOrganization` and the workspace checks into
`orgresolver.go`, and leave a slot for the chat organization
(AIGOV-713). Bump the aibridged API to v1.6, adding
`IsAuthorizedResponse.organization_source` and
`IsBudgetExceededRequest.organization_id`.

aibridged checks only the shape of the organization (both fields or
neither, and a valid non-nil UUID), not the source value. That lets a
newer coderd add a source without breaking older gateways.

Behaviour changes to review:

- Spend follows the workspace's organization. A user whose budgets are
all in org A has no limit in an org B workspace if B has none.
- A database error while resolving the organization now returns 403 from
`IsAuthorized`, instead of 500 from `IsBudgetExceeded`.
- Requests without a workspace make up to three extra budget queries in
`IsAuthorized`.
- The user spend status endpoint (`GET /api/v2/users/{user}/ai/spend`)
stays site-wide, so it can disagree with where a request was charged.

The org-aware price lookup follows in #31121.

Part of AIGOV-716. Stacked on #31119.

---

*This PR was generated by Coder Agents on behalf of @SasSwart.*
2026-10-30 13:35:23 +02:00
cdrciandgithub-actions[bot] 5c691c82c9 chore: refresh AI model price book (#31474)
## Price book changes

19 models added, 27 models removed, 37 models changed.

<details>
<summary>Added</summary>

- azure/gpt-6.1-terra
- bedrock/au.anthropic.claude-sonnet-5-5
- bedrock/global.openai.gpt-6.1-terra
- bedrock/openai.gpt-6.1-terra
- bedrock/us.openai.gpt-6.1-terra
- copilot/gpt-6.1-terra
- openai/gpt-6.1-terra
- openrouter/liquid/lfm-2.5-2.6b
- openrouter/minimax/minimax-m3.1-flash
- openrouter/moonshotai/kimi-k3.1-pro
- openrouter/openai/gpt-6.1-terra
- openrouter/openai/gpt-6.1-terra-pro
- openrouter/particle-ai/particle-1
- openrouter/prism-ml/ternary-bonsai-2-9b
- vercel/moonshotai/kimi-k3.1-pro
- vercel/moonshotai/kimi-k3.1-pro-highspeed
- vercel/openai/gpt-6.1-terra
- vercel/openai/gpt-6.1-terra-fast
- vercel/particle/particle-1
</details>

<details>
<summary>Removed</summary>

- azure/claude-opus-4-1
- azure/deepseek-r1
- copilot/mai-code-1-flash-picker
- google/gemini-3-pro-image-preview
- google/gemini-3.1-flash-image-preview
- openrouter/arcee-ai/trinity-large-thinking
- openrouter/ibm-granite/granite-4.0-h-micro
- openrouter/minimax/minimax-m3.1-flash:free
- openrouter/nvidia/nemotron-3-super-120b-a12b:free
- openrouter/openai/gpt-3.5-turbo
- openrouter/openai/gpt-3.5-turbo-instruct
- openrouter/openai/gpt-4-turbo
- openrouter/openai/gpt-5.2-chat
- openrouter/openai/o1
- openrouter/openai/o1-pro
- openrouter/openai/o3-mini
- openrouter/openai/o3-mini-high
- openrouter/openai/o4-mini
- openrouter/openai/o4-mini-high
- openrouter/qwen/qwen3-next-80b-a3b-thinking
- vercel/openai/gpt-3.5-turbo
- vercel/openai/gpt-4-turbo
- vercel/openai/gpt-4.1-nano-fast
- vercel/openai/gpt-image-1
- vercel/openai/o4-mini-fast
- vercel/spacexai/grok-4.1-fast-non-reasoning
- vercel/spacexai/grok-4.1-fast-reasoning
</details>

<details>
<summary>Changed</summary>

- openrouter/deepseek/deepseek-v4-flash-0731
- openrouter/deepseek/deepseek-v4.1-flash
- openrouter/google/gemini-3.8-flash
- openrouter/google/gemma-3-4b-it
- openrouter/ibm-granite/granite-4.2-8b
- openrouter/meta-llama/llama-3.2-3b-instruct
- openrouter/minimax/minimax-m2.5
- openrouter/mistralai/mistral-small-3.2-24b-instruct
- openrouter/moonshotai/kimi-k2.7-code
- openrouter/moonshotai/kimi-k3
- openrouter/nousresearch/hermes-4-405b
- openrouter/nvidia/nemotron-3-nano-30b-a3b
- openrouter/openai/gpt-4.1-nano
- openrouter/qwen/qwen3-30b-a3b-instruct-2507
- openrouter/qwen/qwen3.5-122b-a10b
- openrouter/qwen/qwen3.5-27b
- openrouter/qwen/qwen3.5-9b
- openrouter/qwen/qwen3.6-27b
- openrouter/qwen/qwen3.6-35b-a3b
- openrouter/qwen/qwen3.8-27b
- openrouter/reflection/beam-1.0-501b-a23b
- openrouter/xiaomi/mimo-v2.5
- openrouter/xiaomi/mimo-v2.5-pro
- openrouter/z-ai/glm-4.6
- openrouter/z-ai/glm-4.6v
- openrouter/z-ai/glm-5.2
- openrouter/z-ai/glm-5.3
- openrouter/z-ai/glm-5.3-flash
- openrouter/~deepseek/deepseek-flash-latest
- openrouter/~deepseek/deepseek-pro-latest
- openrouter/~moonshotai/kimi-latest
- openrouter/~openai/gpt-terra-latest
- openrouter/~z-ai/glm-flash-latest
- openrouter/~z-ai/glm-latest
- vercel/amazon/nova-2-lite
- vercel/minimax/minimax-m3.1-flash
- vercel/openai/gpt-4.1-nano
</details>

## Review notes

Regenerated by `make gen/aibridge-prices` from the live
[models.dev](https://models.dev) catalog. Both artifacts come from one
snapshot, so they ship together:

- `coderd/aibridge/prices/data/prices.json`
- `site/src/modules/aiModels/knownModels/knownModelsGenerated.json`

These are customer-visible cost numbers taken from upstream data, so
this PR is never merged automatically. The summary above lists what
moved; check the diff for exact figures before approving.

Opened automatically by the [aigateway-prices-refresh
workflow](https://github.com/coder/coder/actions/runs/40846801723).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-10-29 15:39:30 +00:00
Sas Swart eb38759fda feat: limit effective group resolution to an organization (#31119)
AI budget resolution searches all of a user's groups across every
organization. Whichever group wins determines the organization. #31120
needs to resolve inside a known organization, and it needs to know which
organization site-wide resolution picked.

Add an `organizationID uuid.NullUUID` argument to
`budget.ResolveUserAIBudget` and `budget.ResolveUserEffectiveGroup`.
When it is set, count only that organization's override, group budgets
and Everyone group. An organization that is unknown, deleted or that the
user is not a member of resolves to nothing. When it is null, resolve
exactly as before. Return the winning group's organization in
`budget.EffectiveGroup.OrganizationID`.

Read the override through a new resolution-only query,
`GetUserAIBudgetOverrideWithOrganization`, so that the CRUD query
`GetUserAIBudgetOverride` and the admin endpoints stay untouched. Add a
nullable `organization_id` filter to `GetHighestGroupAIBudgetByUser` and
`GetUserEveryoneFallbackGroup`.

Every caller passes null, so behaviour is unchanged. There is no
migration and no proto change.

Scoping to an organization can lift a limit: a user capped in org B has
no limit in org A if A has no budgets. AIGOV-711 intends this, and it
takes effect in #31120.

Part of AIGOV-715.

---

*This PR was generated by Coder Agents on behalf of @SasSwart.*
2026-10-29 12:14:34 +02:00
Sas Swart 837c2e1af1 feat(coderd): price token usage with organization prices (#30719)
Prices token usage by the most specific match: the organization's price
for the configured provider, then a site-wide custom price, then the
price book. The requested model is still preferred over the model the
provider reports.

- `GetAIModelPriceForProvider` replaces
`GetAIModelPriceByProviderModel`, which is removed. It is one `UNION
ALL` of primary-key lookups, ordered by requested model first, then by
specificity. dbauthz checks `ResourceAiModelPrice`, scoped to the org
when one is given.
- `coderd/aibridge/prices` tests read seeded prices through
`GetAIModelPrices`.

Interceptions don't carry an organization yet, so
`resolveTokenUsageCost` passes none and only site-wide prices apply at
runtime for now (AIGOV-716). Org matching is covered by database tests
with explicit org IDs. For the same reason, the unpriced-models report
still counts only site-wide prices.

**Used later:** prices set through the API in #30720 take effect here
once interceptions carry an organization.

---

*This PR was generated by Coder Agents on behalf of @SasSwart.*
2026-10-22 15:13:24 +00:00
cdrciandgithub-actions[bot] 04d7d4da9c chore: refresh AI model price book (#31162)
## Price book changes

26 models added, 8 models removed, 56 models changed.

<details>
<summary>Added</summary>

- azure/deepseek-v4.1-flash
- google/gemini-pro-latest
- openrouter/deepseek/deepseek-v4.1-flash-1017
- openrouter/elorian/glimpse
- openrouter/inception/mercury-3
- openrouter/meta/muse-spark-open
- openrouter/minimax/minimax-m3.1-flash:free
- openrouter/moondream/moondream3-preview
- openrouter/moondream/moondream3.1-9b-a2b
- openrouter/nvidia/nemotron-3.5-super-vl
- openrouter/nvidia/nemotron-3.5-super-vl:free
- openrouter/recursive/flint-v1.0:free
- openrouter/reflection/beam-1.0-501b-a23b
- openrouter/unbiased/pareto-26.10
- openrouter/xingchen-agi/xing4.0-29b-a4b:free
- vercel/deepseek/deepseek-v4.1-flash-1017
- vercel/deepseek/deepseek-v4.1-flash-1017-fast
- vercel/elorian/glimpse
- vercel/inception/mercury-3
- vercel/meta/muse-spark-open
- vercel/minimax/minimax-m3.1-flash
- vercel/nvidia/nemotron-3.5-super-vl
- vercel/reflection/beam
- vercel/reflection/beam-free
- vercel/scaledown/scaledown-extract-1
- vercel/scaledown/scaledown-summarize-1
</details>

<details>
<summary>Removed</summary>

- openai/gpt-5.2-chat-latest
- openai/gpt-5.3-chat-latest
- openrouter/anthropic/claude-sonnet-4
- openrouter/deepseek/deepseek-r1
- openrouter/microsoft/wizardlm-2-8x22b
- openrouter/sao10k/l3.3-euryale-70b
- openrouter/unbiased/pareto-26.10-preview
- vercel/anthropic/claude-sonnet-4
</details>

<details>
<summary>Changed</summary>

- azure/gpt-5
- azure/gpt-5-codex
- azure/gpt-5-mini
- azure/gpt-5-nano
- azure/gpt-5.2
- azure/gpt-5.6-sol
- openrouter/deepseek/deepseek-chat
- openrouter/deepseek/deepseek-v3.2
- openrouter/deepseek/deepseek-v4-flash-0731
- openrouter/deepseek/deepseek-v4.1-flash
- openrouter/google/gemini-3.8-flash
- openrouter/google/gemma-3-27b-it
- openrouter/google/gemma-3-4b-it
- openrouter/meta-llama/llama-3.2-3b-instruct
- openrouter/meta-llama/llama-3.3-70b-instruct
- openrouter/meta-llama/llama-4-scout
- openrouter/mistralai/mistral-large-4-0
- openrouter/mistralai/mistral-small-3.2-24b-instruct
- openrouter/moonshotai/kimi-k3
- openrouter/nvidia/nemotron-3-super-120b-a12b
- openrouter/qwen/qwen3-30b-a3b-instruct-2507
- openrouter/qwen/qwen3-next-80b-a3b-instruct
- openrouter/qwen/qwen3.5-122b-a10b
- openrouter/qwen/qwen3.5-27b
- openrouter/qwen/qwen3.5-35b-a3b
- openrouter/qwen/qwen3.5-9b
- openrouter/qwen/qwen3.6-27b
- openrouter/qwen/qwen3.6-35b-a3b
- openrouter/qwen/qwen3.8-27b
- openrouter/stepfun/step-5-preview
- openrouter/upstage/solar-pro4
- openrouter/xiaomi/mimo-v2.5
- openrouter/xiaomi/mimo-v2.5-pro
- openrouter/z-ai/glm-4.6
- openrouter/z-ai/glm-4.7
- openrouter/z-ai/glm-5.1
- openrouter/z-ai/glm-5.2
- openrouter/z-ai/glm-5.3
- openrouter/z-ai/glm-5.3-flash
- openrouter/~deepseek/deepseek-flash-latest
- openrouter/~deepseek/deepseek-pro-latest
- openrouter/~deepseek/deepseek-v4-flash-latest
- openrouter/~moonshotai/kimi-latest
- openrouter/~unbiased/pareto-latest
- openrouter/~z-ai/glm-flash-latest
- openrouter/~z-ai/glm-latest
- vercel/arcee-ai/trinity-large-thinking
- vercel/deepseek/deepseek-v4.1-flash
- vercel/meta/llama-3.3-70b
- vercel/meta/llama-4-maverick
- vercel/meta/llama-4-scout
- vercel/mistral/ministral-3b
- vercel/mistral/ministral-8b
- vercel/mistral/mistral-large-4
- vercel/stepfun/step-5-preview
- vercel/xiaomi/mimo-v2.5
</details>

## Review notes

Regenerated by `make gen/aibridge-prices` from the live
[models.dev](https://models.dev) catalog. Both artifacts come from one
snapshot, so they ship together:

- `coderd/aibridge/prices/data/prices.json`
- `site/src/modules/aiModels/knownModels/knownModelsGenerated.json`

These are customer-visible cost numbers taken from upstream data, so
this PR is never merged automatically. The summary above lists what
moved; check the diff for exact figures before approving.

Opened automatically by the [aigateway-prices-refresh
workflow](https://github.com/coder/coder/actions/runs/39752842140).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-10-22 10:57:06 +01:00
cdrciandgithub-actions[bot] 7e69cd0af7 chore: refresh AI model price book (#30828)
## Price book changes

0 models added, 0 models removed, 24 models changed.

<details>
<summary>Changed</summary>

- openrouter/deepseek/deepseek-v4-pro
- openrouter/deepseek/deepseek-v4-pro-0813
- openrouter/deepseek/deepseek-v4.1-flash
- openrouter/google/gemma-4-31b-it
- openrouter/minimax/minimax-m2.5
- openrouter/mistralai/mistral-small-3.2-24b-instruct
- openrouter/moonshotai/kimi-k3
- openrouter/openai/gpt-5.6-sol
- openrouter/openai/gpt-5.6-sol-pro
- openrouter/openai/gpt-oss-120b
- openrouter/qwen/qwen3.6-35b-a3b
- openrouter/qwen/qwen3.8-27b
- openrouter/tencent/hy3
- openrouter/tencent/hy4-preview
- openrouter/z-ai/glm-5
- openrouter/z-ai/glm-5.1
- openrouter/z-ai/glm-5.2
- openrouter/z-ai/glm-5.3
- openrouter/~deepseek/deepseek-flash-latest
- openrouter/~deepseek/deepseek-pro-latest
- openrouter/~google/gemini-pro-latest
- openrouter/~moonshotai/kimi-latest
- openrouter/~z-ai/glm-flash-latest
- openrouter/~z-ai/glm-latest
</details>

## Review notes

Regenerated by `make gen/aibridge-prices` from the live
[models.dev](https://models.dev) catalog. Both artifacts come from one
snapshot, so they ship together:

- `coderd/aibridge/prices/data/prices.json`
- `site/src/modules/aiModels/knownModels/knownModelsGenerated.json`

These are customer-visible cost numbers taken from upstream data, so
this PR is never merged automatically. The summary above lists what
moved; check the diff for exact figures before approving.

Opened automatically by the [aigateway-prices-refresh
workflow](https://github.com/coder/coder/actions/runs/38710433812).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-10-15 12:01:26 +01:00
Michael Suchacz e7c2fd5d2e feat: add Gemini 4 Argon to Agents and AI Gateway (#30780)
Add Gemini 4 Argon to the Agents known models catalog, so it appears as
a suggestion when an admin adds a chat model, and regenerate the AI
Gateway price book from models.dev.

| Provider | Model ID | Placed before |
|---|---|---|
| google | `gemini-4-argon` | `gemini-3.1-pro-preview` |
| openrouter, vercel | `google/gemini-4-argon` |
`google/gemini-3.8-flash` |

**Pricing.** The price book carries Google's launch rates on google,
openrouter, vercel, and copilot: $2 per 1M input tokens, $10 per 1M
output tokens, and $0.10 per 1M cached input tokens. Google doubles them
on 2026-12-01 ($4, $20, $0.20); the weekly refresh picks that up once
models.dev changes. The google entry keeps models.dev's 32,768 max
output tokens, the cap Google enforces on non-streaming
`generateContent` calls (larger values return HTTP 400 there).

**Thinking levels.** `googleSupportedThinkingLevels` did not recognize
the `argon` name token and failed closed, so chatd sent Argon no
`thinking_level` and no `include_thoughts`: the native Google path
dropped the reasoning effort, and neither path showed thought summaries.
Argon accepts LOW, MEDIUM, and HIGH like Gemini 3.1 Pro and rejects
MINIMAL, so the map now treats it like the Pro family.

**Upstream drift.** `prices.json` covers every model of its 8 providers,
so the regeneration also brings the changes since the last weekly
refresh, all on OpenRouter and Vercel: 14 other new entries, 26 entries
models.dev delisted, and 51 price changes. The catalog picks up the same
changes for 8 curated OpenRouter entries (DeepSeek, Kimi, Qwen, and
GLM).

## Testing

- Live requests to `gemini-4-argon` through the AI Gateway's Google
provider (Google's OpenAI-compatible endpoint): `reasoning_effort` and
`thinking_level` values `low`, `medium`, and `high` return 200 and
`minimal` returns 400; `include_thoughts` returns thought text in
streaming and non-streaming responses.
- Red-green: removing the `argon` token fails
`TestGoogleSupportedThinkingLevels/gemini-4-argon` (expected LOW,
MEDIUM, HIGH; got nil).
- Regenerating from the saved models.dev snapshot reproduces both
generated files byte for byte.
- `go test ./scripts/aibridgepricesgen/... ./coderd/aibridge/prices/...
./coderd/x/chatd/chatprovider/...` and `pnpm exec vitest run
--project=unit src/modules/aiModels/` pass. The pre-commit hook passed;
local pre-push checks were skipped, so CI is the first full run.

## Review record

- Frontend review: the only `site/` change is the generated
`knownModelsGenerated.json`, so the FE1 to FE10 checklist does not
apply; no hand-written frontend code changed.

> Xum opened this PR on behalf of @ibetitsmike.
2026-10-14 22:39:00 +02:00
Michael Suchacz 7517301ffa chore: add golangci new-code quality gates (#30622)
Stack context: second layer of the Go lint gate stack, built on the
exclusion fix below.

Why: adds commented-out code detection and a `log/slog` ban to the main
config, plus a new-code-only pass requiring reasons on lint
suppressions, flagging ignored errors (including `_, _ = w.Write(...)`),
and banning `time.Sleep` in tests. Fixing the hits surfaced a real bug:
GitLab warnings went to the wrong logger. The new-code pass resolves
symlinked checkout paths so it does not silently report nothing.

Validation: both configs report 0 issues; each seeded violation is
caught; `make pre-commit` passed.

> Xum acted for Mike to open this PR.
2026-10-13 07:57:56 +00:00
cdrciandgithub-actions[bot] 315789c6bf chore: refresh AI model price book (#30498)
## Price book changes

27 models added, 8 models removed, 46 models changed.

<details>
<summary>Added</summary>

- anthropic/claude-haiku-5-5
- azure/claude-haiku-5-5
- azure/grok-4.6
- bedrock/anthropic.claude-haiku-5-5
- bedrock/au.anthropic.claude-haiku-5-5
- bedrock/eu.anthropic.claude-haiku-5-5
- bedrock/eu.anthropic.claude-sonnet-5-5
- bedrock/global.anthropic.claude-haiku-5-5
- bedrock/global.zai.glm-5.3
- bedrock/in.anthropic.claude-haiku-4-5-20251001-v1:0
- bedrock/in.anthropic.claude-opus-5
- bedrock/in.anthropic.claude-sonnet-5
- bedrock/jp.anthropic.claude-haiku-5-5
- bedrock/us.anthropic.claude-haiku-5-5
- bedrock/us.anthropic.claude-sonnet-5-5
- bedrock/us.zai.glm-5.3
- copilot/claude-haiku-5.5
- openrouter/anthropic/claude-haiku-5.5
- openrouter/apodex/apodex-1.1-mini:free
- openrouter/google/gemini-nano-banana-2.1
- openrouter/inclusionai/ling-3.1-flash
- openrouter/mistralai/mistral-large-4-0
- openrouter/unbiased/pareto-26.10-preview
- vercel/anthropic/claude-haiku-5.5
- vercel/google/gemini-nano-banana-2.1
- vercel/mistral/mistral-large-4
- vercel/stealth/glyph-cluster
</details>

<details>
<summary>Removed</summary>

- openrouter/kwaipilot/kat-coder-pro-v2.5
- openrouter/qwen/qwen3.8-27b:free
- openrouter/stealth/space-bunny-alpha
- vercel/deepseek/deepseek-v3.1-terminus
- vercel/inclusionai/ling-3.0-flash-sante-free
- vercel/liquid/d1
- vercel/moonshotai/kimi-k2-thinking
- vercel/stepfun/step-3.5-flash
</details>

<details>
<summary>Changed</summary>

- anthropic/claude-sonnet-5-5
- bedrock/anthropic.claude-sonnet-5-5
- bedrock/global.anthropic.claude-sonnet-5-5
- copilot/claude-sonnet-5.5
- openrouter/anthropic/claude-sonnet-5.5
- openrouter/deepseek/deepseek-v3.1-terminus
- openrouter/deepseek/deepseek-v3.2
- openrouter/deepseek/deepseek-v4-flash
- openrouter/deepseek/deepseek-v4-flash-0731
- openrouter/deepseek/deepseek-v4-pro
- openrouter/deepseek/deepseek-v4.1-flash
- openrouter/inclusionai/ling-3.0-flash-fin
- openrouter/meta-llama/llama-4-maverick
- openrouter/meta/muse-glimmer-30b
- openrouter/moonshotai/kimi-k2.6
- openrouter/moonshotai/kimi-k3
- openrouter/nvidia/nemotron-3-nano-30b-a3b
- openrouter/nvidia/nemotron-3-super-120b-a12b
- openrouter/nvidia/nemotron-3-ultra-550b-a55b
- openrouter/nvidia/nemotron-3.5-lightning
- openrouter/openai/gpt-5.6-sol-pro
- openrouter/qwen/qwen3-235b-a22b-2507
- openrouter/qwen/qwen3-next-80b-a3b-instruct
- openrouter/qwen/qwen3.5-27b
- openrouter/qwen/qwen3.5-35b-a3b
- openrouter/qwen/qwen3.5-397b-a17b
- openrouter/qwen/qwen3.6-27b
- openrouter/qwen/qwen3.8-27b
- openrouter/z-ai/glm-5.1
- openrouter/z-ai/glm-5.2
- openrouter/z-ai/glm-5.3
- openrouter/~anthropic/claude-haiku-latest
- openrouter/~anthropic/claude-sonnet-latest
- openrouter/~deepseek/deepseek-flash-latest
- openrouter/~deepseek/deepseek-pro-latest
- openrouter/~deepseek/deepseek-v4-flash-latest
- openrouter/~moonshotai/kimi-latest
- openrouter/~z-ai/glm-flash-latest
- openrouter/~z-ai/glm-latest
- vercel/anthropic/claude-sonnet-5.5
- vercel/arcee-ai/trinity-large-thinking
- vercel/google/gemini-3.8-flash-lite-tts
- vercel/google/gemini-3.8-flash-tts
- vercel/inclusionai/ling-3.0-flash-sante
- vercel/poolside/laguna-s-2.1
- vercel/xiaomi/mimo-v2.6-flash
</details>

## Review notes

Regenerated by `make gen/aibridge-prices` from the live
[models.dev](https://models.dev) catalog. Both artifacts come from one
snapshot, so they ship together:

- `coderd/aibridge/prices/data/prices.json`
- `site/src/modules/aiModels/knownModels/knownModelsGenerated.json`

These are customer-visible cost numbers taken from upstream data, so
this PR is never merged automatically. The summary above lists what
moved; check the diff for exact figures before approving.

Opened automatically by the [aigateway-prices-refresh
workflow](https://github.com/coder/coder/actions/runs/37754651010).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-10-08 15:20:44 +01:00
cdrciandgithub-actions[bot] b530f0154d chore: refresh AI model price book (#30233)
## Price book changes

3 models added, 1 model removed, 23 models changed.

<details>
<summary>Added</summary>

- bedrock/global.openai.gpt-6.1-sol
- bedrock/openai.gpt-6.1-sol
- bedrock/us.openai.gpt-6.1-sol
</details>

<details>
<summary>Removed</summary>

- vercel/stealth/pixel-canary
</details>

<details>
<summary>Changed</summary>

- openrouter/deepseek/deepseek-v4-flash
- openrouter/deepseek/deepseek-v4-flash-0731
- openrouter/deepseek/deepseek-v4-pro
- openrouter/deepseek/deepseek-v4-pro-0813
- openrouter/deepseek/deepseek-v4.1-flash
- openrouter/google/gemma-4-26b-a4b-it
- openrouter/meta/muse-glimmer-30b
- openrouter/minimax/minimax-m1
- openrouter/moonshotai/kimi-k2-thinking
- openrouter/moonshotai/kimi-k2.6
- openrouter/moonshotai/kimi-k2.7-code
- openrouter/moonshotai/kimi-k3
- openrouter/nvidia/nemotron-3.5-lightning
- openrouter/qwen/qwen3.8-27b
- openrouter/tencent/hy3
- openrouter/z-ai/glm-5.2
- openrouter/z-ai/glm-5.3
- openrouter/~deepseek/deepseek-flash-latest
- openrouter/~deepseek/deepseek-pro-latest
- openrouter/~deepseek/deepseek-v4-flash-latest
- openrouter/~moonshotai/kimi-latest
- openrouter/~z-ai/glm-latest
- vercel/liquid/d1
</details>

## Review notes

Regenerated by `make gen/aibridge-prices` from the live
[models.dev](https://models.dev) catalog. Both artifacts come from one
snapshot, so they ship together:

- `coderd/aibridge/prices/data/prices.json`
- `site/src/modules/aiModels/knownModels/knownModelsGenerated.json`

These are customer-visible cost numbers taken from upstream data, so
this PR is never merged automatically. The summary above lists what
moved; check the diff for exact figures before approving.

Opened automatically by the [aigateway-prices-refresh
workflow](https://github.com/coder/coder/actions/runs/36847028712).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-10-01 11:20:33 +01:00
Michael Suchacz 1e9dd0abbc feat: add Claude Sonnet 5.5 and GPT-6.1 Sol to Agents and AI Gateway (#30159)
Add Claude Sonnet 5.5 and GPT-6.1 Sol to the Agents known models
catalog, so they appear as suggestions when an admin adds a chat model,
and regenerate the AI Gateway price book from models.dev.

| Model | Added to |
|---|---|
| Claude Sonnet 5.5 | anthropic (`reasoningEffort: high`), azure,
bedrock (`global.anthropic.claude-sonnet-5-5`), openrouter, vercel |
| GPT-6.1 Sol | openai (`reasoningEffort: medium`), azure, openrouter,
vercel |

**Bedrock.** bedrock-runtime serves Sonnet 5.5 only through its global
inference profile, so the catalog curates the `global.` ID without a
bare alias: fantasy's Bedrock client prefixes a bare `anthropic.*` ID
with a regional profile (`us.`, `eu.`, `apac.`) that this model lacks.
bedrock-mantle takes the bare ID and the gateway looks prices up by
exact provider and model, so `overrides.jq` injects the bare ID as a
copy of the global price entry. The two GPT Daybreak alias injections
are gone: models.dev now lists both aliases, and their guards error out
once it does.

**Reasoning effort.** Sonnet 5.5 rejects the `thinking: {"type":
"disabled"}` that fantasy sends for effort `none`, and GPT-6.1 Sol
rejects `none` outright, both with HTTP 400. `applyReasoningEffort` now
maps `none` to `low` for Sonnet 5.5 on the Anthropic and Bedrock
providers, next to the Opus 5.5 clamp, and maps `none` and `minimal` to
`low` for GPT-6.1 Sol on OpenAI and Azure through a new
`chatopenai.IsGPT61Sol`, next to the GPT-6 Astra clamp. GPT-6 Sol
accepts `none` and stays unclamped; the test pins that. AI Gateway's
Bedrock adaptive-thinking allowlist already matched Sonnet 5.5 through
its `anthropic.claude-sonnet-5` substring; a table case now covers it.

**Price book drift.** `prices.json` includes every model of its 8
providers, so the regeneration also brings in upstream changes since the
last refresh: 28 new entries (such as Grok 4.7 on Bedrock and Mistral
Large 2512 on OpenRouter), 7 entries models.dev delisted (mostly free
variants on OpenRouter and Vercel), and 49 price changes (39 OpenRouter,
10 Vercel). Other uncurated upstream models, such as `-pro` and `-fast`
variants and `openai.*` on Bedrock, stay out of the catalog, matching
how earlier releases were curated.

The Reasoning effort section of `coderd/x/chatd/ARCHITECTURE.md`
documents only the GPT-6 Astra clamp and should gain Sonnet 5.5 and
GPT-6.1 Sol. That doc edit is left to a human author.

Validation: regenerating from a fresh models.dev fetch reproduces both
generated files byte for byte. Go tests pass for
`scripts/aibridgepricesgen`, `coderd/aibridge/prices`,
`coderd/x/chatd/chatprovider`, `coderd/x/chatd/chatopenai`, and
`aibridge/intercept/messages`. Removing either clamp with `go test
-overlay` fails the new cases on exactly the Sonnet 5.5 and GPT-6.1 Sol
inputs. Vitest passes for `src/modules/aiModels` (176 tests) and the
Models and Coder Agents settings pages (24 tests). The pre-commit hook
passed; local pre-push checks were skipped, so CI is the first full run.

Review record: no reviews yet. No remote UAT was run; the tested head is
`78abe17e69d`.

> Xum opened this PR on behalf of @ibetitsmike.
2026-09-29 18:46:41 -07:00
deafad29cc chore: refresh AI model price book (#29835)
## Price book changes

22 models added, 5 models removed, 21 models changed.

<details>
<summary>Added</summary>

- bedrock/global.moonshotai.kimi-k3
- bedrock/global.openai.gpt-6-luna
- bedrock/global.openai.gpt-6-sol
- bedrock/openai.gpt-6-luna
- bedrock/openai.gpt-6-sol
- bedrock/us.moonshotai.kimi-k3
- bedrock/us.openai.gpt-6-luna
- bedrock/us.openai.gpt-6-sol
- copilot/claude-opus-5.5
- copilot/gpt-6-luna
- copilot/gpt-6-sol
- openrouter/aion-labs/aion-3.5
- openrouter/aion-labs/aion-3.5-mini
- openrouter/cohere/command-a-plus
- openrouter/fireworks/ember-1
- openrouter/qwen/qwen3.8-max-prime
- openrouter/stealth/space-bunny-alpha
- openrouter/upstage/solar-mini4
- openrouter/z-ai/glm-5.3-prime
- vercel/alibaba/qwen3.8-max-prime
- vercel/google/gemini-3.8-flash-lite-tts
- vercel/google/gemini-3.8-flash-tts
</details>

<details>
<summary>Removed</summary>

- openrouter/inclusionai/ling-3.0-flash-vl:free
- openrouter/mistralai/devstral-2512
- openrouter/nex-agi/nex-n2.5-mini
- openrouter/nex-agi/nex-n2.5-pro
- vercel/inclusionai/ling-3.0-flash-vl-free
</details>

<details>
<summary>Changed</summary>

- openrouter/deepseek/deepseek-v4-flash
- openrouter/deepseek/deepseek-v4-flash-0731
- openrouter/deepseek/deepseek-v4-pro
- openrouter/deepseek/deepseek-v4-pro-0813
- openrouter/deepseek/deepseek-v4.1-flash
- openrouter/minimax/minimax-m2
- openrouter/moonshotai/kimi-k2.7-code
- openrouter/nvidia/nemotron-3.5-lightning
- openrouter/qwen/qwen3-30b-a3b-instruct-2507
- openrouter/qwen/qwen3-next-80b-a3b-instruct
- openrouter/tencent/hy3
- openrouter/z-ai/glm-5.3
- openrouter/z-ai/glm-5.3-flashx
- openrouter/~deepseek/deepseek-flash-latest
- openrouter/~deepseek/deepseek-pro-latest
- openrouter/~deepseek/deepseek-v4-flash-latest
- openrouter/~moonshotai/kimi-latest
- openrouter/~z-ai/glm-flash-latest
- openrouter/~z-ai/glm-latest
- vercel/inclusionai/ling-3.0-flash-vl
- vercel/openai/gpt-oss-120b
</details>

## Review notes

Regenerated by `make gen/aibridge-prices` from the live
[models.dev](https://models.dev) catalog. Both artifacts come from one
snapshot, so they ship together:

- `coderd/aibridge/prices/data/prices.json`
- `site/src/modules/aiModels/knownModels/knownModelsGenerated.json`

These are customer-visible cost numbers taken from upstream data, so
this PR is never merged automatically. The summary above lists what
moved; check the diff for exact figures before approving.

Opened automatically by the [aigateway-prices-refresh
workflow](https://github.com/coder/coder/actions/runs/35979133021).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Cian Johnston <cian@coder.com>
2026-09-24 10:48:28 +01:00
Michael Suchacz 5b5432ce73 feat: add GPT-6 Sol, GPT-6 Luna, and Claude Opus 5.5 to Agents and AI Gateway (#29762)
Add the models released on 2026-09-22 (GPT-6 Sol, GPT-6 Luna, and Claude
Opus 5.5) plus Grok 4.7 to the Agents known models catalog, so they
appear as suggestions when an admin adds a chat model in `/agents`
settings, and pick up their prices in the AI Gateway price book. chatd
and AI Gateway's Bedrock path also stop producing Opus 5.5 thinking
shapes it rejects.

| Model | Added to |
|---|---|
| GPT-6 Sol, GPT-6 Luna | openai, azure, openrouter, vercel |
| Claude Opus 5.5 | anthropic, azure, bedrock (plus `global.` alias),
openrouter, vercel |
| Grok 4.7 | openrouter (`x-ai/grok-4.7`), vercel (`spacexai/grok-4.7`)
|
| Qwen3.8 Max | vercel (`alibaba/qwen3.8-max-0902`; already curated on
openrouter) |

Every model is already on models.dev, so `overrides.jq` is unchanged.
Sol and Luna use `reasoningEffort: medium` like GPT-6 Astra and the
GPT-5.6 models. Opus 5.5 uses `high` like every other Opus, Fable, and
Mythos entry, and joins the Anthropic thinking-mode pin in
`knownModelsGenerated.test.ts`. Anthropic documents `medium` as the Opus
5.5 default, but the catalog value seeds both the default and the max
effort in the admin form (`applyKnownModelDefaults.ts`), so `medium`
would also stop users from picking `high`. Gateway entries follow the
existing convention of no reasoning default and upstream display names;
Qwen3.8 Max reuses its openrouter display name. New entries sort ahead
of the models they supersede.

**chatd.** Opus 5.5 always runs adaptive thinking and rejects `thinking:
{"type": "disabled"}` with HTTP 400. The pinned fantasy fork sends
exactly that for the `none` effort on Claude 5+ models (it exempts only
Mythos and Fable), and the effort picker offers `none` whenever a model
config sets a max effort. `applyReasoningEffort` now maps `none` to
`low` for Opus 5.5 on the Anthropic and Bedrock providers, next to the
existing GPT-6 Astra clamp. The new `ClampsNoneForClaudeOpus55` subtest
fails without the fix. The Reasoning effort section of
`coderd/x/chatd/ARCHITECTURE.md` documents the Astra clamp and should
gain a line for this one; that doc edit is left to a human author.

**AI Gateway on Bedrock.** Opus 5.5 also rejects `thinking: {"type":
"enabled", "budget_tokens": N}`. On the Bedrock InvokeModel path,
`augmentRequestForBedrockInvokeModel` in
`aibridge/intercept/messages/base.go` rewrote adaptive thinking into
that legacy shape for every model outside its adaptive-only allowlist.
`bedrockModelRequiresAdaptiveThinking` now includes Opus 5.5, so
adaptive requests pass through, legacy requests (Claude Code falls back
to them behind the gateway) convert to adaptive, and
`output_config.effort` is kept. `output_config.format` is still
stripped, as for the other adaptive-only models; before this change the
whole `output_config` was dropped. Two new
`TestAugmentRequestForBedrock_AdaptiveThinking` cases fail without the
fix.

Deliberately not added: the `-pro` (openrouter) and `-fast` (vercel)
variants, matching how Astra and the GPT-5.6 models are curated;
`openai.*` models on Bedrock; regional Bedrock profiles; `~` rolling
aliases; `copilot`; `azure/grok-4.6`, which models.dev lists without
pricing; vendors not curated on the gateways (Xiaomi MiMo V2.6, Nex
N2.5, and others); and variants of curated models (GLM 5.3 FlashX,
Qwen3.8 Omni Flash). All of these that have prices are still in the
price book.

Known gaps, unchanged by this PR:

- The price book stores one flat price per model, so the long-context
tier for Sol and Luna (above 272K input tokens) is not applied, as for
Astra.
- The Bedrock adaptive-only allowlist still lacks the already curated
Opus 5, Fable 5, and Fable 5.1, plus Mythos 5 and 5.1, which also reject
`budget_tokens`, so their adaptive requests still take the legacy
conversion. They predate this PR and need the same allowlist entry.
- AI Gateway forwards a client's explicit `thinking: {"type":
"disabled"}` unchanged on every path, so Opus 5.5 answers it with its
documented 400, as the direct API does.

`knownModelsGenerated.json` and
`coderd/aibridge/prices/data/prices.json` are regenerated with `make
gen/aibridge-prices` from one models.dev snapshot. Besides the rows
above, both carry the upstream drift the weekly scheduled refresh would
produce. The catalog has nine repriced gateway rows, including vercel
`openai/gpt-5.6-sol`, which moves from $2/$10 to $4/$20 per 1M
input/output tokens and now matches OpenAI's direct price. `prices.json`
gains 41 rows (26 for the models above across every listed provider, 15
for other new upstream models), drops 4 that upstream delisted, and
reprices 30.

Validation: `go test ./scripts/aibridgepricesgen/...
./coderd/aibridge/prices/... ./coderd/x/chatd/chatprovider/...
./aibridge/...`, `pnpm test src/modules/aiModels/` (176 tests),
`golangci-lint` on `chatprovider` and `aibridge/intercept/messages`, and
`biome check` on `knownModels/` pass.

Review log (4 completed review passes):

- Codex round 1 on `03decfde855`: two P1 findings. Bedrock adaptive
thinking for Opus 5.5 was confirmed by a failing test and fixed. The
request to add a TODO to `coderd/x/chatd/ARCHITECTURE.md` was declined;
the chatd paragraph above flags that section for a human.
- Codex round 2 on `0156b3e5997`: one P2 finding, that the chatd clamp
misses opaque Bedrock application inference profile ARNs and fantasy
then sends disabled thinking. Refuted: fantasy omits the thinking field
when it cannot parse a Claude version from the model ID, so Opus 5.5
keeps its default adaptive thinking.
- Codex round 3 on `0156b3e5997`: two P1 findings. The claim that
`minimal` reaches Opus 5.5 verbatim was refuted: fantasy normalizes it
to `low`. The request to rewrite a client's explicit `disabled` thinking
for Opus 5.5 on Bedrock was declined: the gateway forwards it unchanged
on every path, before and after this PR (see Known gaps).
- Codex round 4 on `0156b3e5997`: no findings ("Didn't find any major
issues").

> Xum opened this PR on behalf of @ibetitsmike.
2026-09-23 14:10:24 +02:00
Michael Suchacz ceed0df682 chore: add DeepSeek V4.1 Flash and other missed models to the known models catalog (#29585)
Add the models that landed on models.dev since the September 4 curation
pass (#28955), plus cross-provider gaps where a model was curated on one
provider but not on the others that serve it, so they appear as
suggestions when an admin adds a chat model in `/agents` settings.

| Model | Added to |
|---|---|
| GPT-6 Astra | azure, openrouter, vercel (already curated on openai) |
| Claude Mythos 5.1 | anthropic. Not on models.dev, so injected in
`overrides.jq` as a copy of `claude-fable-5-1`, mirroring the existing
`claude-mythos-5` injection. Anthropic's pricing page lists Mythos 5.1
at the same rates as Fable 5.1, including the reduced cache-read rate. |
| DeepSeek V4.1 Flash | openrouter, vercel |
| Gemini 3.8 / 3.7 / 3.6 Flash | openrouter, vercel (no Google models
were curated on either gateway) |
| Gemini 3.1 Pro Preview, Gemini Flash-Lite Latest, Gemini 3.5 Flash
Lite | google (the catalog had no Pro or Lite tier) |
| Claude Mythos 5 | azure (left pending in #28887) |
| Claude Opus 4.7 | azure, bedrock (plus `global.` alias), openrouter,
vercel |
| GPT-5.5, GPT-5.4 mini | openrouter, vercel |
| GPT-5.4, GPT-5.4 mini, GPT-5.3 Codex | azure |
| Grok 4.6, Qwen3.8 Flash, GLM 5.3 Flash, MiniMax M3, Kimi K2.7 Code |
openrouter, vercel |

Mythos 5.1 uses `reasoningEffort: high` like Fable 5.1 and is added to
the Anthropic thinking-mode pin in `knownModelsGenerated.test.ts`.
Gateway entries follow the existing convention: no reasoning default and
upstream display names. New entries sort ahead of the models they
supersede.

Deliberately not added: `openai.*` models on Bedrock (chatd's Bedrock
provider wraps the Anthropic client, so they cannot be used from Coder
Agents), models.dev's `~`-prefixed rolling aliases on OpenRouter, and
`copilot` (unsupported in chatd).

`knownModelsGenerated.json` and
`coderd/aibridge/prices/data/prices.json` are regenerated with `make
gen/aibridge-prices` from the same models.dev snapshot. Apart from the
`claude-mythos-5-1` row, the `prices.json` changes are upstream drift
since the last weekly refresh, the same content the scheduled refresh PR
would produce.

Validation: `go test ./scripts/aibridgepricesgen/...
./coderd/aibridge/prices/...` and `pnpm test src/modules/aiModels/` (174
tests) pass.

> Xum opened this PR on behalf of @ibetitsmike.
2026-09-18 21:04:59 +02:00
Cian Johnston 19076beb8d feat: attribute AI Gateway usage to workspaces (#29235)
- Adds nullable `workspace_id` to AI Gateway interceptions without a
foreign key or index.
- Derives direct attribution from strictly parsed server-minted workspace
session-token names, excluding user-created tokens and validating the
embedded owner.
- Derives delegated Coder Agents attribution from the persisted chat
workspace ID.
- Records `workspace_id` through the additive v1.3 gateway protocol and
structured interception logs.
- Exposes attribution in session details through
`interception_attributions`, including tool-less interceptions and null
values for unknown attribution.

Closes AIGOV-637

Generated by Coder Agents.
2026-09-18 15:22:02 +01:00
cdrciandgithub-actions[bot] b36311eae8 chore: refresh AI model price book (#29471)
## Price book changes

36 models added, 13 models removed, 96 models changed.

<details>
<summary>Added</summary>

- bedrock/apac.anthropic.claude-sonnet-4-20250514-v1:0
- bedrock/eu.anthropic.claude-sonnet-4-20250514-v1:0
- bedrock/global.anthropic.claude-sonnet-4-20250514-v1:0
- bedrock/google.gemma-4-26b-a4b
- bedrock/google.gemma-4-31b
- bedrock/google.gemma-4-e2b
- bedrock/in.openai.gpt-5.6-luna
- bedrock/in.openai.gpt-5.6-terra
- bedrock/us-gov.openai.gpt-oss-120b-1:0
- bedrock/us-gov.openai.gpt-oss-20b-1:0
- bedrock/us.amazon.nova-premier-v1:0
- bedrock/us.anthropic.claude-sonnet-4-20250514-v1:0
- openrouter/inclusionai/ling-3.0-flash-vl
- openrouter/inclusionai/ling-3.0-flash-vl:free
- openrouter/inference-net/schematron-v2-small
- openrouter/inference-net/schematron-v2-turbo
- openrouter/sakana/fugu-max
- openrouter/sakana/fugu-ultra-v2
- openrouter/stealth/union-alpha
- openrouter/z-ai/glm-5.2:free
- openrouter/~deepseek/deepseek-flash-latest
- openrouter/~deepseek/deepseek-pro-latest
- openrouter/~openai/gpt-astra-latest
- openrouter/~openai/gpt-luna-latest
- openrouter/~openai/gpt-sol-latest
- openrouter/~openai/gpt-terra-latest
- vercel/bytedance/seed-2.1-turbo
- vercel/deepseek/deepseek-v4.1-flash
- vercel/google/gemini-3.8-live
- vercel/google/gemini-3.8-live-extended-thinking
- vercel/inclusionai/ling-3.0-flash-vl
- vercel/inclusionai/ling-3.0-flash-vl-free
- vercel/inference-net/schematron-v2-small
- vercel/inference-net/schematron-v2-turbo
- vercel/sakana/fugu-max
- vercel/sakana/fugu-ultra-v2
</details>

<details>
<summary>Removed</summary>

- openrouter/google/gemini-2.5-pro-preview-05-06
- openrouter/openai/gpt-4-turbo-preview
- openrouter/~openai/gpt-latest
- vercel/alibaba/qwen3.8-flash-next
- vercel/deepseek/deepseek-v4.1-flash-beta
- vercel/kwaipilot/kat-coder-air-v2.5
- vercel/kwaipilot/kat-coder-pro-v1
- vercel/kwaipilot/kat-coder-pro-v2
- vercel/kwaipilot/kat-coder-pro-v2.5
- vercel/mistral/devstral-2
- vercel/mistral/devstral-small-2
- vercel/mistral/mistral-medium
- vercel/mistral/pixtral-12b
</details>

<details>
<summary>Changed</summary>

- bedrock/amazon.nova-2-lite-v1:0
- bedrock/amazon.nova-lite-v1:0
- bedrock/amazon.nova-micro-v1:0
- bedrock/amazon.nova-pro-v1:0
- bedrock/anthropic.claude-opus-4-6-v1
- bedrock/anthropic.claude-sonnet-4-6
- bedrock/apac.amazon.nova-lite-v1:0
- bedrock/apac.amazon.nova-micro-v1:0
- bedrock/apac.amazon.nova-pro-v1:0
- bedrock/au.anthropic.claude-haiku-4-5-20251001-v1:0
- bedrock/au.anthropic.claude-opus-4-6-v1
- bedrock/au.anthropic.claude-opus-4-8
- bedrock/au.anthropic.claude-opus-5
- bedrock/au.anthropic.claude-sonnet-4-5-20250929-v1:0
- bedrock/au.anthropic.claude-sonnet-5
- bedrock/ca.amazon.nova-lite-v1:0
- bedrock/eu.amazon.nova-2-lite-v1:0
- bedrock/eu.amazon.nova-lite-v1:0
- bedrock/eu.amazon.nova-micro-v1:0
- bedrock/eu.amazon.nova-pro-v1:0
- bedrock/global.amazon.nova-2-lite-v1:0
- bedrock/google.gemma-3-12b-it
- bedrock/google.gemma-3-27b-it
- bedrock/jp.amazon.nova-2-lite-v1:0
- bedrock/jp.anthropic.claude-haiku-4-5-20251001-v1:0
- bedrock/jp.anthropic.claude-opus-4-7
- bedrock/jp.anthropic.claude-opus-4-8
- bedrock/jp.anthropic.claude-opus-5
- bedrock/jp.anthropic.claude-sonnet-4-5-20250929-v1:0
- bedrock/jp.anthropic.claude-sonnet-4-6
- bedrock/jp.anthropic.claude-sonnet-5
- bedrock/mistral.voxtral-small-24b-2507
- bedrock/qwen.qwen3-coder-480b-a35b-v1:0
- bedrock/qwen.qwen3-coder-next
- bedrock/qwen.qwen3-next-80b-a3b
- bedrock/qwen.qwen3-vl-235b-a22b
- bedrock/us.amazon.nova-2-lite-v1:0
- bedrock/us.amazon.nova-lite-v1:0
- bedrock/us.amazon.nova-micro-v1:0
- bedrock/us.amazon.nova-pro-v1:0
- bedrock/us.anthropic.claude-fable-5
- bedrock/us.anthropic.claude-haiku-4-5-20251001-v1:0
- bedrock/us.anthropic.claude-opus-4-5-20251101-v1:0
- bedrock/us.anthropic.claude-opus-4-6-v1
- bedrock/us.anthropic.claude-opus-4-7
- bedrock/us.anthropic.claude-opus-4-8
- bedrock/us.anthropic.claude-opus-5
- bedrock/us.anthropic.claude-sonnet-4-5-20250929-v1:0
- bedrock/us.anthropic.claude-sonnet-4-6
- bedrock/us.anthropic.claude-sonnet-5
- openrouter/deepseek/deepseek-chat-v3-0324
- openrouter/deepseek/deepseek-v4-flash-0731
- openrouter/deepseek/deepseek-v4-pro
- openrouter/deepseek/deepseek-v4-pro-0813
- openrouter/google/gemma-4-26b-a4b-it
- openrouter/gryphe/mythomax-l2-13b
- openrouter/meta-llama/llama-4-maverick
- openrouter/meta/muse-glimmer-30b
- openrouter/minimax/minimax-m1
- openrouter/minimax/minimax-m2.5
- openrouter/mistralai/mistral-small-3.2-24b-instruct
- openrouter/moonshotai/kimi-k2.7-code
- openrouter/nvidia/nemotron-3-nano-30b-a3b
- openrouter/nvidia/nemotron-3-super-120b-a12b
- openrouter/qwen/qwen3-14b
- openrouter/qwen/qwen3-235b-a22b-2507
- openrouter/qwen/qwen3-30b-a3b-instruct-2507
- openrouter/qwen/qwen3-vl-30b-a3b-instruct
- openrouter/qwen/qwen3.5-35b-a3b
- openrouter/qwen/qwen3.8-27b
- openrouter/upstage/solar-pro4
- openrouter/z-ai/glm-4.6
- openrouter/z-ai/glm-5.2
- openrouter/z-ai/glm-5.3-flash
- openrouter/~deepseek/deepseek-v4-flash-latest
- openrouter/~moonshotai/kimi-latest
- openrouter/~z-ai/glm-latest
- vercel/alibaba/qwen-3.6-max-preview
- vercel/alibaba/qwen3.5-flash
- vercel/alibaba/qwen3.5-plus
- vercel/alibaba/qwen3.6-plus
- vercel/alibaba/qwen3.8-flash
- vercel/alibaba/qwen3.8-max
- vercel/amazon/nova-lite
- vercel/amazon/nova-micro
- vercel/amazon/nova-pro
- vercel/deepseek/deepseek-v3.2
- vercel/inclusionai/ling-3.0-flash
- vercel/mistral/ministral-14b
- vercel/mistral/mistral-large-3
- vercel/mistral/mistral-medium-3.5
- vercel/mistral/mistral-nemo
- vercel/mistral/mistral-small
- vercel/moonshotai/kimi-k2.5
- vercel/nvidia/nemotron-3-nano-30b-a3b
- vercel/openai/gpt-oss-20b
</details>

## Review notes

Regenerated by `make gen/aibridge-prices` from the live
[models.dev](https://models.dev) catalog. Both artifacts come from one
snapshot, so they ship together:

- `coderd/aibridge/prices/data/prices.json`
- `site/src/modules/aiModels/knownModels/knownModelsGenerated.json`

These are customer-visible cost numbers taken from upstream data, so
this PR is never merged automatically. The summary above lists what
moved; check the diff for exact figures before approving.

Opened automatically by the [aigateway-prices-refresh
workflow](https://github.com/coder/coder/actions/runs/35203280221).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-09-17 10:28:05 +01:00
Yevhenii Shcherbina b405d57638 feat: resolve bedrock inference profiles when a provider is written (#29112)
Follow-up to #28877, which resolved Bedrock application inference
profile (AIP) ARNs while constructing a provider in the gateway. Review
found two consequences of putting an AWS call on that path: a transient
failure dropped the provider from the reloaded snapshot until the next
provider change or restart, and the initial reload blocked `coder
server` startup for up to 30s per AIP-configured provider under an
uncancelable context.

Resolution now happens once, in coderd, when a provider is created or
updated. The result is stored with the provider and travels to the
gateway in the existing provider payload, so the gateway makes no
Bedrock control-plane call at startup, on reload, or on a request.

The resolved identifiers live in the provider's encrypted settings blob
as `resolved_model` and `resolved_small_fast_model`. A table keyed by
ARN was tried and dropped: the server always writes the resolution as
part of the same provider write, so it needs no separate lifecycle,
migration, or clearing rules.

Resolution runs before the write, so a failed lookup rejects the save
and stores nothing. Create resolves its own request, which carries the
complete configuration. Update cannot: a `PATCH` supplies the model
identifiers but inherits credentials from the stored row, so stored +
patch is merged before the transaction to resolve against, then merged
again inside it against the row being written. Both merges take the
model identifiers from the patch, so they cannot disagree, and no AWS
call happens inside a database transaction.

Reporting the failure at save time means an operator learns immediately
that an ARN is wrong, deleted, or that the identity lacks
`bedrock:GetInferenceProfile`, instead of discovering it later through a
Bedrock 400 on adaptive-only models. Providers configured with plain
model IDs store no resolution and make no AWS call, because those
identifiers are already model identities.

Resolution uses the provider's own credential configuration: static
access keys when set, otherwise the AWS default credential chain, and
the role from `role_arn` when configured. An AIP ARN embeds the account
ID, so resolving under a different principal cannot return another
account's profile; it can only fail with a permission error, which
surfaces as a rejected write.

Using an AIP ARN now requires coderd to reach
`bedrock.{region}.amazonaws.com`. Deployments where only the gateway has
AWS egress cannot configure AIP ARNs, and they find out when they save.

<details>
<summary>Implementation plan</summary>

## Goal

Resolve Bedrock AIP ARNs once, when a provider is created or updated,
and persist the result. The gateway reads the resolved model from the
provider payload and makes no AWS call on the boot, reload, or request
paths.

## Identity

coderd resolves for every credential mode. An AIP ARN carries the
account ID, so resolving under a different principal either succeeds
with the same answer or fails with a permission error. The risk is a
false negative, not a wrong answer.

- **Static access keys, with or without `role_arn`.** The settings fully
determine the identity, so coderd reaches the same principal the gateway
will.
- **AWS default credential chain.** coderd resolves under its own
environment, which may legitimately lack `bedrock:GetInferenceProfile`
even where the gateway has it. The save then reports an actionable
message.

## Behavior at write time

1. Skip when neither `model` nor `small_fast_model` is an AIP ARN. This
is the common case and costs nothing.
2. Otherwise resolve both identifiers with a short deadline, before the
provider write.
3. On success, store the resolved identifiers in the same provider write
and publish normally.
4. On failure, surface the AWS error and store nothing. The remedy is to
fix the ARN, configure static access keys, or grant
`bedrock:GetInferenceProfile`.
5. Re-resolve on every save. Bedrock has no `UpdateInferenceProfile`, so
an ARN means one model forever, but re-resolving proves this provider's
own identity can read the profile.

## Gateway

`ResolvedModelWithFallback` and `ResolvedSmallFastModelWithFallback`
return the stored resolution when present and the configured identifier
otherwise. The fallback covers plain model IDs and providers saved
before this change, degrading to pre-#28877 behavior rather than
dropping the provider from the pool.

## Out of scope

- Normalizing directly configured system inference profile ARNs.
- Provisioned throughput and prompt router identifiers.
- Any gateway-side resolution, including a lazy fallback.
- Displaying the resolved model in the UI.

</details>

Relates to https://linear.app/codercom/issue/AIGOV-488

Created by Coder Agents on behalf of @evgeniy-scherbina.
2026-09-11 16:03:44 +00:00
Susana Ferreira e8682044cf fix: price Copilot utility model calls at zero (#29226)
Add zero-price entries for Copilot’s GPT-4o mini, GPT-4o, and GPT-4.1,
based on GitHub’s [utility-model
documentation](https://docs.github.com/en/copilot/concepts/models/utility-models#list-of-utility-models).

Keep GPT-5.4 nano’s existing rates: background utility calls are
unbilled, but GitHub also publishes [Copilot prices specifically for
GPT-5.4 nano’s billable
usage](https://docs.github.com/en/copilot/reference/copilot-billing/models-and-pricing#openai).
AI Gateway cannot distinguish utility calls from billable usage by model
ID, so we retain Nano’s published rates. This overestimates costs for
its unbilled utility calls. No existing model prices are changed.

> [!NOTE]
> Generated by Coder Agents on behalf of @ssncferreira.
2026-09-11 15:27:25 +01:00
Susana Ferreira b3f43513a8 fix: add OpenAI Daybreak alias pricing (#29218)
Add pricing for `gpt-daybreak-blue-latest` (alias of `gpt-5.6-sol`) and
`gpt-daybreak-red-latest` (alias of `gpt-5.6-cyber`), as documented on
[OpenAI’s pricing
page](https://developers.openai.com/api/docs/pricing#cyber-models).

Blue copies models.dev pricing; Red uses OpenAI’s published rates
because Cyber is missing from models.dev. Comments link to the source
and note that alias targets can change. Only these two price entries are
added.

> [!NOTE]
> Generated by Coder Agents on behalf of @ssncferreira.
2026-09-11 12:17:30 +01:00
Susana Ferreira 3ed8548e78 fix: unblock AI price book refresh for gpt-6-astra and qwen3.8-max (#29170)
The weekly `aigateway-prices-refresh` job
[failed](https://github.com/coder/coder/actions/runs/34458761592)
because two upstream-guard assertions in the generator tripped:
models.dev now lists OpenAI's `gpt-6-astra` (so its `overrides.jq`
injection must be dropped), and the curated OpenRouter
`qwen/qwen3.8-max` identifier was renamed upstream to
`qwen/qwen3.8-max-0902`.

This removes the `gpt-6-astra` injection, repoints the qwen curation
entry to `qwen/qwen3.8-max-0902` (with a `displayName` override to keep
the clean "Qwen3.8 Max" label in the UI), and regenerates `prices.json`
and `knownModelsGenerated.json`.

Note: because the artifacts regenerate from live models.dev, this diff
also carries unrelated upstream drift, the same content the scheduled
refresh PR would produce.

> [!NOTE]
> Generated with Coder Agents on behalf of @ssncferreira.
2026-09-10 11:31:23 +01:00
Jake Howell 257c6f1dca refactor: move shared AI model UI into modules/aiModels (#29040)
> 🤖 Refactoring with Cursor.

AI settings was importing model form fields, ModelSelector, and
ProviderIcon from AgentsPage. Those now live in
`site/src/modules/aiModels`.

No user-facing behavior change.

- Move ProviderIcon, ModelSelector, and the model admin form fields into
`modules/aiModels`
- Point AgentsPage and AI settings at the new paths
- Drop the leftover ChatModelAdminPanel ProviderIcon duplicate and the
knownModels barrel
- Update the known-models catalog generator paths
2026-09-08 14:34:51 +10:00
Michael Suchacz 9cd66d3773 feat: add GPT-6 Astra to the known models catalog, price book, and chatd (#28955) 2026-09-04 11:19:29 +02:00
cdrciandgithub-actions[bot] b938495bf5 chore: refresh AI model price book (#28939)
## Price book changes

7 models added, 0 models removed, 15 models changed.

<details>
<summary>Added</summary>

- openrouter/meta/muse-spark-1.3
- openrouter/meta/muse-spark-1.3-contributor
- vercel/alibaba/qwen3.8-max-0902
- vercel/google/gemini-3.8-flash
- vercel/meta/muse-spark-1.3
- vercel/meta/muse-spark-1.3-contributor
- vercel/zai/glm-5.3-promo-50
</details>

<details>
<summary>Changed</summary>

- azure/gpt-5.6-sol
- openrouter/deepseek/deepseek-v4-flash
- openrouter/deepseek/deepseek-v4-flash-vision-exp
- openrouter/deepseek/deepseek-v4-pro
- openrouter/deepseek/deepseek-v4-pro-0813
- openrouter/meta-llama/llama-3.3-70b-instruct
- openrouter/meta/muse-glimmer-30b
- openrouter/nvidia/nemotron-3-nano-30b-a3b
- openrouter/nvidia/nemotron-3-ultra-550b-a55b
- openrouter/qwen/qwen3.5-397b-a17b
- openrouter/qwen/qwen3.8-2.4t-a95b
- openrouter/tencent/hy3
- openrouter/z-ai/glm-4.6
- openrouter/z-ai/glm-5.3
- openrouter/~z-ai/glm-latest
</details>

## Review notes

Regenerated by `make gen/aibridge-prices` from the live
[models.dev](https://models.dev) catalog. Both artifacts come from one
snapshot, so they ship together:

- `coderd/aibridge/prices/data/prices.json`
-
`site/src/pages/AgentsPage/components/ChatModelAdminPanel/knownModels/knownModelsGenerated.json`

These are customer-visible cost numbers taken from upstream data, so
this PR is never merged automatically. The summary above lists what
moved; check the diff for exact figures before approving.

Opened automatically by the [aigateway-prices-refresh
workflow](https://github.com/coder/coder/actions/runs/33736992948).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-09-03 13:41:16 +02:00
Michael Suchacz a8f7591627 chore: add Gemini 3.8 Flash to the known models catalog and price book (#28909) 2026-09-02 18:35:51 +00:00
Michael Suchacz 560ef00c15 chore: add Claude Fable 5.1 and other new models to the known models catalog (#28887)
Add the models that landed on models.dev since the August curation pass
to the Agents-page known models list, so they appear as suggestions when
an admin adds a chat model in `/agents` settings.

| Model | Providers |
|---|---|
| Claude Fable 5.1 | anthropic, azure, bedrock (plus `global.` alias),
openrouter, vercel |
| Claude Opus 5 | anthropic (already curated on the other providers) |
| Gemini 3.7 Flash | google |
| GLM 5.3 | openrouter, vercel |

Fable 5.1 and Opus 5 use `reasoningEffort: high` like their curated
siblings, and new entries sort ahead of the models they supersede.
`knownModelsGenerated.json` and
`coderd/aibridge/prices/data/prices.json` are both regenerated with
`make gen/aibridge-prices` from the same models.dev snapshot; the
`prices.json` changes are upstream drift since the last weekly refresh.

Left out pending a decision: azure now lists `claude-mythos-5` upstream
but it is not curated for azure here, and `copilot` has no curation
entries at all.

> Xum opened this PR on behalf of @ibetitsmike.
2026-09-02 09:50:57 +02:00
cdrciandgithub-actions[bot] debe8e51bb chore: refresh AI model price book (#28711)
## Price book changes

36 models added, 27 models removed, 47 models changed.

<details>
<summary>Added</summary>

- openrouter/deepseek/deepseek-v4-flash-vision-exp
- openrouter/mancer/weaver
- openrouter/meta/muse-spark-1.2-contributor
- openrouter/minimax/minimax-m2.7:free
- openrouter/minimax/minimax-m3:free
- openrouter/mistralai/devstral-2512
- openrouter/mistralai/ministral-8b
- openrouter/qwen/qwen3.8-flash
- openrouter/tencent/hy-mt2-1.8b
- openrouter/tencent/hy-mt2-30b-a3b
- openrouter/tencent/hy-mt2-7b
- openrouter/thinkingmachines/inkling-small:free
- openrouter/thinkingmachines/inkling:free
- openrouter/z-ai/glm-5.3-flash
- vercel/alibaba/qwen3.8-flash
- vercel/deepseek/deepseek-v4-flash-vision-exp
- vercel/google/gemini-3.5-transcribe
- vercel/minimax/minimax-m2.7-free
- vercel/minimax/minimax-m3-free
- vercel/openai/gpt-oss-safeguard-120b
- vercel/spacexai/grok-4.1-fast-non-reasoning
- vercel/spacexai/grok-4.1-fast-reasoning
- vercel/spacexai/grok-4.20-multi-agent
- vercel/spacexai/grok-4.20-multi-agent-beta
- vercel/spacexai/grok-4.20-non-reasoning
- vercel/spacexai/grok-4.20-non-reasoning-beta
- vercel/spacexai/grok-4.20-reasoning
- vercel/spacexai/grok-4.20-reasoning-beta
- vercel/spacexai/grok-4.3
- vercel/spacexai/grok-4.5
- vercel/spacexai/grok-4.6
- vercel/spacexai/grok-build-0.1
- vercel/tencent/hy-mt2-lite
- vercel/tencent/hy-mt2-plus
- vercel/tencent/hy-mt2-pro
- vercel/zai/glm-5.3-flash
</details>

<details>
<summary>Removed</summary>

- openrouter/deepcogito/cogito-v2.1-671b
- openrouter/google/gemma-3n-e4b-it
- openrouter/inclusionai/ling-2.6-1t
- openrouter/inclusionai/ling-2.6-flash
- openrouter/inclusionai/ring-2.6-1t
- openrouter/nvidia/nemotron-3-nano-30b-a3b:free
- openrouter/nvidia/nemotron-nano-12b-v2-vl:free
- openrouter/nvidia/nemotron-nano-9b-v2:free
- openrouter/openai/gpt-oss-20b:free
- openrouter/qwen/qwen-plus-2025-07-28:thinking
- vercel/arcee-ai/trinity-mini
- vercel/mistral/magistral-medium
- vercel/mistral/magistral-small
- vercel/openai/gpt-4o-mini-search-preview
- vercel/openai/o3-deep-research
- vercel/xai/grok-4.1-fast-non-reasoning
- vercel/xai/grok-4.1-fast-reasoning
- vercel/xai/grok-4.20-multi-agent
- vercel/xai/grok-4.20-multi-agent-beta
- vercel/xai/grok-4.20-non-reasoning
- vercel/xai/grok-4.20-non-reasoning-beta
- vercel/xai/grok-4.20-reasoning
- vercel/xai/grok-4.20-reasoning-beta
- vercel/xai/grok-4.3
- vercel/xai/grok-4.5
- vercel/xai/grok-4.6
- vercel/xai/grok-build-0.1
</details>

<details>
<summary>Changed</summary>

- bedrock/global.openai.gpt-5.6-luna
- bedrock/global.openai.gpt-5.6-sol
- bedrock/global.openai.gpt-5.6-terra
- bedrock/openai.gpt-5.6-sol
- copilot/gpt-5.6-sol
- google/gemini-3.6-flash
- google/gemini-flash-latest
- google/gemini-flash-lite-latest
- openai/gpt-5.6
- openai/gpt-5.6-sol
- openrouter/deepseek/deepseek-chat-v3.1
- openrouter/deepseek/deepseek-v3.1-terminus
- openrouter/deepseek/deepseek-v3.2
- openrouter/deepseek/deepseek-v4-flash
- openrouter/deepseek/deepseek-v4-flash-0731
- openrouter/deepseek/deepseek-v4-pro
- openrouter/deepseek/deepseek-v4-pro-0813
- openrouter/meta-llama/llama-3.3-70b-instruct
- openrouter/meta-llama/llama-4-scout
- openrouter/minimax/minimax-m2.5
- openrouter/mistralai/mistral-small-3.2-24b-instruct
- openrouter/moonshotai/kimi-k2.5
- openrouter/moonshotai/kimi-k2.7-code
- openrouter/nvidia/nemotron-3-nano-30b-a3b
- openrouter/openai/gpt-5.6-sol
- openrouter/openai/gpt-5.6-sol-pro
- openrouter/openai/gpt-oss-120b
- openrouter/qwen/qwen2.5-vl-72b-instruct
- openrouter/qwen/qwen3-235b-a22b-2507
- openrouter/qwen/qwen3-30b-a3b
- openrouter/qwen/qwen3-next-80b-a3b-instruct
- openrouter/qwen/qwen3.6-27b
- openrouter/qwen/qwen3.6-35b-a3b
- openrouter/qwen/qwen3.8-27b
- openrouter/z-ai/glm-4.6
- openrouter/z-ai/glm-5.1
- openrouter/z-ai/glm-5.2
- openrouter/~deepseek/deepseek-v4-flash-latest
- openrouter/~moonshotai/kimi-latest
- openrouter/~openai/gpt-latest
- vercel/deepseek/deepseek-v4-flash-0731
- vercel/deepseek/deepseek-v4-pro-0813
- vercel/nvidia/nemotron-3.5-lightning
- vercel/openai/gpt-5.6-sol
- vercel/openai/gpt-5.6-sol-fast
- vercel/openai/gpt-oss-safeguard-20b
- vercel/tencent/hy3
</details>

## Review notes

Regenerated by `make gen/aibridge-prices` from the live
[models.dev](https://models.dev) catalog. Both artifacts come from one
snapshot, so they ship together:

- `coderd/aibridge/prices/data/prices.json`
-
`site/src/pages/AgentsPage/components/ChatModelAdminPanel/knownModels/knownModelsGenerated.json`

These are customer-visible cost numbers taken from upstream data, so
this PR is never merged automatically. The summary above lists what
moved; check the diff for exact figures before approving.

Opened automatically by the [aigateway-prices-refresh
workflow](https://github.com/coder/coder/actions/runs/33072075172).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-08-27 15:03:51 +01:00
Yevhenii Shcherbina 211f490910 refactor: share the AI Gateway price book contract (#28310)
Follow-up to the review discussion on the price book refresh automation:
https://github.com/coder/coder/pull/28146#discussion_r3806439966

## Problem

The price seed row struct was duplicated three times, so a JSON tag
change had to be repeated in each copy:

- `scripts/aibridgepricesgen.priceRow`
- `scripts/aibridgepricesdiff.priceRow`
- `coderd/aibridge/prices.seedRow`

The `(provider, model)` key and its parsing were duplicated too.

## Change

Add `coderd/aibridge/prices/pricebook` holding the shared contract:
`Row`, `Key`, `Row.Key()`, and `Parse`. The package depends only on the
standard library, so the scripts can import it without pulling in the
database layer that `coderd/aibridge/prices` brings.

Consumer-specific behaviour stays where it is: upstream conversion and
validation in the generator, comparison and Markdown rendering in the
diff tool, DB seeding and runtime lookup in the seeder.

The batch SQL upsert still extracts JSON fields by name, so it remains a
separate contract boundary. The note about keeping it in sync now lives
on the shared `Row`.

No generated artifacts change; the serialized schema is identical.

---

<sub>Opened by Coder Agents on behalf of @evgeniy-scherbina.</sub>
2026-08-20 14:04:23 -04:00
Susana Ferreira 19d1ee9fc8 feat: support custom prices for models in the price book (#28328)
## Description

The experimental CLI could only price models the price book does not cover, so an operator with a negotiated rate for a model Coder already prices had no way to record it. The restriction existed because a single row served both the price book and prices set through the API, and the startup seeder would overwrite an override on the next restart.

Each source now keeps its own row (https://github.com/coder/coder/pull/28204), so that no longer applies. This removes the restriction: a price set through the CLI takes effect over the price book for any model, and the book stays underneath it.

## Changes

- Remove the validation that rejected models the price book covers.
- Delete `prices.IsDefaultPriced` and the index behind it, which existed only for that check.
- Generalize the `coder exp ai-model-prices update` help.
- Document that a custom price overrides the price book and does not follow its updates.
- Rework the spend approximation callout around what a custom price can and cannot correct.

Closes https://linear.app/codercom/issue/AIGOV-594

> [!NOTE]
> Initially generated by Claude Opus 5, modified and reviewed by @ssncferreira
2026-08-20 11:46:38 +01:00
Susana Ferreira 9390e51422 feat: distinguish default and custom AI model prices (#28204)
## Description

Prices in `ai_model_prices` come from two places: the price book embedded in each Coder release, and prices set through the experimental CLI (https://github.com/coder/coder/pull/27926). Until now, they were indistinguishable, so the startup seeder re-applied the book over every row, and a price someone set would silently revert on the next restart.

This adds a `source` column with values `default` and `custom`, and keeps a row for each. Readers resolve a model to its custom price when one exists and fall back to the book, including the cost path that prices an interception.

Keeping both rows means the price book stays current underneath an override, so a future delete can restore it.

Note: the endpoint still only accepts models the price book does not cover. Overriding a price the book already carries is handled by the follow-up issue https://linear.app/codercom/issue/AIGOV-594.

## Changes

- Add a migration for the `ai_model_price_source` enum and a `source` column, backfilled to `default` and then `NOT NULL`. `source` joins the primary key, so a model can hold one row per source.
- Take a `source` parameter on `UpsertAIModelPrices`. Each source keeps its own row, so the price book and a custom price never overwrite each other.
- Resolve to the custom price in `GetAIModelPriceByProviderModel` and `GetAIModelPrices`, so both the interception cost snapshot and the list endpoint use it.
- Seed the price book as `default`, and write prices set through the endpoint as `custom`.

Closes https://linear.app/codercom/issue/AIGOV-592

> [!NOTE]
> Initially generated by Claude Opus 5, modified and reviewed by @ssncferreira
2026-08-20 11:36:58 +01:00
cdrciandgithub-actions[bot] 5e0710de92 chore: refresh AI model price book (#28365)
## Price book changes

61 models added, 14 models removed, 51 models changed.

<details>
<summary>Added</summary>

- azure/claude-mythos-5
- azure/claude-opus-4-7
- azure/kimi-k2.7-code
- bedrock/global.openai.gpt-5.6-luna
- bedrock/global.openai.gpt-5.6-sol
- bedrock/global.openai.gpt-5.6-terra
- bedrock/xai.grok-4.6
- copilot/gemini-3.7-flash
- copilot/grok-4.6
- copilot/kimi-k3
- copilot/mai-code-1.1-flash
- google/gemini-3.7-flash
- openrouter/bytedance-seed/seed-2-1-turbo
- openrouter/bytedance-seed/seed-2.0-code
- openrouter/deepseek/deepseek-v4-pro-0813
- openrouter/dots-studio/dots-3-note-preview:free
- openrouter/google/gemini-3.7-flash
- openrouter/inclusionai/ling-3.0-flash
- openrouter/liquid/lfm-2.5-2.6b:free
- openrouter/meta/muse-glimmer-30b
- openrouter/meta/muse-spark-1.2
- openrouter/nvidia/nemotron-3.5-lightning
- openrouter/nvidia/nemotron-3.5-lightning:free
- openrouter/qwen/qwen3.8-2.4t-a95b
- openrouter/qwen/qwen3.8-27b
- openrouter/sakana/sakana-namazu
- openrouter/upstage/solar-pro4
- openrouter/x-ai/grok-4.6
- openrouter/z-ai/glm-5.2:free
- openrouter/z-ai/glm-5.3
- openrouter/~z-ai/glm-latest
- vercel/alibaba/qwen3.8-2.4t-a95b
- vercel/alibaba/qwen3.8-27b
- vercel/deepseek/deepseek-v4-pro-0813
- vercel/google/gemini-3.7-flash
- vercel/inclusionai/ling-3.0-flash
- vercel/meta/muse-glimmer-30b
- vercel/meta/muse-spark-1.2
- vercel/meta/muse-spark-1.2-contributor
- vercel/nvidia/nemotron-3.5-lightning
- vercel/openai/gpt-4.1-fast
- vercel/openai/gpt-4.1-mini-fast
- vercel/openai/gpt-4.1-nano-fast
- vercel/openai/gpt-4o-fast
- vercel/openai/gpt-4o-mini-fast
- vercel/openai/gpt-5-fast
- vercel/openai/gpt-5-mini-fast
- vercel/openai/gpt-5.1-thinking-fast
- vercel/openai/gpt-5.2-fast
- vercel/openai/gpt-5.3-codex-fast
- vercel/openai/gpt-5.4-fast
- vercel/openai/gpt-5.4-mini-fast
- vercel/openai/gpt-5.5-fast
- vercel/openai/gpt-5.6-luna-fast
- vercel/openai/gpt-5.6-sol-fast
- vercel/openai/gpt-5.6-terra-fast
- vercel/openai/o3-fast
- vercel/openai/o4-mini-fast
- vercel/sakana/namazu
- vercel/xai/grok-4.6
- vercel/zai/glm-5.3
</details>

<details>
<summary>Removed</summary>

- anthropic/claude-opus-4-1
- anthropic/claude-opus-4-1-20250805
- google/gemini-2.0-flash
- google/gemini-2.0-flash-lite
- google/gemini-3-pro-preview
- openrouter/ai21/jamba-large-1.7
- openrouter/inclusionai/ling-3.0-flash:free
- openrouter/mancer/weaver
- openrouter/openai/gpt-5.3-chat
- vercel/anthropic/claude-opus-4.1
- vercel/inclusionai/ling-3.0-flash-free
- vercel/openai/gpt-5.1-instant
- vercel/openai/gpt-5.3-chat
- vercel/zai/glm-4.6v
</details>

<details>
<summary>Changed</summary>

- azure/gpt-5.6-luna
- azure/gpt-5.6-sol
- azure/gpt-5.6-terra
- bedrock/openai.gpt-5.6-sol
- openrouter/deepseek/deepseek-chat-v3-0324
- openrouter/deepseek/deepseek-v3.1-terminus
- openrouter/deepseek/deepseek-v4-flash
- openrouter/deepseek/deepseek-v4-flash-0731
- openrouter/deepseek/deepseek-v4-pro
- openrouter/google/gemini-3.6-flash
- openrouter/google/gemma-4-31b-it
- openrouter/gryphe/mythomax-l2-13b
- openrouter/minimax/minimax-m2.5
- openrouter/minimax/minimax-m2.7
- openrouter/mistralai/mistral-small-3.2-24b-instruct
- openrouter/moonshotai/kimi-k2.5
- openrouter/moonshotai/kimi-k2.6
- openrouter/moonshotai/kimi-k2.7-code
- openrouter/openai/gpt-5.6-luna
- openrouter/openai/gpt-5.6-luna-pro
- openrouter/openai/gpt-5.6-sol
- openrouter/openai/gpt-5.6-sol-pro
- openrouter/openai/gpt-5.6-terra
- openrouter/openai/gpt-5.6-terra-pro
- openrouter/openai/gpt-oss-120b
- openrouter/qwen/qwen-plus-2025-07-28:thinking
- openrouter/qwen/qwen2.5-vl-72b-instruct
- openrouter/qwen/qwen3-14b
- openrouter/qwen/qwen3-235b-a22b-2507
- openrouter/qwen/qwen3-30b-a3b
- openrouter/qwen/qwen3-coder-30b-a3b-instruct
- openrouter/qwen/qwen3-vl-235b-a22b-thinking
- openrouter/qwen/qwen3-vl-30b-a3b-instruct
- openrouter/qwen/qwen3.5-35b-a3b
- openrouter/qwen/qwen3.6-27b
- openrouter/qwen/qwen3.6-35b-a3b
- openrouter/tencent/hy3-preview
- openrouter/thinkingmachines/inkling
- openrouter/thinkingmachines/inkling-small
- openrouter/z-ai/glm-5
- openrouter/z-ai/glm-5.2
- openrouter/~deepseek/deepseek-v4-flash-latest
- openrouter/~google/gemini-flash-latest
- openrouter/~moonshotai/kimi-latest
- openrouter/~openai/gpt-latest
- openrouter/~x-ai/grok-latest
- vercel/deepseek/deepseek-v4-flash
- vercel/deepseek/deepseek-v4-pro
- vercel/google/gemini-3.6-flash
- vercel/openai/gpt-5.6-sol
- vercel/zai/glm-5.2
</details>

## Review notes

Regenerated by `make gen/aibridge-prices` from the live
[models.dev](https://models.dev) catalog. Both artifacts come from one
snapshot, so they ship together:

- `coderd/aibridge/prices/data/prices.json`
-
`site/src/pages/AgentsPage/components/ChatModelAdminPanel/knownModels/knownModelsGenerated.json`

These are customer-visible cost numbers taken from upstream data, so
this PR is never merged automatically. The summary above lists what
moved; check the diff for exact figures before approving.

Opened automatically by the [aigateway-prices-refresh
workflow](https://github.com/coder/coder/actions/runs/32352560765).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2026-08-20 10:46:48 +01:00
Susana Ferreira 2d9b6eda8f feat: add experimental CLI to price unpriced AI models (#27926)
## Description

AI Gateway computes the cost of an interception from `ai_model_prices`,
which is seeded on every server start from a price book embedded in the
binary. A model the price book does not cover records a NULL cost, so
its spend is invisible to cost reporting and is not enforced against
budgets. The only fix was to wait for a Coder release that added the
model.

This adds an experimental CLI, backed by an experimental HTTP endpoint,
for pricing those models. Models the price book already covers are
rejected, because the seeder re-applies the book on every start and
would overwrite an operator price. Support for custom pricing will be
handled in
https://linear.app/codercom/issue/AIGOV-589/extend-experimental-cli-command-to-set-custom-ai-model-prices.

## Commands

```
coder exp ai-model-prices list [--provider] [--model]
coder exp ai-model-prices update [file|-] [--provider] [--model] [--input-price] [--output-price] [--cache-read-price] [--cache-write-price] [--yes]
```

## Changes

- Add `GET` and `POST /api/experimental/ai/model-prices`, gated behind
the AI Bridge entitlement and the existing `ai_model_price` RBAC
resource.
- Add a `GetAIModelPrices` query with optional `provider` and `model`
filters applied in SQL.
- Validate the whole request before writing anything, so one bad entry
cannot leave the table half updated, and report every problem at once.
- Reject prices for models the embedded price book already covers,
through a new `prices.IsDefaultPriced`.
- Add the `coder exp ai-model-prices` command with `list` and `update`.
`update` accepts a JSON document or the single-model flags and prints a
plan, asking to confirm unless the document is piped in or `--yes` is
passed.
- Consolidate the supported provider list into
`coderd/aibridge/prices/providers` so the price generator and the server
share one definition.
- Add `codersdk` types and client methods for both endpoints, and bound
the request body at 1 MiB.
- Document the command in the AI Gateway cost controls page.

Closes
https://linear.app/codercom/issue/AIGOV-567/experimental-cli-command-to-set-prices-for-unpriced-ai-models

> [!NOTE]
> Initially generated by Claude Opus 5, modified and reviewed by
@ssncferreira
2026-08-13 15:00:36 +01:00
Susana Ferreira 5efa7abe7d fix: only write AI model prices that changed (#27923)
Previously, the AI Gateway price seeder rewrote every row of
`ai_model_prices` on each server start, because `ON CONFLICT` fires on a
key conflict rather than on a value difference. `updated_at` therefore
recorded when the server last restarted rather than when a price last
changed.

Guard the `DO UPDATE` branch so a conflicting row is only rewritten when
one of its four prices differs. The comparison uses `IS DISTINCT FROM`
rather than `<>` because the price columns are nullable, and `<>` yields
NULL when either side is NULL, which would skip the update and leave a
stale price in place.

Related to
https://linear.app/codercom/issue/AIGOV-567/experimental-cli-command-to-set-prices-for-unpriced-ai-models

> [!NOTE]
> Initially generated by Claude Opus 5, modified and reviewed by
@ssncferreira
2026-08-10 16:33:48 +01:00
Cian JohnstonandSusana Ferreira 60161fd375 chore: update model prices to include more providers (#27837)
Adds the full set of supported provider types to
`scripts/aibridgepricesgen` and updates stored model prices.

Notes:
* We need to rename a few keys from models.dev JSON to match our
internal provider types.
* `prices.json` is now marked as generated.

---------

Co-authored-by: Susana Ferreira <susana@coder.com>
2026-08-04 14:17:50 +01:00
Yevhenii Shcherbina d57965ee7f chore: regenerate prices.json from models.dev (#27549)
Implements:
https://linear.app/codercom/issue/AIGOV-493/update-pricesjson-with-current-model-rates-before-cost-control-release

Run `make gen/aibridge-prices` to regenerate `prices.json` from
`models.dev`.

This update:
- adds support for the upstream `claude-opus-5` model;
- removes older `openai` models that have been removed upstream, keeping
us in sync with `models.dev`.
2026-07-27 23:45:22 +02:00
Susana Ferreira c23f2c0223 feat: fall back to the Everyone group for AI spend attribution (#27364)
## Description

Previously, a user with no per-user override and no membership in a budgeted group had no effective group, so their AI spend was attributed nowhere and was, therefore, untracked. This change falls back to the organization's Everyone group when no override or group budget applies.

Since every user in an organization is implicitly a member of that org's Everyone group, spend is now attributed and tracked for any user with organization membership. A user with no organization membership resolves to no group, so their daily spend is not incremented and a warning is logged.

The fallback is unlimited, so enforcement is unaffected: only override and group budgets can block requests. For users in multiple organizations, an existing budget on any Everyone group is still chosen by the "highest" policy; when none is budgeted, the fallback prefers the default org, then orders by organization name.

## Changes

- Add `ResolveUserEffectiveGroup` and the `GetUserEveryoneFallbackGroup` query: resolve override → group budget → Everyone group fallback.
- Attribute token-usage spend and the user AI spend endpoint via the fallback, so unbudgeted users resolve to their Everyone group instead of null.
- Update `GetGroupMembersAISpend` to surface the Everyone fallback as the effective group.
- Update `GetHighestGroupAIBudgetByUser` to break ties by organization name then group name, keeping multi-org resolution deterministic and consistent with the fallback.
- For multi-org users with no budget anywhere, the fallback picks the Everyone group deterministically: prefer the default org, then order by organization name.

Closes https://linear.app/codercom/issue/AIGOV-509/fall-back-to-the-everyone-group-for-spend-attribution

> [!NOTE]
> Initially generated by Claude Opus 4.7, modified and reviewed by @ssncferreira
2026-07-23 09:26:25 +01:00
Susana Ferreira a9fdf87a2f feat: add GET /groups/{group}/members/ai/spend (#27130)
## Description

Adds `GET /api/v2/groups/{group}/members/ai/spend?user_ids=...` (also available org-scoped at `/api/v2/organizations/{org}/groups/{groupName}/members/ai/spend`) to return per-member AI spend attributed to a group, along with each member's effective budget group and the applied spend limit when the queried group is their effective budget source.

In the UI, this endpoint is used alongside the existing `/api/v2/groups/{group}/members` endpoint. AI spend data is kept separate from that endpoint so that:

- Different concepts stay on different endpoints: identity (group members) vs. cost control (spend). Cost control is an additional feature layered on top of groups/orgs.
- Callers that don't need spend information don't pay for its computation.

UI flow:

1. Request `/api/v2/groups/{group}/members` → returns the group's members.
2. Request `/api/v2/groups/{group}/members/ai/spend?user_ids=...` with the IDs from step 1.

**Note:** Only current members of the queried group are returned. `spend_limit_micros` and `limit_source` are populated only when the queried group is the member's effective budget source (its own limit or a user override). `effective_group_id` is null when the member's budget resolves to a group in another organization, since an organization is treated as a tenant boundary.

<img width="2880" height="1904" alt="image" src="https://github.com/user-attachments/assets/33ed395d-d1a3-4b46-bb04-c8d3f41c8886" />

## Changes

- Add `codersdk.GroupMembersAISpend` and `GroupMemberAISpend` types, reusing the shared `AISpendPeriodWindow`.
- Add `GetGroupMembersAISpend` SQL query with a dbauthz per-row filter that mirrors `GET /api/v2/groups/{group}/members`.
- Add handler and routes under `/groups/{group}/members/ai/spend` (and the org-scoped alias) with a required `user_ids` query param (cap 100). Callers with more than 100 members are expected to batch across multiple requests.
- Add codersdk client method.
- Tests: dbauthz, raw SQL, endpoint, and role-access.

Closes https://linear.app/codercom/issue/AIGOV-471/backend-group-members-endpoint-with-members-spend

> [!NOTE]
> Initially generated by Claude Opus 4.7, modified and reviewed by @ssncferreira
2026-07-20 13:04:37 +01:00
Cian JohnstonandCopilot Autofix powered by AI 8eaf4f507b feat: generate the known-models catalog and aigateway prices (#27146)
- Regenerates `prices.json` from models.dev. The seeder only upserts, so
existing deployments keep delisted models.
- Generate the frontend known-models catalog instead of hand-writing it.
`make gen/aibridge-prices` fetches models.dev once
- Moved patches to model definitions to separate `overrides.jq` which 
  handles both `claude-sonnet-4-5` 200k context and 'aliasing' Fable 5
  as Mythos 5.
- Editorial choices of selection, order, aliases, and reasoning defaults 
  live in `curation.json`.
- Adds golden join tests with one error case per validation, a
no-network drift test comparing curation to the checked-in artifact, and
pinned invariants for the Anthropic thinking-mode split (the wrong side
returns HTTP 400) and the sonnet-4-5 context pin.

Adding a model is now one `curation.json` entry plus `make
gen/aibridge-prices`, assuming it is present on models.dev.

> This PR was authored by Coder Agents on Cian's behalf.

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-07-14 19:36:27 +00:00
Susana Ferreira 48f07e6e13 feat: add user AI spend endpoint (#26978)
## Description

Adds the `GET /api/v2/users/{user}/ai/spend` endpoint returning the
user's current AI spend, effective budget, and period bounds.

## Changes

- Add `userAISpendStatus` handler under the same feature/experiment gate
as `/api/v2/users/{user}/ai/budget`.
- Add `codersdk.UserAIBudgetSummary` (embedded into `UserAISpendStatus`)
and a `UserAISpendStatus` client method.
- Move `LimitSource` from `coderd/aibridge/budget` to `codersdk` so the
type is shared across endpoints.

Closes https://linear.app/codercom/issue/AIGOV-472

> [!NOTE]
> Initially generated by Claude Opus 4.7, modified and reviewed by
@ssncferreira
2026-07-08 12:46:47 +01:00
Susana Ferreira 64ca5ac9f8 refactor(coderd): add budget.CurrentPeriod for [start, end) windows (#26972)
## Description

Extracts the AI budget period computation into a shared
`budget.CurrentPeriod` helper. Pure refactor with no wire-value changes.

## Changes

- Add `budget.CurrentPeriod(now, period)` returning a
`PeriodWindow{Start, End}` in UTC. Unknown periods return an error,
matching the pattern used by `ResolveUserAIBudget` for unknown policies.
- Update the callers and respective tests to use `CurrentPeriod`.

> [!NOTE]
> Initially generated by Claude Opus 4.7, modified and reviewed by
@ssncferreira
2026-07-06 10:37:27 +01:00
Sas Swart d179266cc7 feat: capture, persist, and strip Agent Firewall correlation headers in AI Bridge (#26529)
Wire the Agent Firewall correlation headers
(`X-Coder-Agent-Firewall-Session-Id` and
`X-Coder-Agent-Firewall-Sequence-Number`) through the AI Bridge
interception processor so that each interception is linked to its
originating firewall session.

Closes https://linear.app/codercom/issue/AIGOV-259

> Generated by Coder Agents on behalf of @SasSwart

**Data flow:**
`request header` → `bridge.go` reads + strips → `InterceptionRecord` →
`translator.go` → proto `RecordInterceptionRequest` →
`aibridgedserver.go` → DB
2026-06-30 14:01:27 +02:00
Susana Ferreira 970bd73691 feat: add /api/v2/ai-gateway API route aliases (#26475)
## Description

Registers `/api/v2/ai-gateway/*` as the new API path for AI Gateway, replacing `/api/v2/aibridge/*`. Both prefixes share the same route builder (`aiBridgeRoutes`) backed by a single in-memory handler, so existing `/aibridge` endpoints continue to work. New endpoints must be registered on the enterprise API handler under `/api/v2/ai-gateway` only.

Swagger annotations now point to `/api/v2/ai-gateway` paths with a backward-compatibility note referencing `/aibridge`. The legacy `/aibridge` routes are skipped in the swagger documentation test.

## Changes

- Store one raw handler (`aiGatewayHandler`) instead of two prefix-stripped handlers
- Register `/ai-gateway` and `/ai-gateway/proxy` route aliases alongside legacy `/aibridge` routes
- Move `/aibridge/keys` to `/ai-gateway/keys`
- Update in-process transport to use `/api/v2/ai-gateway` prefix
- Update SDK client URLs and proxy forwarding URL
- Swap `@Router` and `@Tags` annotations from `aibridge`/`AI Bridge` to `ai-gateway`/`AI Gateway`
- Rename user-facing error messages from "AI Bridge" to "AI Gateway"
- Define consts for route prefixes (`AIGatewayRootPath`, `AIBridgeRootPath`)
- Update tests and comments to use new paths

Note: the following will be addressed in follow-up PRs:
- Frontend API URLs
- Frontend routes and redirects
- Dogfood main.tf updates
- Hand-written documentation URL updates
- aibridge internal comments and nits
- Scale tests path updates

Refs https://linear.app/coder/issue/AIGOV-230

> Generated with the assistance of Coder Agents (@ssncferreira)
2026-06-23 12:15:10 +01:00
Yevhenii Shcherbina b6fcb9a30a feat: record cost on aibridge token usages (#26229)
Implements
https://linear.app/codercom/issue/AIGOV-286/add-interception-cost-calculation-to-aibridge-token-usages

Adds spend attribution to AI Gateway. After the upstream response, each
token-usage record now captures the user's effective group, the
per-token prices in effect at that moment, and a computed cost — so
spend is recorded as an immutable, point-in-time snapshot.

Concretely, `aibridge_token_usages` gains `effective_group_id`,
`input_price_micros`, `output_price_micros`, `cache_read_price_micros`,
`cache_write_price_micros`, and `cost_micros`. When a usage record is
written, the effective group is resolved (per-user override, else the
deployment budget policy), the `(provider, model)` price is looked up
and snapshotted onto the row, and cost is computed from the
provider-reported token counts. A model that isn't in the price table
records its tokens with a `NULL` cost; any *other* resolution failure
fails the write, so a `NULL` cost unambiguously means "model not priced"
rather than "lookup errored."

All values are stored in micro-units (1 unit = 1,000,000 micro-units;
Phase 1 assumes USD, so 1 micro-unit = $0.000001). Prices are quoted per
million tokens.

This also grants the AI Bridge RBAC subject `read` on `ai_model_prices`
(the per-interception price lookup needs it; it previously only had
`update` for the startup seeder).

## Cost precision

Cost is computed per token category as `tokens × price / 1_000_000` with
integer division, then the four categories are summed. The division is
done **per category** (not once over the summed numerator) on purpose:
it keeps the per-category line items summing exactly to the stored total
— no "the parts don't add up to the whole" in reporting).

Integer division truncates sub-micro-unit fractions. For example, a
cheap model at $0.10 per million tokens is a price of `100_000`; 9
tokens cost `9 × 100_000 / 1_000_000 = 900_000 / 1_000_000 = 0` (the
true 0.9 micro-units floors to 0). At real list prices this rarely bites
— $3/M input is a price of `3_000_000`, so even a single token is 3
micro-units. The per-record under-count is bounded below 1 micro-unit
per category, so under $0.000004 total across the four categories, which
is acceptable for list-price-based cost approximation.

## Overflow safety

`cost_micros` is a `BIGINT` (int64), and the largest intermediate value
is a single category's `tokens × price` before division. int64's ceiling
is ≈ `9.223e18`.

- At a steep $75/M model (price `75_000_000`), overflow would require
~123 billion tokens in one response: `123e9 × 75e6 = 9.225e18`, just
over the limit. `122e9` stays under at `9.15e18`.
- A realistically maxed-out Opus 4.8 response (≈1M input + 128K output
at list prices) costs about $15, with a numerator around `1.5e13` —
roughly six orders of magnitude below the ceiling.

So overflow is unreachable from real token counts.

### Multi-currency support

In the future, we may encounter issues with multi-currency support,
especially when dealing with currencies that have very large exchange
rates relative to USD, for example:

IRR: ~1,300,000 IRR ≈ 1 USD
VND: ~26,000 VND ≈ 1 USD

For currencies with such large denominations, numeric overflow is
technically possible, considering that we have only about six orders of
magnitude of headroom before reaching the limit (see above).

## `effective_group_id` has no foreign key

`effective_group_id` records the group a spend was attributed to, as an
immutable historical fact. It is intentionally **not** a foreign key, so
the record survives deletion of the group.

Alternatives were considered and rejected:

- **`ON DELETE SET NULL`** would mutate an "immutable" record — deleting
a group silently erases that interception's attribution and under-counts
the group's historical spend.
- **`RESTRICT` / `NO ACTION`** would block group deletion entirely
(groups are hard-deleted).
- **`CASCADE`** would delete spend history when a group is deleted — the
worst outcome for an audit record.

There is also no insert-time check that the group still exists: the id
comes from a budget that was just resolved, meaning it was valid at some
point.

## Open question: group name snapshotting

Should we also snapshot the group *name* onto each record? Two options:

- **Denormalize it now** — readable in historical reports even after a
group is deleted, but the snapshot can drift from the current name on
rename, raising a "show point-in-time vs. current name" question.
- **Postpone until needed** — it's a purely additive column later, and
the name is display-only (not correctness-bearing like the price). The
cost: names of groups deleted before the column is added can't be
backfilled.

Leaning toward postponing until a concrete reporting need settles the
drift question.
2026-06-16 20:09:00 +00:00
Yevhenii Shcherbina 1cada0649c feat(coderd): resolve effective user AI budget (#26142)
Closes
https://linear.app/codercom/issue/AIGOV-287/add-effective-group-resolution

Implements the effective AI budget resolution from the AI Governance
cost-controls RFC: for a given user, a `user_ai_budget_overrides` row
wins if present, otherwise the deployment budget policy (`highest`)
picks the largest group budget across the user's groups, ties broken
alphabetically.

For now, I keep the logic under `coderd/aibridge/budget`, but that may
change during the implementation of budget enforcement.
2026-06-10 14:01:20 +00:00
Paweł Banaszewski 96e3a64b12 feat: add AI Gateway coderd key CRUD endpoints (#25565)
Adds create, list and delete endpoints for AI Gateway keys.
Those keys are used to authenticate into Coderd.
All endpoints require Owner permission.
2026-06-03 13:50:33 +02:00
Danny KoppingandClaude Opus 4.7 8652ef3e3b refactor: route TransportFor by provider name (#25650)
Delegate `aibridge` routing responsibility to the in-memory transport
layer.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 18:04:12 +02:00