Page actions
instrument mechanism / verified-clean
Token / Context-Window Cost Calculator mechanism
The inspectable method record for Token / Context-Window Cost Calculator, kept separate from implementation and qualification.
Model scope
The core arithmetic is standard under the stated unit assumptions, but the specification needs review because it does not define price units, whether context usage includes expected output, or the meaning of cost per 1K/1M tokens. The bundled table must visibly show an as-of date and refresh link; the honest label should state that prices are dated at bundling time and must be verified against the provider's current pricing page before financial decisions.
- The cost formula is correct only when price_in and price_out are expressed in currency per token. Provider tables commonly express prices per 1M tokens, so the implemented formula must explicitly divide each token count by 1,000,000 before multiplying by the corresponding price.
- context_used% is normally (input_tokens + output_tokens) / context_window_tokens × 100, but the specification writes tokens/context_window and does not explicitly define whether tokens means input only, input plus expected output, or the provider's total serialized context.
- The outputs 'cost per 1K/1M tokens' are underspecified: they should separately report input and output rates, and optionally a clearly labeled blended effective rate. A single unlabeled rate would be misleading.
- The formula does not state nonnegative-integer constraints for token counts or require input_tokens + output_tokens to be no greater than the model context window.
- The calculation omits provider-specific pricing modifiers such as cached-input rates, batch discounts, regional pricing, tiered rates, tool or image charges, taxes, and minimum billing units. It is therefore an estimate, not necessarily the final invoice amount.
Units and conventions
- input_tokens and expected_output_tokens are counts of tokens, dimensionless nonnegative integers.
- The reference prices below are US dollars per 1,000,000 tokens; cost arithmetic converts token counts by dividing by 1,000,000.
- context_window_tokens is a token-count limit, and context_used_percent uses input_tokens + expected_output_tokens as the numerator.
- The reported per-1K and per-1M prices are separate input and output rates, not a blended rate.
- A single-call request is assumed; system messages, conversation history, tool definitions, and other serialized prompt content must already be included in input_tokens.
Inspectable vector
One of 4 source-bound review vectors:
{
"inputs": {
"model": "gpt-4o",
"input_tokens": 1000,
"expected_output_tokens": 500
},
"expected_outputs": {
"total_tokens": 1500,
"estimated_cost_usd": 0.0125,
"context_used_percent": 1.171875,
"context_limit_exceeded": false,
"input_cost_per_1K_tokens_usd": 0.005,
"output_cost_per_1K_tokens_usd": 0.015,
"input_cost_per_1M_tokens_usd": 5,
"output_cost_per_1M_tokens_usd": 15
},
"reference_data": {
"model": "gpt-4o",
"context_window_tokens": {
"value": 128000,
"source_convention": "OpenAI official model/pricing documentation, as of 2025-02-01, https://openai.com/api/pricing/"
},
"input_price_usd_per_1M_tokens": {
"value": 5,
"source_convention": "OpenAI official pricing page, as of 2025-02-01, https://openai.com/api/pricing/"
},
"output_price_usd_per_1M_tokens": {
"value": 15,
"source_convention": "OpenAI official pricing page, as of 2025-02-01, https://openai.com/api/pricing/"
}
},
"working": "Total tokens = 1,000 + 500 = 1,500. Input cost = (1,000 / 1,000,000) × $5.00 = 0.001 × 5.00 = $0.0050. Output cost = (500 / 1,000,000) × $15.00 = 0.0005 × 15.00 = $0.0075. Total cost = $0.0050 + $0.0075 = $0.0125. Context use = (1,500 / 128,000) × 100 = 1.171875%. Per-1K rates: $5.00 / 1,000 = $0.005 input and $15.00 / 1,000 = $0.015 output. The $5.00 and $15.00 per-1M entries are used exactly from the dated table."
}Failure boundary
BREAK_CLAIMED · SELF_FLAGGED
A zero-valued context window produces an undefined percentage unless explicitly rejected. The specification also does not define the context-token convention or explicitly define an operational branch for requests exceeding the context window, so different implementations can report materially different results.
Other records
Sources and evidence
These pointers bind the page to evidence. They do not grant authority or collapse verification into deployment.
VERIFIED_LEDGER.jsonevidence-tranche7/tranche7-results.jsonBOUNDARY_HAZARD_CATALOG.json