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
13 changes: 12 additions & 1 deletion .loom/pricing.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"schema_version": 1,
"verified_on": "2026-09-18",
"source": "https://platform.claude.com/docs/en/about-claude/pricing",
"notes": "Model rate card, USD per 1000 tokens (= the published $/MTok / 1000). Resync-delivered to .loom/pricing.json so a price change reaches the fleet without a Loom release (#8177, ask 2 of #8060). loom-daemon falls back to the compiled card in loom-daemon/src/activity/resource_usage.rs when this file is absent or fails validation, and the two are held in agreement by the shipped_pricing_asset_agrees_with_the_compiled_card test. Rows are an ORDERED cascade: the first row with a `match` substring contained in the (lowercased, alias-resolved) model id wins, exactly like the compiled card. Keep the trailing `claude-<family>-` catch-all of each family pointing at that family's NEWEST published row — an unrecognized id is far likelier to be newer than the card than to be a resurrected retired model. The Moonshot/Kimi rows (#8564) come from a SECOND vendor page, https://platform.moonshot.ai/docs/pricing/chat, verified 2026-09-22; `verified_on` above stays at the OLDER of the two dates so the staleness warning fires on whichever vendor has gone unchecked longest. Those rows are the platform API LIST price and are an estimate: a Kimi Code subscription is not billed per token, so for a subscription launch the derived cost is 'what these tokens would have cost on the API', not money that changed hands. The K2 table publishes no cache-write price, so the K2 rows' write rates are the published cache-miss input price rather than an invented surcharge. The OpenAI/Codex gpt-6 rows (#10750) come from a THIRD vendor page, https://platform.openai.com/docs/pricing (also served at https://developers.openai.com/api/docs/pricing), Standard tier, SHORT-context columns, read 2026-10-07; the 2026-09-18 `verified_on` above is still the older date. Published $/MTok (input / cached input / cache writes / output): gpt-6.1-sol 2 / 0.10 / 2.50 / 10; gpt-6-astra 10 / 1 / 12.50 / 50; gpt-6-sol 2 / 0.20 / 2.50 / 10; gpt-6-luna 0.10 / 0.01 / 0.125 / 0.50. The page publishes one cache-write price, used for both the 5m and 1h rates. These are API LIST prices and an estimate: Codex usage under a ChatGPT subscription is not billed per token. The Long-context column (higher rates above the context threshold), the Batch/Flex/Fast/Ultrafast tiers are NOT modelled (the card has no per-tier rows). There is deliberately NO trailing gpt-6 catch-all: gpt-6 variants differ up to 100x in price, so an unrecognized variant stays unpriced (and logs a WARN) rather than getting a guessed rate.",
"notes": "Model rate card, USD per 1000 tokens (= the published $/MTok / 1000). Resync-delivered to .loom/pricing.json so a price change reaches the fleet without a Loom release (#8177, ask 2 of #8060). loom-daemon falls back to the compiled card in loom-daemon/src/activity/resource_usage.rs when this file is absent or fails validation, and the two are held in agreement by the shipped_pricing_asset_agrees_with_the_compiled_card test. Rows are an ORDERED cascade: the first row with a `match` substring contained in the (lowercased, alias-resolved) model id wins, exactly like the compiled card. Keep the trailing `claude-<family>-` catch-all of each family pointing at that family's NEWEST published row — an unrecognized id is far likelier to be newer than the card than to be a resurrected retired model. The Moonshot/Kimi rows (#8564) come from a SECOND vendor page, https://platform.moonshot.ai/docs/pricing/chat, verified 2026-09-22; `verified_on` above stays at the OLDER of the two dates so the staleness warning fires on whichever vendor has gone unchecked longest. Those rows are the platform API LIST price and are an estimate: a Kimi Code subscription is not billed per token, so for a subscription launch the derived cost is 'what these tokens would have cost on the API', not money that changed hands. The K2 table publishes no cache-write price, so the K2 rows' write rates are the published cache-miss input price rather than an invented surcharge. The OpenAI/Codex gpt-6 rows (#10750) come from a THIRD vendor page, https://platform.openai.com/docs/pricing (also served at https://developers.openai.com/api/docs/pricing), Standard tier, SHORT-context columns, read 2026-10-07; the 2026-09-18 `verified_on` above is still the older date. Published $/MTok (input / cached input / cache writes / output): gpt-6.1-sol 2 / 0.10 / 2.50 / 10; gpt-6-astra 10 / 1 / 12.50 / 50; gpt-6-sol 2 / 0.20 / 2.50 / 10; gpt-6-luna 0.10 / 0.01 / 0.125 / 0.50. The earlier rows use one published cache-write rate for both write fields. The gpt-6.2-astra row (#14741) was verified 2026-11-20 against https://developers.openai.com/api/docs/pricing, Standard tier, SHORT context: $8 input, $0.40 cached input and $40 output per MTok. The published 30m write rate ($10/MTok) supplies the default estimate in both legacy write fields; the 12h rate ($20/MTok) is not modelled. These are API LIST prices and an estimate: Codex usage under a ChatGPT subscription is not billed per token. The Long-context column (higher rates above the context threshold), the Batch/Flex/Fast/Ultrafast tiers are NOT modelled (the card has no per-tier rows). There is deliberately NO trailing gpt-6 catch-all: gpt-6 variants differ up to 100x in price, so an unrecognized variant stays unpriced (and logs a WARN) rather than getting a guessed rate.",
"cache_multipliers": {
"read": 0.1,
"read_reduced": 0.025,
Expand Down Expand Up @@ -169,6 +169,17 @@
"write_1h_per_1k": 0.00095
}
},
{
"id": "gpt-6-2-astra",
"match": ["gpt-6.2-astra"],
"input_per_1k": 0.008,
"output_per_1k": 0.04,
"cache_rates": {
"read_per_1k": 0.0004,
"write_5m_per_1k": 0.01,
"write_1h_per_1k": 0.01
}
},
{
"id": "gpt-6-1-sol",
"match": ["gpt-6.1-sol"],
Expand Down
13 changes: 12 additions & 1 deletion defaults/pricing.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"schema_version": 1,
"verified_on": "2026-09-18",
"source": "https://platform.claude.com/docs/en/about-claude/pricing",
"notes": "Model rate card, USD per 1000 tokens (= the published $/MTok / 1000). Resync-delivered to .loom/pricing.json so a price change reaches the fleet without a Loom release (#8177, ask 2 of #8060). loom-daemon falls back to the compiled card in loom-daemon/src/activity/resource_usage.rs when this file is absent or fails validation, and the two are held in agreement by the shipped_pricing_asset_agrees_with_the_compiled_card test. Rows are an ORDERED cascade: the first row with a `match` substring contained in the (lowercased, alias-resolved) model id wins, exactly like the compiled card. Keep the trailing `claude-<family>-` catch-all of each family pointing at that family's NEWEST published row — an unrecognized id is far likelier to be newer than the card than to be a resurrected retired model. The Moonshot/Kimi rows (#8564) come from a SECOND vendor page, https://platform.moonshot.ai/docs/pricing/chat, verified 2026-09-22; `verified_on` above stays at the OLDER of the two dates so the staleness warning fires on whichever vendor has gone unchecked longest. Those rows are the platform API LIST price and are an estimate: a Kimi Code subscription is not billed per token, so for a subscription launch the derived cost is 'what these tokens would have cost on the API', not money that changed hands. The K2 table publishes no cache-write price, so the K2 rows' write rates are the published cache-miss input price rather than an invented surcharge. The OpenAI/Codex gpt-6 rows (#10750) come from a THIRD vendor page, https://platform.openai.com/docs/pricing (also served at https://developers.openai.com/api/docs/pricing), Standard tier, SHORT-context columns, read 2026-10-07; the 2026-09-18 `verified_on` above is still the older date. Published $/MTok (input / cached input / cache writes / output): gpt-6.1-sol 2 / 0.10 / 2.50 / 10; gpt-6-astra 10 / 1 / 12.50 / 50; gpt-6-sol 2 / 0.20 / 2.50 / 10; gpt-6-luna 0.10 / 0.01 / 0.125 / 0.50. The page publishes one cache-write price, used for both the 5m and 1h rates. These are API LIST prices and an estimate: Codex usage under a ChatGPT subscription is not billed per token. The Long-context column (higher rates above the context threshold), the Batch/Flex/Fast/Ultrafast tiers are NOT modelled (the card has no per-tier rows). There is deliberately NO trailing gpt-6 catch-all: gpt-6 variants differ up to 100x in price, so an unrecognized variant stays unpriced (and logs a WARN) rather than getting a guessed rate.",
"notes": "Model rate card, USD per 1000 tokens (= the published $/MTok / 1000). Resync-delivered to .loom/pricing.json so a price change reaches the fleet without a Loom release (#8177, ask 2 of #8060). loom-daemon falls back to the compiled card in loom-daemon/src/activity/resource_usage.rs when this file is absent or fails validation, and the two are held in agreement by the shipped_pricing_asset_agrees_with_the_compiled_card test. Rows are an ORDERED cascade: the first row with a `match` substring contained in the (lowercased, alias-resolved) model id wins, exactly like the compiled card. Keep the trailing `claude-<family>-` catch-all of each family pointing at that family's NEWEST published row — an unrecognized id is far likelier to be newer than the card than to be a resurrected retired model. The Moonshot/Kimi rows (#8564) come from a SECOND vendor page, https://platform.moonshot.ai/docs/pricing/chat, verified 2026-09-22; `verified_on` above stays at the OLDER of the two dates so the staleness warning fires on whichever vendor has gone unchecked longest. Those rows are the platform API LIST price and are an estimate: a Kimi Code subscription is not billed per token, so for a subscription launch the derived cost is 'what these tokens would have cost on the API', not money that changed hands. The K2 table publishes no cache-write price, so the K2 rows' write rates are the published cache-miss input price rather than an invented surcharge. The OpenAI/Codex gpt-6 rows (#10750) come from a THIRD vendor page, https://platform.openai.com/docs/pricing (also served at https://developers.openai.com/api/docs/pricing), Standard tier, SHORT-context columns, read 2026-10-07; the 2026-09-18 `verified_on` above is still the older date. Published $/MTok (input / cached input / cache writes / output): gpt-6.1-sol 2 / 0.10 / 2.50 / 10; gpt-6-astra 10 / 1 / 12.50 / 50; gpt-6-sol 2 / 0.20 / 2.50 / 10; gpt-6-luna 0.10 / 0.01 / 0.125 / 0.50. The earlier rows use one published cache-write rate for both write fields. The gpt-6.2-astra row (#14741) was verified 2026-11-20 against https://developers.openai.com/api/docs/pricing, Standard tier, SHORT context: $8 input, $0.40 cached input and $40 output per MTok. The published 30m write rate ($10/MTok) supplies the default estimate in both legacy write fields; the 12h rate ($20/MTok) is not modelled. These are API LIST prices and an estimate: Codex usage under a ChatGPT subscription is not billed per token. The Long-context column (higher rates above the context threshold), the Batch/Flex/Fast/Ultrafast tiers are NOT modelled (the card has no per-tier rows). There is deliberately NO trailing gpt-6 catch-all: gpt-6 variants differ up to 100x in price, so an unrecognized variant stays unpriced (and logs a WARN) rather than getting a guessed rate.",
"cache_multipliers": {
"read": 0.1,
"read_reduced": 0.025,
Expand Down Expand Up @@ -169,6 +169,17 @@
"write_1h_per_1k": 0.00095
}
},
{
"id": "gpt-6-2-astra",
"match": ["gpt-6.2-astra"],
"input_per_1k": 0.008,
"output_per_1k": 0.04,
"cache_rates": {
"read_per_1k": 0.0004,
"write_5m_per_1k": 0.01,
"write_1h_per_1k": 0.01
}
},
{
"id": "gpt-6-1-sol",
"match": ["gpt-6.1-sol"],
Expand Down
39 changes: 34 additions & 5 deletions loom-daemon/src/activity/resource_usage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ impl ModelPricing {
}

/// Build an OpenAI gpt-6 row (Issue #10750): published cached-input rate
/// and a single published cache-write rate used for both TTLs.
/// and one default write estimate stored in both of the card's TTL fields.
fn openai(
input_cost_per_1k: f64,
output_cost_per_1k: f64,
Expand Down Expand Up @@ -213,8 +213,13 @@ impl ModelPricing {
/// tokens. An API LIST-price estimate, not billed cost; long-context and
/// Batch/Flex/Fast tiers are not modelled.
///
/// The `gpt-6.2-astra` row was verified on **2026-11-20** (Issue #14741).
/// Its published 30-minute write price supplies the default estimate in
/// both legacy write fields. The 12-hour write tier is not modelled.
///
/// | Row | Input | Output | Cache read | Cache write |
/// |---|---|---|---|---|
/// | `gpt-6.2-astra` | 0.008 | 0.04 | 0.0004 | 0.01 |
/// | `gpt-6.1-sol` | 0.002 | 0.01 | 0.0001 | 0.0025 |
/// | `gpt-6-astra` | 0.01 | 0.05 | 0.001 | 0.0125 |
/// | `gpt-6-sol` | 0.002 | 0.01 | 0.0002 | 0.0025 |
Expand Down Expand Up @@ -368,10 +373,12 @@ impl ModelPricing {

// ---- OpenAI / Codex gpt-6 (Issue #10750) ----------------------------
// https://platform.openai.com/docs/pricing, Standard tier, short-context
// columns, read 2026-10-07. Published $/MTok / 1000. One cache-write
// price is published; it is used for both TTLs. No trailing `gpt-6`
// catch-all on purpose: variants differ up to 100x in price, so an
// unrecognized one stays unpriced (and WARNs) rather than guessed.
// columns, read 2026-10-07 and 2026-11-20 (6.2 Astra). Published $/MTok
// / 1000; see the rate-card docs for the write estimate. No trailing
// `gpt-6` catch-all: variants differ up to 100x in price.
if m.contains("gpt-6.2-astra") {
return Some(Self::openai(0.008, 0.04, 0.000_4, 0.01));
}
if m.contains("gpt-6.1-sol") {
return Some(Self::openai(0.002, 0.01, 0.000_1, 0.002_5));
}
Expand Down Expand Up @@ -838,6 +845,9 @@ mod tests {
/// so none of them silently falls through to the Anthropic Sonnet default.
/// OpenAI/Codex ids (Issue #10750).
const CODEX_MODEL_IDS: &[&str] = &[
"gpt-6.2-astra",
"openai/gpt-6.2-astra",
"codex/gpt-6.2-astra",
"gpt-6.1-sol",
"gpt-6-astra",
"gpt-6-sol",
Expand All @@ -860,6 +870,25 @@ mod tests {
assert!(ModelPricing::lookup("gpt-6-nova").is_none());
}

#[test]
fn gpt_6_2_astra_pricing_uses_its_own_short_context_rates() {
let previous = ModelPricing::lookup("gpt-6-astra").unwrap();
assert!((previous.input_cost_per_1k - 0.01).abs() < f64::EPSILON);
assert!((previous.output_cost_per_1k - 0.05).abs() < f64::EPSILON);
for id in [
"gpt-6.2-astra",
"openai/gpt-6.2-astra",
"codex/gpt-6.2-astra",
] {
let pricing = ModelPricing::lookup(id).unwrap();
assert!((pricing.input_cost_per_1k - 0.008).abs() < f64::EPSILON, "{id}");
assert!((pricing.output_cost_per_1k - 0.04).abs() < f64::EPSILON, "{id}");
assert!((pricing.cache_read_cost_per_1k - 0.000_4).abs() < f64::EPSILON, "{id}");
assert!((pricing.cache_write_cost_per_1k - 0.01).abs() < f64::EPSILON, "{id}");
assert!((pricing.cache_write_1h_cost_per_1k - 0.01).abs() < f64::EPSILON, "{id}");
}
}

#[test]
fn pricing_card_knows_every_kimi_model_id() {
for id in KIMI_MODEL_IDS {
Expand Down
4 changes: 4 additions & 0 deletions loom-daemon/tests/model_pricing_card.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ const CASES: &[&str] = &[
"claude-fable-5",
"claude-haiku-4-5",
"claude-haiku-4-5-20251001",
"gpt-6-astra",
"gpt-6.2-astra",
"openai/gpt-6.2-astra",
"codex/gpt-6.2-astra",
"mystery",
];

Expand Down
Loading