Skip to content

g1t/services/billing/migrations/0041_agent_rate_own_key.sql

26 lines1,918 bytesCodeBlame

Pick any line to see why it is the way it is: the commit, the pull request and issue it came from, and what the agent was thinking.

Merge branch 'model-routing'1-- The g1t agent rate on runs that use a workspace's own model key.
2--
3-- Runs on a workspace's own provider pay the provider for the model, and
4-- were charged nothing by g1t but their sandbox time: billing never saw
5-- their tokens. The model proxy counts them now (under the run's model
6-- session, kept on `runs.session_id` for these runs too), and the sandbox
7-- reports what its harness counted. The agent rate is charged on them, on
8-- a meter of its own so it is priced and shown apart:
9--
10-- - `agent_tokens_own`: $0.25 per million tokens (input, output and
11-- cached), the same as on g1t's models. The model itself is never
12-- charged: the workspace pays its provider. New, so a rise from nothing:
13-- it takes effect after the 14 days' notice (2026-10-22), and owners on
14-- the plan are emailed once (`tell_owners_of_rises`).
15--
16-- Its ledger lines are `<run>/agent-own` (later `<run>/agent-own/<tokens>`),
17-- named "Agent rate, your own model key" on Usage and the statement.
18
19INSERT OR IGNORE INTO prices (meter, title, unit, cost_micros, markup_percent, source, updated_at) VALUES
20 ('agent_tokens_own', 'g1t agent rate, your own model key', 'million tokens', 0, 0, 'list', '2026-10-08T00:00:00Z');
21
22INSERT OR IGNORE INTO price_versions (id, meter, version, cost_micros, markup_percent, effective_at, reason, created_by, created_at, applied_at) VALUES
23 ('pv_agent_tokens_own_1', 'agent_tokens_own', 1, 0, 0, '2026-10-08T00:00:00Z',
24 'The g1t agent rate on your own model key, not charged yet', 'migration', '2026-10-08T00:00:00Z', '2026-10-08T00:00:00Z'),
25 ('pv_agent_tokens_own_2', 'agent_tokens_own', 2, 250000, 0, '2026-10-22T00:00:00Z',
26 'New: $0.25 per million tokens an agent''s run uses on your own model key (input, output and cached), for context, memory, routing and orchestration; the model itself stays between you and your provider', 'migration', '2026-10-08T00:00:00Z', NULL);

This file's history is long; its oldest lines are credited to the oldest commit read.