Skip to content

chore(ai): Confirm DeepSeek price on OpenRouter activity #4422

Open

Description

@devops-cli-service

Update 2026-11-26 (infra move): the gateway config is now k8s/llm/gateway/config.yaml of dan-petty/homelab.

  • A rate change needs two pull requests: the model_info rates in homelab, and src/devops_cli/ai/spend/pricing.py here.
  • tests/ai/spend/test_hosted_group_prices.py does not read the gateway file, so it does not fail when the two differ. Compare them by hand.

Split from #4403.

Problem

The price entry takes 0.05 USD input, 0.008 USD cached input and 0.192 USD output per million tokens from the OpenRouter endpoints record that the project saved when it added the :floor fp8 route (openspec/changes/archive/2026-11-02-3144-deepseek-through-openrouter/proposal.md:12) and from k8s/llm/gateway/config.yaml of dan-petty/homelab. The OpenRouter account activity page shows what the account is billed, and only a person with account access can read it. A web search for the public model page returned no result.

Why this part is deferred

The code change needs no account access. The account check is a separate verification that needs a person, and a skipped provider can make the billed rate higher than the cheapest fp8 rate.

Acceptance criteria

  • A person with OpenRouter account access reads the account activity for one day of gateway calls.
  • The person compares the billed input, cached-input and output rates with 0.05, 0.008 and 0.192 USD per million tokens.
  • The person comments the result on fix(ai): price the DeepSeek models in the price table #4403.
  • If a rate differs, a new item updates the deepseek-v4.1-flash-1017:floor entry in ai.price_overrides.

Proposed design

Problem statement

The deepseek-v4.1-flash-1017 price entry holds 0.0784, 0.002352 and 0.2352 USD per million input, cached input and output tokens. These are the list rates of deepinfra/fp8/flex, an opt-in endpoint that default routing never uses. The owner's evidence of 2026-11-28 shows the entry is a lower bound: the cheapest reachable fp8 endpoint costs 8.4% more. Only the OpenRouter account activity gives the billed rate, and only the account owner can read it. The owner reads one completed UTC day, compares the billed spend with the cost at the entry's rates, and comments the result on #4403. A difference beyond the band becomes a new item that updates the gateway model_info and the price entry.

Acceptance criteria

Requirement: Pending a person after the merge

The OpenRouter account owner SHALL read the Activity spend of one completed UTC day of deepseek/deepseek-v4.1-flash-1017 calls and comment the result on #4403.

Scenario: One completed UTC day

  • WHEN The owner opens https://openrouter.ai/activity, filters to the model deepseek/deepseek-v4.1-flash-1017, picks the most recent completed UTC day that holds calls in the Explore tab with a daily rollup, and keeps the filtered URL.
  • THEN The comment on fix(ai): price the DeepSeek models in the price table #4403 names the UTC date, the model endpoint that served, the prompt, cached and completion token counts and the billed spend. It gives the cost at 0.0784, 0.002352 and 0.2352 USD per million tokens, the difference and the filtered URL.

Requirement: A billed difference becomes a new item

A difference of more than the larger of 0.01 USD and 5% of the billed spend MUST become a new issue that updates the gateway model_info of the dated deployment and _DEEPSEEK_V4_1_FLASH_1017_PRICE.

Scenario: A billed cost differs

  • WHEN The computed cost of the day differs from the billed spend by more than the larger of 0.01 USD and 5% of the billed spend.
  • THEN The new issue names the rates to set in k8s/llm/gateway/config.yaml of dan-petty/homelab and src/devops_cli/ai/spend/pricing.py. It states that the two files are compared by hand and gives uv run pytest tests/ai/spend/test_hosted_group_prices.py as the proof of the pricing table.

Existing Tool Considered

No alternatives check has run. The open, maintained OpenRouter Activity page covers the need: https://openrouter.ai/activity. The guide is https://openrouter.ai/docs/guides/features/activity, read 2026-11-28.

The page and the OpenRouter Analytics API give spend, request and token metrics by model, provider, API key, app or user over any date range. Every tab shares the date range and the filter state, which is stored in the URL, and Explore groups by one or two dimensions with a time rollup and exports CSV or PDF. They lack account-free access: the page needs the owner's signed-in session, and the API needs a Management API key that this repository does not hold. They give no comparison with the gateway rates, so the owner does the arithmetic and builds no code: about 15 minutes and no tokens.

Key questions

  • What rates does the deepseek-v4.1-flash-1017 price entry hold, and where does it live?: 0.0784 USD input, 0.002352 USD cached input and 0.2352 USD output per million tokens. _DEEPSEEK_V4_1_FLASH_1017_PRICE holds them at src/devops_cli/ai/spend/pricing.py:55, and the comment above it records that they are the rates of the endpoint deepinfra/fp8/flex in the OpenRouter endpoints API on 2026-11-11. _HOSTED_GROUP_PRICES maps the group, the :floor route name and the dated route name to that entry at src/devops_cli/ai/spend/pricing.py:84. The body's 0.05, 0.008 and 0.192 USD are the older :floor rates of 2026-11-02. [sources: src/devops_cli/ai/spend/pricing.py:55, src/devops_cli/ai/spend/pricing.py:84, openspec/changes/archive/2026-11-02-3144-deepseek-through-openrouter/proposal.md:12]
  • Does the gateway still call the endpoint whose rates the entry holds?: No. The comment above the entry says the :floor route ran until 2026-11-16 and that its key stays, so old spend records keep their price (src/devops_cli/ai/spend/pricing.py:46). feat(ai): Route around a stalled or offline model provider #5990 gave the group two deployments. Order 1 calls openrouter/deepseek/deepseek-v4.1-flash-1017 with the fp8 and data_collection: deny filters, so OpenRouter's routing picks any fp8 endpoint at its list price. The reply of 2026-11-28 adds that deepinfra/fp8/flex is opt-in, so default routing never sends a call there. Order 2 calls the undated model, which the model filter leaves out of the comparison. [sources: src/devops_cli/ai/spend/pricing.py:46, src/devops_cli/ai/spend/pricing.py:82, openspec/changes/archive/2026-11-16-5990-route-around-a-stalled-or-offline/proposal.md:7]
  • Which OpenRouter source shows the billed activity?: The Activity page at https://openrouter.ai/activity. The guide (read 2026-11-28) says it is the aggregate view of the observability suite: it rolls the generations up into spend, request and token metrics sliced by model, provider, API key, app or user over any date range, the Overview, Trends and Explore tabs share the date range and filter state, and Explore picks a metric, groups by one or two dimensions, chooses a time rollup and exports CSV or PDF. The same aggregates need a Management API key through GET /api/v1/analytics/meta and POST /api/v1/analytics/query, which this repository does not hold: docs/ENV_VARS.md:198 lists only the inference key openrouter.api_key, so the check uses the dashboard. The public endpoints API gives the list price of each endpoint with no key, but no billed spend. (best practice) [sources: https://openrouter.ai/docs/guides/features/activity, docs/ENV_VARS.md:198, src/devops_cli/ai/spend/pricing.py:55]
    • Chosen: The Activity dashboard. It shows the account bill and needs no key beyond the owner's session.
    • Rejected: The Analytics API. It needs a Management API key that this repository does not hold.
    • Rejected: The public endpoints API. It gives list prices, not the billed spend.
  • Which day of gateway calls does the check read?: The most recent completed UTC day that holds calls of deepseek/deepseek-v4.1-flash-1017, read in the Activity page with the model filter and a daily rollup, with the filtered URL kept in the comment. A completed UTC day has a settled bill. The guide (read 2026-11-28) states that every tab shares the same date range and filter state, which is stored in the URL, so the kept URL reproduces the day and the filters. (best practice) [sources: https://openrouter.ai/docs/guides/features/activity]
    • Chosen: The most recent completed UTC day that holds calls. A completed day has a settled bill, and the page keeps the range and the filters in the URL.
    • Rejected: The current UTC day. It is still filling, so its spend is not final.
    • Rejected: A day that the person picks. It is not reproducible and may hold no call of the model.
  • Which billed figure does the check compare?: The Activity spend metric for the day, filtered to deepseek/deepseek-v4.1-flash-1017 and grouped by model endpoint, summed over the endpoints that served. It is the account's bill, and the grouping names the endpoint that served; the guide (read 2026-11-28) lists a daily usage and spend aggregate grouped by model endpoint. (best practice) [sources: https://openrouter.ai/docs/guides/features/activity, src/devops_cli/ai/spend/pricing.py:55]
    • Chosen: The Activity spend per model endpoint. It is the bill, it names the serving endpoint, and it is what the issue asks the owner to read.
    • Rejected: The gateway spend ledger. It prices each request at this same entry, so the comparison is circular.
    • Rejected: The endpoints price record. It lists the list price of each endpoint and says nothing about the bill.
  • How close must the computed cost be to the billed spend?: Flag a difference larger than the larger of 0.01 USD and 5% of the billed spend. A rate error moves the day's cost in proportion, so the band is relative. The 5% absorbs the rounding of the bill and any difference in how the two sides count cached tokens. The 0.01 USD floor keeps a rounding cent on a small day from raising an item. (best practice) [sources: src/devops_cli/ai/spend/pricing.py:53, openspec/changes/archive/2026-11-11-4403-price-the-deepseek-models-in-the/design.md:7, https://openrouter.ai/docs/guides/features/activity]
    • Chosen: The larger of 0.01 USD and 5% of the billed spend. A rate error is proportional, so the band is relative, and the floor keeps a small bill's rounding from raising an item.
    • Rejected: An exact match. The bill is an aggregate that rounds, so an exact match would flag rounding as a rate difference.
    • Rejected: Within 0.01 USD. A fixed cent is wide on a day that bills a few cents and tight on a day that bills dollars.
    • Rejected: Within 7%. That is the 2026-11-08 to 2026-11-11 match band of fix(ai): price the DeepSeek models in the price table #4403, and it would pass a rate that is 7% wrong.
  • What does a billed rate difference update?: A new item sets the model_info rates of the dated deployment in k8s/llm/gateway/config.yaml of dan-petty/homelab and _DEEPSEEK_V4_1_FLASH_1017_PRICE at src/devops_cli/ai/spend/pricing.py:55. The reply of 2026-11-28 states the same, and it says the homelab gateway comment now names the order 1 rates as a lower bound and points to this item. The two files are compared by hand, because tests/ai/spend/test_hosted_group_prices.py builds the registry with no settings and no file and holds no gateway config. (best practice) [sources: src/devops_cli/ai/spend/pricing.py:55, src/devops_cli/ai/spend/pricing.py:84, tests/ai/spend/test_hosted_group_prices.py]
    • Chosen: Both the gateway model_info and the pricing table. The gateway holds the client price and the built-in table prices the Service and the workstation ledger.
    • Rejected: Only the gateway model_info. The Service and the workstation would keep pricing the group at the old rate.
    • Rejected: Only the pricing table. The gateway client price would keep the old rate.
    • Rejected: An ai.price_overrides entry. It shadows the built-in price only where the ConfigMap is read, and the gateway client price needs the change too.
  • Who reads the OpenRouter account activity?: The owner of the OpenRouter account. openrouter.api_key is the key that devops k8s push-secrets writes to the gateway Secret and keeps in the owner's OS keyring (docs/ENV_VARS.md:198). The archive proposal of feat(k8s): serve deepseek-v4.1-flash-1017 through OpenRouter #3144 records that the owner has the key and chose the OpenRouter route. The reply of 2026-11-28 comes from the owner and confirms the account access. [sources: docs/ENV_VARS.md:198, openspec/changes/archive/2026-11-02-3144-deepseek-through-openrouter/proposal.md:5]
  • Must the OpenRouter account owner sign in to https://openrouter.ai/activity, because the Analytics API needs a Management API key that this repository does not hold?: The check still needs the owner, and the public data shows the entry is a lower bound. The endpoints API needs no key and still lists 0.0784, 0.002352 and 0.2352 USD per million tokens for deepinfra/fp8/flex. That endpoint is opt-in, so default routing never sends a call there. The dated model's token mix in the 7 days to 2026-11-28 is 2.716e9 prompt tokens (95.2% cached) and 9.864e7 output tokens. It costs 39.57 USD at the configured rates, and the cheapest reachable fp8 endpoint, tenstorrent/fp8, costs 42.89 USD (+8.4%). litellm_spend_metric_total is the configured rate times the tokens, so only the account activity gives the billed rate. The guide (read 2026-11-28) confirms that the programmatic route needs a Management API key, which docs/ENV_VARS.md:198 does not hold. (best practice) [sources: https://openrouter.ai/docs/guides/features/activity, docs/ENV_VARS.md:198, src/devops_cli/ai/spend/pricing.py:55]
    • Chosen: The owner reads the account activity. Only the account bill gives the billed rate, and the owner holds the account.
    • Rejected: Compute the rate from the public endpoints API and the token mix. It gives a lower bound of +8.4%, not the billed rate of the day.
    • Rejected: Read the gateway spend ledger. It prices each request at the configured entry, so the comparison is circular.

Fit

Fits in one pull request.

Suspected block

None.

Dependencies

None.

Activity

  1. added
    source/agent
    type/chore
    scope/ai
    status/new
    value/medium
    effort/low
    on Nov 10, 2026
  2. devops-cli-service commented on Nov 10, 2026

    @devops-cli-service
    ContributorAuthor

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

    • Type: type/chore. The chore prefix of the title gives the type.
    • Scope: scope/ai. The (ai) scope of the title gives the scope.
    • Priority: P2-Medium. The result affects the accuracy of the spend counters, but no code change waits for it.
    • Value: Medium. The check confirms the billed rates and keeps the cost figures correct.
    • Effort: Low. One person reads one day of account activity and compares three rates.
    • Related: fix(ai): price the DeepSeek models in the price table #4403, which asks for a different change. Both items concern the DeepSeek price. #4403 sets the price in the table and the candidate confirms the billed rates on the account.
  3. changed the title [-]chore(ai): confirm the DeepSeek price on the OpenRouter account activity[/-] [+]chore(ai): Confirm DeepSeek price on OpenRouter activity[/+] on Nov 10, 2026
  4. devops-cli-service commented on Nov 10, 2026

    @devops-cli-service
    ContributorAuthor

    The job shortened the title of this item. The summary had 61 characters, and the limit is 60. The type and the scope stay.

    • Before: chore(ai): confirm the DeepSeek price on the OpenRouter account activity
    • After: chore(ai): Confirm DeepSeek price on OpenRouter activity
    • Source of the summary: the background model
  5. devops-cli-service commented on Nov 11, 2026

    @devops-cli-service
    ContributorAuthor

    Refine cannot set this item to Ready at 6a09588 until a person answers the questions below. Reply in a comment or edit the body, and the next refine round looks at the item again.

    • Who reads the OpenRouter account activity? (a person decides)

    The next refine round also looks at the item again when a commit on the default branch changes one of these files: k8s/llm/gateway/config.yaml.

  6. devops-cli-service commented on Nov 11, 2026

    @devops-cli-service
    ContributorAuthor

    Refine cannot set this item to Ready at 54743c4 until a person answers the questions below. Reply in a comment or edit the body, and the next refine round looks at the item again.

    • Who reads the OpenRouter account activity? (a person decides)
  7. dan-petty commented on Nov 15, 2026

    @dan-petty
    Owner

    Returned: the item needs a person with OpenRouter account access to read one UTC day of the account activity and to compare the billed input, cached and output rates with the configured ones. This host has no account credential and no way to reach the Activity dashboard; the refine also records that the public model page holds no rate. A person must do it.

  8. devops-cli-service commented on Nov 15, 2026

    @devops-cli-service
    ContributorAuthor

    Owner question: Who reads the OpenRouter account activity? (a person decides)

    Options

    1. Decide the question: The job refines the item with your answer.
    2. Leave it to the job: The job records the best-practice answer and goes on.

    Recommendation: Decide the question: only a person can answer it.

    Evidence

  9. devops-cli-service commented on Nov 20, 2026

    @devops-cli-service
    ContributorAuthor

    Owner question: See the first point of Open questions in the section Proposed design of the body.

    Options

    1. Decide the question: The job refines the item with your answer.
    2. Leave it to the job: The job records the best-practice answer and goes on.

    Recommendation: Decide the question: only a person can answer it.

    Evidence

  10. devops-cli-service commented on Nov 21, 2026

    @devops-cli-service
    ContributorAuthor

    Owner question: See Suspected block in the section Proposed design of the body.

    Options

    1. Decide the question: The job refines the item with your answer.
    2. Leave it to the job: The job records the best-practice answer and goes on.

    Recommendation: Decide the question: only a person can answer it.

    Evidence

  11. devops-cli-service commented on Nov 26, 2026

    @devops-cli-service
    ContributorAuthor

    Owner question: See Suspected block in the section Proposed design of the body.

    Options

    1. Decide the question: The job refines the item with your answer.
    2. Leave it to the job: The job records the best-practice answer and goes on.

    Recommendation: Decide the question: only a person can answer it.

    Evidence

  12. devops-cli-service commented on Nov 26, 2026

    @devops-cli-service
    ContributorAuthor

    Owner question: See Suspected block in the section Proposed design of the body.

    Options

    1. Decide the question: The job refines the item with your answer.
    2. Leave it to the job: The job records the best-practice answer and goes on.

    Recommendation: Decide the question: only a person can answer it.

    Evidence

  13. dan-petty commented on Nov 28, 2026

    @dan-petty
    Owner

    Evidence from dan-petty/homelab#628 (2026-11-28, public OpenRouter endpoints API, no key, and the gateway metrics in Prometheus):

    • The rates of deepseek-v4.1-flash-1017 (0.0784 / 0.002352 / 0.2352 USD per million input / cached input / output tokens) are still the list rates of deepinfra/fp8/flex. The OpenRouter service tier guide says that flex endpoints are opt-in, so default routing never sends a call there.
    • Token mix of the dated model in the 7 days to 2026-11-28: 2.716e9 prompt tokens (95.2% cached) and 9.864e7 output tokens. At the configured rates this mix costs 39.57 USD. Each fp8 endpoint that default routing can reach costs more for this mix: the cheapest, tenstorrent/fp8, 42.89 USD (+8.4%); 20 standard fp8 endpoints +8% to +348%; the two priority endpoints +88% and +789%. So the gateway and devops-cli spend of the group is low by at least 8%.
    • litellm_spend_metric_total of the dated model (39.54 USD for the same 7 days) is the configured rate times the tokens, so only the account activity can give the billed rate.
    • Side note on the undated model (deepseek-v4.1-flash, 0.30 / 0.006 / 1.20): its price is called "the top of what its providers charge", but parasail/fast (fp8, priority tier, 0.45 / 1.80) can now take default traffic, because priority endpoints of open-weight models take part in default routing.

    The homelab gateway comment now names the order 1 rates as a lower bound of the billed cost and points to this item. A rate change needs both k8s/llm/gateway/config.yaml of dan-petty/homelab and _DEEPSEEK_V4_1_FLASH_1017_PRICE.

  14. devops-cli-service commented on Nov 28, 2026

    @devops-cli-service
    ContributorAuthor

    Next step: the alternatives check records a verdict. See the section Proposed design of the body.

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/agentstatus/newtype/chorevalue/medium

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions