diff --git a/PROGRESS.md b/PROGRESS.md index 09efb13..ff74c2b 100644 --- a/PROGRESS.md +++ b/PROGRESS.md @@ -304,7 +304,7 @@ comparison in #132. **Counts re-measured 2026-10-05**, each by the command named, because the set here once said 100 where the workspace ran 747 and nothing had been watching: -`cargo test --all` runs **2651 passing** (core 484, dpop 29, delegation 75, gateway 1669, cloud 393, umbrella 1, by `cargo test -p `). Cache and reasoning tokens on the trace and the FOCUS export (invariant 148, 2026-11-19) add 13 to the 2638 that stood before, all in `gateway`: 9 in its library (2 in `provider`, 1 in `settle`, 1 in `sink`, 4 in `focusexport`, 1 in `constants`) and 4 in `tests/it/focus_carries_cache_and_reasoning.rs`; the 2638 is the passing total of CI run 44522578894 on the red commit, whose 4 failures are the new integration tests; CI's `stated-numbers.sh` is the measurement. A person's delegation beside the agent token (invariant 147, 2026-11-12) adds 22 to the 2616 that stood before, all in `gateway`: 11 in `chainproof::beside_agent_tests` and 11 in `tests/it` (7 in `delegation_beside_agent_token.rs`, 3 in `mcp_agent_token.rs`, 1 in `mcp_xaa.rs`), counted from the diff against main; CI's `stated-numbers.sh` is the measurement. The broker's `tools/list` narrowed to what the policy does not refuse outright (invariant 146, 2026-11-08) adds 16 to the 2599 that stood before, all in `gateway` `tests/it/broker_tools_list.rs`, counted from the diff against main; CI's `stated-numbers.sh` is the measurement. The hold and deny refusal text (2026-11-07) adds 3 to the 2590 that stood before, all in `gateway` `tests/it/mcp_broker.rs`, and the hidden-character lists and the soft-hyphen phrase tests add 6 in `core` `injection.rs`, counted from the diff against main; CI's `stated-numbers.sh` is the measurement. Usage that stops short of its final event (invariants 43 and 47, 2026-11-05) adds 46 to the 2544 of main at 6b1ef8d, all in `gateway`: 25 in its library (`provider`, `settle`, `estimate`) and 21 in `tests/it` (19 in `usage_that_stops_short.rs`, 2 in `codex_money_review.rs`), counted from CI's run of this branch before main moved, 2530 to 2576. A provider's failures as one incident (invariant 144, 2026-11-04) add 60 to the 2470 below: 9 in `gateway::providerreport`, 3 in `gateway::proxy` and 48 in `tests/it/provider_failures.rs` (cloud), counted from the diff against main; this branch was not run locally, and CI's `stated-numbers.sh` is the measurement. A label from the act (invariant 143, 2026-11-04) adds 39 to the 2431 below: 4 in `core::taint`, 2 in `gateway::streamgate`, 5 in `gateway::observedact`, 6 in `gateway::mcpbroker`, 19 in `tests/it/observed_act.rs` and 3 in `tests/it/broker_needs_its_own_key.rs`, counted from the diff against main; CI's `stated-numbers.sh` is the measurement. The report of a refusal at the require door (invariant 105, 2026-10-28) adds 8 to the 2423 below, all in `tests/it/refused_key_on_the_bus.rs`, counted from the diff against main; this branch was not run locally, and CI's `stated-numbers.sh` is the measurement. The refusal of a keyryx statement with no signatures (2026-10-26) adds 1 to the 2421 below, in `gateway::checkpoints`, counted from the diff against main; CI's `stated-numbers.sh` is the measurement. The refusal of a message the MCP broker cannot judge (invariant 142, 2026-10-26) adds 4 to the 2417 below, all in `tests/it/mcp_broker.rs`, counted from the diff against main; this branch was not run locally, and CI's `stated-numbers.sh` is the measurement. The p256 0.14 upgrade (2026-10-26) adds 3 RFC 6979 vector tests to the 2414 below: 1 in `gateway::checkpoints` and 2 in `cloud` (`devices`, `audit_sign`). @measured `cargo test --all --no-fail-fast` on that branch, 2026-10-26 as root: 2415 passed and the two tests that need a 0500 directory failed, as invariant 78 records; both passed when their binaries were run again under `setpriv` with `dac_override` and `dac_read_search` dropped. Per binary: core 460 lib and 9 integration, cloud 205 lib and 140 integration, gateway 995 lib and 503 integration, dpop 29, delegation 75, umbrella 1. The door origin lists (invariant 141, 2026-10-19) add 23 to the 2391 below, counted from the diff against main and not measured again here: 6 in `dpop::origin`, 1 in `gateway::chainproof`, and 16 in `tests/it` (8 in `delegation_origins`, 8 in `mcp_door`). @measured `cargo test --all --no-fail-fast` on this branch after merging origin/main (8ed7744, PR #468 merged), 2026-10-19 as root: 2389 passed and 2 failed. The two failures are the tests that need a 0500 directory (`events_export_startup`, `events::tests::an_unwritable_directory_is_named_at_warn_and_the_export_is_off`), which invariant 78 records as root-only; as any other user they pass, so the CI figure is 2391. The breakdown counts the same binaries per crate: core 460 lib and 9 integration, cloud 203 lib and 140 integration, gateway 993 lib and 487 integration (the root-only test counted in the lib figure), dpop 23, delegation 75, umbrella 1. Against main's 2364 the branch adds 27: the static-key allow-list and the agent token to the policy plane (invariants 138 to 140) add 26 to `gateway`, 11 in `gateway::agenttoken` and `wardryx` and 15 in `tests/it` (`static_key_allow_list`, `static_key_allow_list_startup`, `mcp_agent_token`); the identity-source cache key adds 1 in `gateway::wardryx`, and the governed wide-bind agreement of invariant 137 adds 1 in `tests/it/static_key_allow_list_startup`. The governed profile of invariants 136 and 137 is already in main's figure and is not counted here. The governed profile (invariant 136, 2026-10-19) adds 29 to `gateway`: 8 in `defaults`, 3 in `adminkeys` and 18 in `tests/it/governed_profile.rs`. Its broker and no-mode firewall follow-up adds 11 more: 7 in `tests/it/governed_profile_scope.rs`, 3 in `firewall::absent_mode_tests` and 1 in `defaults`. Earlier totals quoted in this section are dated history of how each count grew, not the current figure. The CORS allow-list, the digested device credentials and org keys, and the dashboard's fragment key (invariants 131 to 133) add 28 to `cloud`, all new tests, counted from the diff against main. The CORS allow-list, the digested device credentials and org keys, and the dashboard's +`cargo test --all` runs **2652 passing** (core 484, dpop 29, delegation 75, gateway 1670, cloud 393, umbrella 1, by `cargo test -p `). Cache and reasoning tokens on the trace and the FOCUS export (invariant 148, 2026-11-19) add 13 to the 2638 that stood before, all in `gateway`: 9 in its library (2 in `provider`, 1 in `settle`, 1 in `sink`, 4 in `focusexport`, 1 in `constants`) and 4 in `tests/it/focus_carries_cache_and_reasoning.rs`; the 2638 is the passing total of CI run 44522578894 on the red commit, whose 4 failures are the new integration tests; CI's `stated-numbers.sh` is the measurement. A person's delegation beside the agent token (invariant 147, 2026-11-12) adds 22 to the 2616 that stood before, all in `gateway`: 11 in `chainproof::beside_agent_tests` and 11 in `tests/it` (7 in `delegation_beside_agent_token.rs`, 3 in `mcp_agent_token.rs`, 1 in `mcp_xaa.rs`), counted from the diff against main; CI's `stated-numbers.sh` is the measurement. The broker's `tools/list` narrowed to what the policy does not refuse outright (invariant 146, 2026-11-08) adds 16 to the 2599 that stood before, all in `gateway` `tests/it/broker_tools_list.rs`, counted from the diff against main; CI's `stated-numbers.sh` is the measurement. The hold and deny refusal text (2026-11-07) adds 3 to the 2590 that stood before, all in `gateway` `tests/it/mcp_broker.rs`, and the hidden-character lists and the soft-hyphen phrase tests add 6 in `core` `injection.rs`, counted from the diff against main; CI's `stated-numbers.sh` is the measurement. Usage that stops short of its final event (invariants 43 and 47, 2026-11-05) adds 46 to the 2544 of main at 6b1ef8d, all in `gateway`: 25 in its library (`provider`, `settle`, `estimate`) and 21 in `tests/it` (19 in `usage_that_stops_short.rs`, 2 in `codex_money_review.rs`), counted from CI's run of this branch before main moved, 2530 to 2576. A provider's failures as one incident (invariant 144, 2026-11-04) add 60 to the 2470 below: 9 in `gateway::providerreport`, 3 in `gateway::proxy` and 48 in `tests/it/provider_failures.rs` (cloud), counted from the diff against main; this branch was not run locally, and CI's `stated-numbers.sh` is the measurement. A label from the act (invariant 143, 2026-11-04) adds 39 to the 2431 below: 4 in `core::taint`, 2 in `gateway::streamgate`, 5 in `gateway::observedact`, 6 in `gateway::mcpbroker`, 19 in `tests/it/observed_act.rs` and 3 in `tests/it/broker_needs_its_own_key.rs`, counted from the diff against main; CI's `stated-numbers.sh` is the measurement. The report of a refusal at the require door (invariant 105, 2026-10-28) adds 8 to the 2423 below, all in `tests/it/refused_key_on_the_bus.rs`, counted from the diff against main; this branch was not run locally, and CI's `stated-numbers.sh` is the measurement. The refusal of a keyryx statement with no signatures (2026-10-26) adds 1 to the 2421 below, in `gateway::checkpoints`, counted from the diff against main; CI's `stated-numbers.sh` is the measurement. The refusal of a message the MCP broker cannot judge (invariant 142, 2026-10-26) adds 4 to the 2417 below, all in `tests/it/mcp_broker.rs`, counted from the diff against main; this branch was not run locally, and CI's `stated-numbers.sh` is the measurement. The p256 0.14 upgrade (2026-10-26) adds 3 RFC 6979 vector tests to the 2414 below: 1 in `gateway::checkpoints` and 2 in `cloud` (`devices`, `audit_sign`). @measured `cargo test --all --no-fail-fast` on that branch, 2026-10-26 as root: 2415 passed and the two tests that need a 0500 directory failed, as invariant 78 records; both passed when their binaries were run again under `setpriv` with `dac_override` and `dac_read_search` dropped. Per binary: core 460 lib and 9 integration, cloud 205 lib and 140 integration, gateway 995 lib and 503 integration, dpop 29, delegation 75, umbrella 1. The door origin lists (invariant 141, 2026-10-19) add 23 to the 2391 below, counted from the diff against main and not measured again here: 6 in `dpop::origin`, 1 in `gateway::chainproof`, and 16 in `tests/it` (8 in `delegation_origins`, 8 in `mcp_door`). @measured `cargo test --all --no-fail-fast` on this branch after merging origin/main (8ed7744, PR #468 merged), 2026-10-19 as root: 2389 passed and 2 failed. The two failures are the tests that need a 0500 directory (`events_export_startup`, `events::tests::an_unwritable_directory_is_named_at_warn_and_the_export_is_off`), which invariant 78 records as root-only; as any other user they pass, so the CI figure is 2391. The breakdown counts the same binaries per crate: core 460 lib and 9 integration, cloud 203 lib and 140 integration, gateway 993 lib and 487 integration (the root-only test counted in the lib figure), dpop 23, delegation 75, umbrella 1. Against main's 2364 the branch adds 27: the static-key allow-list and the agent token to the policy plane (invariants 138 to 140) add 26 to `gateway`, 11 in `gateway::agenttoken` and `wardryx` and 15 in `tests/it` (`static_key_allow_list`, `static_key_allow_list_startup`, `mcp_agent_token`); the identity-source cache key adds 1 in `gateway::wardryx`, and the governed wide-bind agreement of invariant 137 adds 1 in `tests/it/static_key_allow_list_startup`. The governed profile of invariants 136 and 137 is already in main's figure and is not counted here. The governed profile (invariant 136, 2026-10-19) adds 29 to `gateway`: 8 in `defaults`, 3 in `adminkeys` and 18 in `tests/it/governed_profile.rs`. Its broker and no-mode firewall follow-up adds 11 more: 7 in `tests/it/governed_profile_scope.rs`, 3 in `firewall::absent_mode_tests` and 1 in `defaults`. Earlier totals quoted in this section are dated history of how each count grew, not the current figure. The CORS allow-list, the digested device credentials and org keys, and the dashboard's fragment key (invariants 131 to 133) add 28 to `cloud`, all new tests, counted from the diff against main. The CORS allow-list, the digested device credentials and org keys, and the dashboard's fragment key (invariants 131 to 133) add 28 to `cloud`, all of them new tests: 9 in its library and 19 in `tests/it` (8 CORS, 2 startup refusal, 7 device credentials, nonces and the restart second, 2 dashboard), counted from the diff against main (2276, so 2304). @measured `cargo test --all --no-fail-fast` diff --git a/README.md b/README.md index 32e00f2..7313fcc 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ > The kill-switch isn't a dashboard button you press after the fact - it's an HTTP 402 the gateway returns mid-run, before the provider bills you. ![release](https://img.shields.io/badge/release-v1.25.0-brightgreen) -![tests](https://img.shields.io/badge/tests-2651-brightgreen) +![tests](https://img.shields.io/badge/tests-2652-brightgreen) ![image](https://img.shields.io/badge/ghcr.io-tokenfuse-blue?logo=docker) ![license](https://img.shields.io/badge/license-Apache--2.0-blue) ![core](https://img.shields.io/badge/core-Rust-orange) diff --git a/contracts/tokenfuse-constants.json b/contracts/tokenfuse-constants.json index c73ce80..fe6992d 100644 --- a/contracts/tokenfuse-constants.json +++ b/contracts/tokenfuse-constants.json @@ -1202,6 +1202,22 @@ "model": "gpt-6.1-terra", "output_per_mtok_microusd": 5000000 }, + { + "cache_read_per_mtok_microusd": 400000, + "cache_write_1h_per_mtok_microusd": 10000000, + "cache_write_per_mtok_microusd": 10000000, + "input_per_mtok_microusd": 8000000, + "model": "gpt-6.2-astra", + "output_per_mtok_microusd": 40000000 + }, + { + "cache_read_per_mtok_microusd": 100000, + "cache_write_1h_per_mtok_microusd": 2500000, + "cache_write_per_mtok_microusd": 2500000, + "input_per_mtok_microusd": 2000000, + "model": "gpt-6.2-sol", + "output_per_mtok_microusd": 10000000 + }, { "cache_read_per_mtok_microusd": 550000, "cache_write_1h_per_mtok_microusd": 11000000, @@ -1370,6 +1386,22 @@ "model": "openai/gpt-6.1-terra", "output_per_mtok_microusd": 5000000 }, + { + "cache_read_per_mtok_microusd": 400000, + "cache_write_1h_per_mtok_microusd": 10000000, + "cache_write_per_mtok_microusd": 10000000, + "input_per_mtok_microusd": 8000000, + "model": "openai/gpt-6.2-astra", + "output_per_mtok_microusd": 40000000 + }, + { + "cache_read_per_mtok_microusd": 100000, + "cache_write_1h_per_mtok_microusd": 2500000, + "cache_write_per_mtok_microusd": 2500000, + "input_per_mtok_microusd": 2000000, + "model": "openai/gpt-6.2-sol", + "output_per_mtok_microusd": 10000000 + }, { "cache_read_per_mtok_microusd": 7500000, "cache_write_1h_per_mtok_microusd": 15000000, diff --git a/crates/gateway/src/pricebook.rs b/crates/gateway/src/pricebook.rs index ac648e0..84a1e09 100644 --- a/crates/gateway/src/pricebook.rs +++ b/crates/gateway/src/pricebook.rs @@ -426,6 +426,20 @@ const OPENAI: &[(&str, Rates, Option)] = &[ (1_000_000, 5_000_000, 50_000, 1_250_000, 1_250_000), Some((2_000_000, 7_500_000, 100_000, 2_500_000, 2_500_000)), ), + // Read 2026-11-22, Standard tier: gpt-6.2-astra 8 / 40, cached 0.40, 30m + // write 10; gpt-6.2-sol 2 / 10, cached 0.10, 30m write 2.50. The page + // states no prompt-length tier for either, so neither carries one (the + // "12h write" column is not the 1-hour column here, as above). + ( + "gpt-6.2-astra", + (8_000_000, 40_000_000, 400_000, 10_000_000, 10_000_000), + None, + ), + ( + "gpt-6.2-sol", + (2_000_000, 10_000_000, 100_000, 2_500_000, 2_500_000), + None, + ), ( "gpt-6-sol", (2_000_000, 10_000_000, 200_000, 2_500_000, 2_500_000), @@ -1084,6 +1098,17 @@ mod tests { "gpt-6.1-terra", (1_000_000, 5_000_000, 50_000, 1_250_000, 1_250_000), ), + // Read 2026-11-22: gpt-6.2-astra 8 / 40, cached 0.40, 30m write 10; + // gpt-6.2-sol 2 / 10, cached 0.10, 30m write 2.50. The page states + // no prompt-length tier for either. + ( + "gpt-6.2-astra", + (8_000_000, 40_000_000, 400_000, 10_000_000, 10_000_000), + ), + ( + "gpt-6.2-sol", + (2_000_000, 10_000_000, 100_000, 2_500_000, 2_500_000), + ), ( "gpt-6-sol", (2_000_000, 10_000_000, 200_000, 2_500_000, 2_500_000), @@ -1384,6 +1409,44 @@ mod tests { } } + /// gpt-6.2-astra and gpt-6.2-sol are current OpenAI models (the page lists + /// both, read 2026-11-22), so each is priced at its own row and not at the + /// fallback's 15 / 75. Until then estate-gates C23 was red + /// (`c23.current-model-missing`, 2026-11-20 on) and an unlisted call to + /// either was reserved at 15 / 75. + /// + /// Written out by hand from the page's Standard table. 100000 input and + /// 10000 output: astra at 8 / 40 is 800,000 + 400,000 = 1,200,000 + /// micro-USD, sol at 2 / 10 is 200,000 + 100,000 = 300,000. The page states + /// no prompt-length tier for either, so a 300000-input call is the same + /// rate over: astra 2,400,000 + 40,000 = 2,440,000 for 1000 output, sol + /// 600,000 + 10,000 = 610,000. The OpenRouter name is the same price. + #[test] + fn gpt_6_2_astra_and_sol_are_priced_at_their_own_rows_not_the_fallback() { + let book = default_price_book(); + let short = Usage { + input_tokens: 100_000, + output_tokens: 10_000, + ..Default::default() + }; + let long = Usage { + input_tokens: 300_000, + output_tokens: 1_000, + ..Default::default() + }; + for (model, short_cost, long_cost) in [ + ("gpt-6.2-astra", 1_200_000, 2_440_000), + ("gpt-6.2-sol", 300_000, 610_000), + ] { + for id in [model.to_string(), format!("openai/{model}")] { + assert!(book.is_known(&id), "{id}"); + assert_eq!(book.cost(&id, &short), Some(Microusd(short_cost)), "{id}"); + assert_eq!(book.cost(&id, &long), Some(Microusd(long_cost)), "{id}"); + assert!(book.long_context(&id).is_none(), "{id} states no tier"); + } + } + } + /// A model nobody has priced still says so: no invented row, the /// conservative fallback, and `is_known` false (which is what makes the /// gateway answer `x-fuse-price: fallback`).