Repository navigation
Description
Problem
The price table of the project has no price for deepseek-v4.1-flash-1017, the model that runs the whole Service now. The spend counters record 0 for it (the counter also skips tokens priced as local, #3665). Agents had to estimate DeepSeek cost by tokens at assumed prices (0.30 USD per million input and 1.20 per million output, not verified), so devops ai cost, the spend alerts and the per-item cost figures cannot show the real cost of the Service.
What to do
- Find the real price of
deepseek-v4.1-flash-1017as OpenRouter bills it through the gateway: input, cached input, output (OpenRouter model page and the account activity page). - Put the price where the project reads prices: the price table or
ai.price_overrides(feat(ai): a setting holds the price of a reference model #4258), whichever the project rule says. A hand-set value in the live ConfigMap is a person's step; state the exact lines. - Check that the counters then show DeepSeek spend (
devops_cli_ai_spend_usd_total), and that the daily alert thresholds (ClaudeSpendDailyHigh at 15 USD, HostedSpendDailyHigh at 25 USD) still fit. - Check the same for the other hosted models in use (Jev through the pass-through is tracked in feat(ai): record the cost of Jev calls that pass through the gateway #4296).
Done when
A DeepSeek call through the gateway adds its cost to the counter and to devops ai cost, with a test that fails if the model has no price.
Related: #3665, #4258, #4296, #4387.
Proposed design
Problem statement
The project prices a gateway call at the deployment model that the gateway names. The price table (genai-prices) holds no deepseek-v4.1-flash-1017 snapshot, so every DeepSeek call that runs the Service adds $0 to devops_cli_ai_spend_usd_total and to devops ai cost, and the spend alerts cannot see it. The gateway config already holds the OpenRouter :floor price (0.05 USD input, 0.192 USD output and 0.008 USD cached input per million tokens), but the client never reads it. The change adds that price to ai.price_overrides under the deployment-model key deepseek-v4.1-flash-1017:floor in the ConfigMap template, with a test that fails when a hosted gateway group has no price. OpenRouter can skip the cheapest fp8 provider, so the client figure can read low; the account-activity check stays a separate verification.
Acceptance criteria
Requirement: DeepSeek price override
The ConfigMap template k8s/devops/configmap.example.yaml SHALL hold an ai.price_overrides entry for deepseek-v4.1-flash-1017:floor with 0.05 USD prompt and 0.192 USD completion per million tokens.
Scenario: Rendered template prices the DeepSeek group
- WHEN the active ConfigMap is rendered from the template with the Service settings
- THEN
ai.price_overridesholdsdeepseek-v4.1-flash-1017:floorwith 0.05 prompt and 0.192 completion USD per million tokens.
Requirement: Override matches the gateway
The DeepSeek entry in ai.price_overrides SHALL hold the same input and output rates as the deepseek-v4.1-flash-1017 deployment in k8s/llm/gateway/config.yaml.
Scenario: Gateway and client prices agree
- WHEN the rendered
ai.price_overridesand the DeepSeek deployment'sinput_cost_per_tokenandoutput_cost_per_tokenare read - THEN both pairs convert to 0.05 USD input and 0.192 USD output per million tokens.
Requirement: Missing price fails the test
A test MUST fail when a hosted group that the Service uses has no price from genai-prices or ai.price_overrides.
Scenario: Unpriced hosted group
- WHEN the gateway config lists a hosted group whose deployment model neither genai-prices nor the rendered
ai.price_overridesprices - THEN the test fails and its message names the group and the deployment model.
Requirement: DeepSeek spend counter
A DeepSeek call through the gateway SHALL add its priced cost to devops_cli_ai_spend_usd_total.
Scenario: Priced hosted call
- WHEN a reply names
openrouter/deepseek/deepseek-v4.1-flash-1017:floorand no backend, and the call used 1,000,000 prompt and 1,000,000 completion tokens - THEN the recorded cost is 0.242 USD with source
settings:ai.price_overrides, and the counter adds 0.242 withmodel="deepseek-v4.1-flash-1017".
Requirement: Cost report
devops ai cost SHALL show the DeepSeek spend of the reported period.
Scenario: Cost report after a DeepSeek call
- WHEN
devops ai costreads a ledger with the priced DeepSeek call - THEN the report lists
deepseek-v4.1-flash-1017with a non-zero cost.
Requirement: Daily alert thresholds
The daily spend alert rules SHALL keep ClaudeSpendDailyHigh at 15 USD and HostedSpendDailyHigh at 25 USD.
Scenario: Alert rule values
- WHEN the alert rule file is read
- THEN
ClaudeSpendDailyHighholds 15 andHostedSpendDailyHighholds 25.
Requirement: Recorded price and source
The comment above ai.price_overrides in the template SHALL give the DeepSeek deployment model, its 0.05 input and 0.192 output rates, and the OpenRouter :floor fp8 source.
Scenario: Template comment
- WHEN the template is read
- THEN the comment names
deepseek-v4.1-flash-1017:floor, 0.05, 0.192 and the OpenRouter:floorfp8 route.
Existing Tool Considered
genai-prices 0.1.13 (pyproject.toml:51), the open, maintained price library the project already uses, prices every model it knows, but it holds no deepseek-v4.1-flash-1017 snapshot, and the ai.price_overrides setting that covers a model it does not know holds only prompt and completion rates, not the cached-input rate. LiteLLM's model cost map in the pinned gateway image also lists no -1017 snapshot (k8s/llm/gateway/config.yaml:181). The change adds one ai.price_overrides entry and builds no pricing code.
Key questions
- What price does OpenRouter bill for
deepseek-v4.1-flash-1017per million tokens: input, cached input and output?: OpenRouter's endpoints record that the project saved for the:floorfp8 route gives 0.05 USD input, 0.008 USD cached input and 0.192 USD output per million tokens. The gateway sets the same three rates ink8s/llm/gateway/config.yaml. A web search for the-1017model page returned no OpenRouter page, so the public page and the account activity are not verified here. The 0.30 and 1.20 USD in the issue are the public list price of the base model, not the price that the:floorroute bills. [sources: openspec/changes/archive/2026-11-02-3144-deepseek-through-openrouter/proposal.md:12, k8s/llm/gateway/config.yaml:195, k8s/llm/gateway/config.yaml:196, k8s/llm/gateway/config.yaml:197, openspec/changes/archive/2026-11-05-3573-implement-with-deepseek/proposal.md:42] - Where does the project read the DeepSeek price: the built-in price table or
ai.price_overrides?:ai.price_overrides, owned ink8s/devops/configmap.example.yamland applied to the livedevops-cli-config. genai-prices is the built-in table and holds nodeepseek-v4.1-flash-1017snapshot; the project rule says a model genai-prices does not know is priced byai.price_overrides, which is versioned and tested. (best practice) [sources: docs/CONFIGURATION.md:206, openspec/changes/archive/2026-11-09-4242-a-setting-holds-the-price-of/proposal.md:9, openspec/changes/archive/2026-11-05-3656-hosted-gateway-priced-local/proposal.md:13, k8s/devops/configmap.example.yaml:38, pyproject.toml:51]- Chosen:
ai.price_overridesin the ConfigMap template. The project rule for a model genai-prices does not know; the entry is versioned with the code, the test covers it, and every deployment reads the same values. - Rejected: genai-prices bundled or custom snapshot. genai-prices is an external package and holds no
-1017entry; the upstream base-model price (0.0352 to 0.0448 USD input and 0.08 USD output per million) is not the group's price, so a lookup by the base name would misprice the calls. - Rejected: Live ConfigMap only. A hand-set live value needs a person, has no test, and can differ from the template; the repository would not own the price.
- Chosen:
- Which model name does the price lookup use: the route name
deepseek-v4.1-flash-1017or the model that the gateway names?: The deployment model that the gateway names inx-litellm-model-name,openrouter/deepseek/deepseek-v4.1-flash-1017:floor. The registry strips the provider prefix and matches the override keydeepseek-v4.1-flash-1017:floor; themodellabel of the counter stays the asked namedeepseek-v4.1-flash-1017. [sources: docs/TELEMETRY.md:79, src/devops_cli/ai/spend/pricing.py:625, src/devops_cli/ai/spend/pricing.py:149, src/devops_cli/ai/spend/pricing.py:493, openspec/specs/ai-spend-pricing/spec.md:184] - Does the project price table hold a cached-input rate?: No.
ModelPricingholds onlyprompt_usd_per_millionandcompletion_usd_per_million, and the client does not split cache-read tokens from prompt tokens. The override prices every prompt token at 0.05 USD per million, so a cached prompt reads high, not low. The gateway's own cost map keeps the 0.008 USD per million cached-input rate for its own accounting. [sources: src/devops_cli/ai/spend/models.py:20, src/devops_cli/ai/spend/models.py:25, k8s/llm/gateway/config.yaml:197] - Do the daily alert thresholds still fit after the DeepSeek price is added?: Yes, keep
ClaudeSpendDailyHighat 15 USD andHostedSpendDailyHighat 25 USD. The rules sum the counter over 24 hours; the highest normal day is 5.59 USD and a failed Sonnet burst is about 21 USD per hour, so both values sit between them. The DeepSeek rates (0.05 and 0.192) are about 40 times lower than Sonnet's (2 and 10), so the priced DeepSeek calls do not approach either threshold. (best practice) [sources: k8s/README.md:515, k8s/README.md:516, k8s/monitoring/prometheus-values.yaml:1029, k8s/monitoring/prometheus-values.yaml:1036, k8s/monitoring/prometheus-values.yaml:1045]- Chosen: Keep 15 and 25 USD. The recorded thresholds sit between the highest normal day (5.59 USD) and a failed burst (about 21 USD per hour), and DeepSeek is far cheaper than Sonnet.
- Rejected: Lower both thresholds. There is no month of priced DeepSeek data yet, and a lower value would fire on a normal day.
- Rejected: Raise both thresholds. A failed Sonnet burst of about 21 USD per hour must still fire.
- Does this issue also price the other hosted models, such as Jev through the pass-through?: It adds no price for the other gateway groups: genai-prices already prices
gemini-3.8-flash,claude-sonnet-5-5andclaude-haiku-5-5at the gateway's rates, and the new missing-price test covers them. Jev is out of scope: its pass-through is not a gateway group, and feat(ai): record the cost of Jev calls that pass through the gateway #4296 tracks its cost. (best practice) [sources: SECURITY.md:40, tests/ai/spend/test_ai_spend_pricing.py:790, openspec/changes/archive/2026-11-05-3656-hosted-gateway-priced-local/proposal.md:18]- Chosen: DeepSeek only, with a coverage test over every hosted group. The other three gateway groups are already priced by genai-prices; the test confirms them and catches a future unpriced group, and Jev stays in feat(ai): record the cost of Jev calls that pass through the gateway #4296.
- Rejected: Add a price override for every hosted group. It duplicates genai-prices and the gateway prices and widens the change.
- Rejected: Include Jev in this issue. The pass-through billing path differs and feat(ai): record the cost of Jev calls that pass through the gateway #4296 owns it.
Fit
Fits in one pull request.
Suspected block
None.
Dependencies
None.
Activity
dan-petty commentedon Nov 10, 2026
Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.
fixprefix of the title gives the type.(ai)scope of the title gives the scope.Cost reporting for the Service's main model is wrong, but the Service still functions.Accurate spend data is needed for alerts and budget decisions, but the Service does not break without it.Finding one price and adding it to the table or overrides is a small change.Both items fix DeepSeek calls recorded at $0, but #3656 fixes the local-vs-hosted classification while the candidate adds the missing price entry.devops-cli-service commentedon Nov 10, 2026
Status set to Ready at 9bb67a0 (see proposed design in issue body).
Moved to new items: #4422, #4423.
devops-cli-service commentedon Nov 11, 2026
Released in v0.111.0: https://github.com/dan-petty/devops-cli/releases/tag/v0.111.0
devops-cli-service commentedon Nov 11, 2026
Live since 2026-11-11 05:46 UTC
fix(ai): price cached prompt tokens of chat calls (#4584)