Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 25 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ _gen/bin/apikeyscopesgen: $(wildcard scripts/apikeyscopesgen/*.go) $(RBAC_GO_FIL
@mkdir -p _gen/bin
Comment thread
johnstcn marked this conversation as resolved.
go build -o $@ ./scripts/apikeyscopesgen

_gen/bin/aibridgepricesgen: $(wildcard scripts/aibridgepricesgen/*.go) | _gen
_gen/bin/aibridgepricesgen: $(wildcard scripts/aibridgepricesgen/*.go) scripts/aibridgepricesgen/curation.json | _gen
@mkdir -p _gen/bin
go build -o $@ ./scripts/aibridgepricesgen

Expand Down Expand Up @@ -1022,14 +1022,33 @@ gen: gen/db $(if $(GEN_SKIP_GOLDEN),,gen/golden-files) $(GEN_FILES)
gen/db: $(DB_GEN_FILES)
.PHONY: gen/db

# Refresh the AI Bridge pricing seed file from models.dev. Kept out of
# `make gen`. Phony so each invocation regenerates.
coderd/aibridge/prices/data/prices.json: _gen/bin/aibridgepricesgen | _gen
# Patched snapshot of the models.dev catalog. Fetched once per
# gen/aibridge-prices run, with upstream corrections applied by
# overrides.jq; both prices.json and the frontend known-models catalog are
# generated from this single snapshot. Phony so each invocation refreshes it.
_gen/models-dev.json: | _gen
set -o pipefail; $(call atomic_write,curl -fsSL https://models.dev/api.json | jq -f scripts/aibridgepricesgen/overrides.jq)
.PHONY: _gen/models-dev.json

# Refresh the AI Bridge pricing seed file from the patched models.dev
# snapshot. Kept out of `make gen` because the output depends on live
# upstream data. Phony so each invocation regenerates.
coderd/aibridge/prices/data/prices.json: _gen/bin/aibridgepricesgen _gen/models-dev.json | _gen
@mkdir -p $(dir $@)
$(call atomic_write,_gen/bin/aibridgepricesgen)
$(call atomic_write,_gen/bin/aibridgepricesgen -upstream _gen/models-dev.json)
.PHONY: coderd/aibridge/prices/data/prices.json

gen/aibridge-prices: coderd/aibridge/prices/data/prices.json
# Frontend known-models catalog, generated from the same patched models.dev
# snapshot joined with the editorial curation in
# scripts/aibridgepricesgen/curation.json. Kept out of `make gen` for the
# same live-upstream-data reason as prices.json.
site/src/pages/AgentsPage/components/ChatModelAdminPanel/knownModels/knownModelsGenerated.json: _gen/bin/aibridgepricesgen _gen/models-dev.json | _gen
$(call atomic_write,_gen/bin/aibridgepricesgen -format=catalog -upstream _gen/models-dev.json,./scripts/biome_format.sh)
.PHONY: site/src/pages/AgentsPage/components/ChatModelAdminPanel/knownModels/knownModelsGenerated.json

gen/aibridge-prices: \
coderd/aibridge/prices/data/prices.json \
site/src/pages/AgentsPage/components/ChatModelAdminPanel/knownModels/knownModelsGenerated.json
.PHONY: gen/aibridge-prices

gen/golden-files: \
Expand Down
8 changes: 8 additions & 0 deletions coderd/aibridge/prices/data/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,11 @@
`prices.json` in this directory is generated by `make gen/aibridge-prices` and
embedded into the Coder binary at build time. Do not edit it manually; the
next regeneration will overwrite any changes.

The Make target fetches models.dev once into `_gen/models-dev.json`, applying
the upstream corrections in `scripts/aibridgepricesgen/overrides.jq`. Both
`prices.json` and the frontend known-models catalog at
`site/src/pages/AgentsPage/components/ChatModelAdminPanel/knownModels/knownModelsGenerated.json`
are generated from that single patched snapshot; the catalog is additionally
joined with the editorial curation in
`scripts/aibridgepricesgen/curation.json`.
166 changes: 63 additions & 103 deletions coderd/aibridge/prices/data/prices.json
Original file line number Diff line number Diff line change
@@ -1,67 +1,11 @@
[
Comment thread
johnstcn marked this conversation as resolved.
{
"provider": "anthropic",
"model": "claude-3-5-haiku-20241022",
"input_price": 800000,
"output_price": 4000000,
"cache_read_price": 80000,
"cache_write_price": 1000000
},
{
"provider": "anthropic",
"model": "claude-3-5-haiku-latest",
"input_price": 800000,
"output_price": 4000000,
"cache_read_price": 80000,
"cache_write_price": 1000000
},
{
"provider": "anthropic",
"model": "claude-3-5-sonnet-20240620",
"input_price": 3000000,
"output_price": 15000000,
"cache_read_price": 300000,
"cache_write_price": 3750000
},
{
"provider": "anthropic",
"model": "claude-3-5-sonnet-20241022",
"input_price": 3000000,
"output_price": 15000000,
"cache_read_price": 300000,
"cache_write_price": 3750000
},
{
"provider": "anthropic",
"model": "claude-3-7-sonnet-20250219",
"input_price": 3000000,
"output_price": 15000000,
"cache_read_price": 300000,
"cache_write_price": 3750000
},
{
"provider": "anthropic",
"model": "claude-3-haiku-20240307",
"input_price": 250000,
"output_price": 1250000,
"cache_read_price": 30000,
"cache_write_price": 300000
},
{
"provider": "anthropic",
"model": "claude-3-opus-20240229",
"input_price": 15000000,
"output_price": 75000000,
"cache_read_price": 1500000,
"cache_write_price": 18750000
},
{
"provider": "anthropic",
"model": "claude-3-sonnet-20240229",
"input_price": 3000000,
"output_price": 15000000,
"cache_read_price": 300000,
"cache_write_price": 300000
Comment on lines -4 to -64

This comment was marked as resolved.

This comment was marked as resolved.

"model": "claude-fable-5",
"input_price": 10000000,
"output_price": 50000000,
"cache_read_price": 1000000,
"cache_write_price": 12500000
},
{
"provider": "anthropic",
Expand All @@ -81,11 +25,11 @@
},
{
"provider": "anthropic",
"model": "claude-opus-4-0",
"input_price": 15000000,
"output_price": 75000000,
"cache_read_price": 1500000,
"cache_write_price": 18750000
"model": "claude-mythos-5",
"input_price": 10000000,
"output_price": 50000000,
"cache_read_price": 1000000,
"cache_write_price": 12500000
},
{
"provider": "anthropic",
Expand All @@ -103,14 +47,6 @@
"cache_read_price": 1500000,
"cache_write_price": 18750000
},
{
"provider": "anthropic",
"model": "claude-opus-4-20250514",
"input_price": 15000000,
"output_price": 75000000,
"cache_read_price": 1500000,
"cache_write_price": 18750000
},
{
"provider": "anthropic",
"model": "claude-opus-4-5",
Expand Down Expand Up @@ -145,19 +81,11 @@
},
{
"provider": "anthropic",
"model": "claude-sonnet-4-0",
"input_price": 3000000,
"output_price": 15000000,
"cache_read_price": 300000,
"cache_write_price": 3750000
},
{
"provider": "anthropic",
"model": "claude-sonnet-4-20250514",
"input_price": 3000000,
"output_price": 15000000,
"cache_read_price": 300000,
"cache_write_price": 3750000
"model": "claude-opus-4-8",
"input_price": 5000000,
"output_price": 25000000,
"cache_read_price": 500000,
"cache_write_price": 6250000
},
{
"provider": "anthropic",
Expand All @@ -183,12 +111,20 @@
"cache_read_price": 300000,
"cache_write_price": 3750000
},
{
"provider": "anthropic",
"model": "claude-sonnet-5",
"input_price": 2000000,
"output_price": 10000000,
"cache_read_price": 200000,
"cache_write_price": 2500000
},
{
"provider": "openai",
"model": "gpt-3.5-turbo",
"input_price": 500000,
"output_price": 1500000,
"cache_read_price": 1250000,
"cache_read_price": 0,
"cache_write_price": null
},
{
Expand Down Expand Up @@ -228,7 +164,7 @@
"model": "gpt-4.1-nano",
"input_price": 100000,
"output_price": 400000,
"cache_read_price": 30000,
"cache_read_price": 25000,
"cache_write_price": null
},
{
Expand Down Expand Up @@ -268,7 +204,7 @@
"model": "gpt-4o-mini",
"input_price": 150000,
"output_price": 600000,
"cache_read_price": 80000,
"cache_read_price": 75000,
"cache_write_price": null
},
{
Expand All @@ -284,7 +220,7 @@
"model": "gpt-5-chat-latest",
"input_price": 1250000,
"output_price": 10000000,
"cache_read_price": null,
"cache_read_price": 125000,
"cache_write_price": null
},
{
Expand Down Expand Up @@ -324,7 +260,7 @@
"model": "gpt-5.1",
"input_price": 1250000,
"output_price": 10000000,
"cache_read_price": 130000,
"cache_read_price": 125000,
"cache_write_price": null
},
{
Expand Down Expand Up @@ -465,23 +401,47 @@
},
{
"provider": "openai",
"model": "o1",
"input_price": 15000000,
"output_price": 60000000,
"cache_read_price": 7500000,
"cache_write_price": null
"model": "gpt-5.6",
"input_price": 5000000,
"output_price": 30000000,
"cache_read_price": 500000,
"cache_write_price": 6250000
},
{
"provider": "openai",
"model": "o1-mini",
"input_price": 1100000,
"output_price": 4400000,
"cache_read_price": 550000,
"model": "gpt-5.6-luna",
"input_price": 1000000,
"output_price": 6000000,
"cache_read_price": 100000,
"cache_write_price": 1250000
},
{
"provider": "openai",
"model": "gpt-5.6-sol",
"input_price": 5000000,
"output_price": 30000000,
"cache_read_price": 500000,
"cache_write_price": 6250000
},
{
"provider": "openai",
"model": "gpt-5.6-terra",
"input_price": 2500000,
"output_price": 15000000,
"cache_read_price": 250000,
"cache_write_price": 3125000
},
{
"provider": "openai",
"model": "gpt-image-2",
"input_price": 5000000,
"output_price": 30000000,
"cache_read_price": 1250000,
"cache_write_price": null
},
{
"provider": "openai",
"model": "o1-preview",
"model": "o1",
"input_price": 15000000,
"output_price": 60000000,
"cache_read_price": 7500000,
Expand Down Expand Up @@ -532,7 +492,7 @@
"model": "o4-mini",
"input_price": 1100000,
"output_price": 4400000,
"cache_read_price": 280000,
"cache_read_price": 275000,
"cache_write_price": null
},
{
Expand Down
Loading
Loading