Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(ai_usage): price claude-opus-5-5 (#7625)

Wolf Mermelsteind3eead51daa1
diff --git a/crates/ai_usage/src/outbound/pg_usage_repo/test.rs b/crates/ai_usage/src/outbound/pg_usage_repo/test.rs
index e42ffcb1a8..f804623280 100644
--- a/crates/ai_usage/src/outbound/pg_usage_repo/test.rs
+++ b/crates/ai_usage/src/outbound/pg_usage_repo/test.rs
@@ -46,6 +46,16 @@ async fn seeded_pricing_is_available(pool: PgPool) {
cache_write: Some(6.25),
})
);
+ let price = repo.get_pricing("claude-opus-5-5").await.unwrap();
+ assert_eq!(
+ price,
+ Some(ModelPricing::Tokens {
+ input: 4.0,
+ output: 20.0,
+ cache_read: Some(0.2),
+ cache_write: Some(5.0),
+ })
+ );
assert_eq!(
repo.get_pricing("whisper-1").await.unwrap(),
Some(ModelPricing::Audio { per_minute: 0.006 })
diff --git a/crates/macro_db_client/migrations/20261006165207_seed_claude_opus_5_5_pricing.sql b/crates/macro_db_client/migrations/20261006165207_seed_claude_opus_5_5_pricing.sql
new file mode 100644
index 0000000000..8e8ad44f42
--- /dev/null
+++ b/crates/macro_db_client/migrations/20261006165207_seed_claude_opus_5_5_pricing.sql
@@ -0,0 +1,16 @@
+-- Seed pricing for Claude Opus 5.5 (USD per million tokens), which chat and the
+-- agent already use: its ai_usage rows recorded a NULL total without this row.
+--
+-- https://platform.claude.com/docs/en/about-claude/pricing, checked 2026-10-06:
+-- $4 base input, $20 output, $5 5m cache writes (1.25x input), $0.20 cache hits.
+-- Opus 5.5 reads are 0.05x input, not the usual 0.1x. ON CONFLICT keeps any
+-- price already set at runtime via the set_pricing endpoint.
+INSERT INTO ai_pricing (
+ model,
+ price_per_million_in,
+ price_per_million_out,
+ price_per_million_cache_read,
+ price_per_million_cache_write
+) VALUES
+ ('claude-opus-5-5', 4.0, 20.0, 0.20, 5.0)
+ON CONFLICT (model) DO NOTHING;