Skip to content

fix(ai): price the DeepSeek models in the price table #4403

Closed

Description

@dan-petty

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

  1. Find the real price of deepseek-v4.1-flash-1017 as OpenRouter bills it through the gateway: input, cached input, output (OpenRouter model page and the account activity page).
  2. 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.
  3. 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.
  4. 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_overrides holds deepseek-v4.1-flash-1017:floor with 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_overrides and the DeepSeek deployment's input_cost_per_token and output_cost_per_token are 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_overrides prices
  • 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:floor and 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 with model="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 cost reads a ledger with the priced DeepSeek call
  • THEN the report lists deepseek-v4.1-flash-1017 with 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 ClaudeSpendDailyHigh holds 15 and HostedSpendDailyHigh holds 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 :floor fp8 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-1017 per million tokens: input, cached input and output?: OpenRouter's endpoints record that the project saved for the :floor fp8 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 in k8s/llm/gateway/config.yaml. A web search for the -1017 model 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 :floor route 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 in k8s/devops/configmap.example.yaml and applied to the live devops-cli-config. genai-prices is the built-in table and holds no deepseek-v4.1-flash-1017 snapshot; the project rule says a model genai-prices does not know is priced by ai.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_overrides in 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 -1017 entry; 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.
  • Which model name does the price lookup use: the route name deepseek-v4.1-flash-1017 or the model that the gateway names?: The deployment model that the gateway names in x-litellm-model-name, openrouter/deepseek/deepseek-v4.1-flash-1017:floor. The registry strips the provider prefix and matches the override key deepseek-v4.1-flash-1017:floor; the model label of the counter stays the asked name deepseek-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. ModelPricing holds only prompt_usd_per_million and completion_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 ClaudeSpendDailyHigh at 15 USD and HostedSpendDailyHigh at 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-5 and claude-haiku-5-5 at 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]

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/bug
    scope/ai
    status/new
    value/medium
    effort/low
    on Nov 10, 2026
  2. dan-petty commented on Nov 10, 2026

    @dan-petty
    OwnerAuthor

    Intake placed this item to the backlog: intake puts every new item in the backlog. A person plans the milestones.

    • Type: type/bug. The fix prefix of the title gives the type.
    • Scope: scope/ai. The (ai) scope of the title gives the scope.
    • Priority: P2-Medium. Cost reporting for the Service's main model is wrong, but the Service still functions.
    • Value: Medium. Accurate spend data is needed for alerts and budget decisions, but the Service does not break without it.
    • Effort: Low. Finding one price and adding it to the table or overrides is a small change.
    • Related: fix(ai): a hosted gateway call is recorded as a local call at $0 #3656, which asks for a different 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.
  3. added
    priority/p2-medium
    on Nov 10, 2026
  4. added
    status/ready
    and removed
    status/new
    on Nov 10, 2026
  5. devops-cli-service commented on Nov 10, 2026

    @devops-cli-service
    Contributor

    Status set to Ready at 9bb67a0 (see proposed design in issue body).

    Moved to new items: #4422, #4423.

  6. added
    owner/agent
    status/in-progress
    and removed
    status/ready
    on Nov 10, 2026
  7. removed
    status/in-progress
    owner/agent
    on Nov 11, 2026
  8. devops-cli-service commented on Nov 11, 2026

    @devops-cli-service
    Contributor

    Live since 2026-11-11 05:46 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort/lowpriority/p2-mediumscope/aisource/agenttype/bugvalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions