Skip to content

fix(ai): do not classify gateway endpoint as local backend - #5874

Merged
dan-petty merged 1 commit into
mainfrom
fix/5867-gateway-endpoint-not-local
Nov 15, 2026
Merged

dan-petty merged 1 commit into
mainfrom
fix/5867-gateway-endpoint-not-local

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

Calls to hosted models through PydanticAI are classified as local savings with the gateway proxy hostname as backend. The gateway endpoint ends in .local, which matches the rule for cluster backends. This causes excessive projected local savings in monitoring dashboards.

Closes #5867

Change: openspec/changes/archive/2026-11-15-5867-gateway-endpoint-not-local/

@dan-petty dan-petty added type/bug Type bug: the code does not do what it must scope/ai AI review pipeline, personas, prompts, LLM client, or RAG labels Nov 15, 2026
@dan-petty
dan-petty force-pushed the fix/5867-gateway-endpoint-not-local branch from 281ac6d to b84d17e Compare November 15, 2026 19:07
…5867)

Detect gateway proxy endpoints with is_gateway_server. Prevent
treating the gateway endpoint as a local serving backend in is_local.
Fall through to gateway model routing when served_by names the gateway
proxy. In factory.py, pass effective_served_by as None when served_by
names the gateway proxy endpoint.

Closes #5867

Change:
`openspec/changes/archive/2026-11-15-5867-gateway-endpoint-not-local/`
@dan-petty
dan-petty force-pushed the fix/5867-gateway-endpoint-not-local branch from b84d17e to b5fef15 Compare November 15, 2026 19:25
@dan-petty
dan-petty marked this pull request as ready for review November 15, 2026 19:33
@dan-petty
dan-petty merged commit 8c09c33 into main Nov 15, 2026
23 checks passed
@dan-petty
dan-petty deleted the fix/5867-gateway-endpoint-not-local branch November 15, 2026 22:52
dan-petty pushed a commit that referenced this pull request Nov 15, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.159.0](v0.158.0...v0.159.0)
(2026-11-15)


### Features

* **ai:** Record the cost of Jev calls
([#5879](#5879))
([d1ac8ca](d1ac8ca))
* **ci:** add OpenTofu 1.13.9 to images and CI
([#5862](#5862))
([ca62d6a](ca62d6a))
* **roadmap:** Require the contract test of a workflow change
([#5877](#5877))
([f81f4b9](f81f4b9))


### Bug Fixes

* **ai:** do not classify gateway endpoint as local backend
([#5874](#5874))
([8c09c33](8c09c33))
* **k8s:** Name the collector service that exists
([#5895](#5895))
([a20c801](a20c801))
* **monitoring:** Drop the caller labels from the gateway series
([#5896](#5896))
([d0929e1](d0929e1))
* **roadmap:** check the premise before the first step
([#5886](#5886))
([1b12e5c](1b12e5c))
* **roadmap:** handle git grep timeout in refine context collection
([#5872](#5872))
([0eecb65](0eecb65))
* **roadmap:** Judge no criterion in the paths gate
([#5875](#5875))
([ca88553](ca88553))
* **roadmap:** plan drift keeps other needs-fix labels
([#5888](#5888))
([93e57ed](93e57ed))
* **roadmap:** refine designs against an alert without its rule text
([#5882](#5882))
([cbd8bf7](cbd8bf7))
* **roadmap:** the refine proposal caps its context with a job constant
([#5878](#5878))
([25fca43](25fca43))


### Performance Improvements

* **roadmap:** File a new candidate with one request
([#5894](#5894))
([5fea092](5fea092))


### Code Refactoring

* **github:** one pull request verdict for all monitors
([#5889](#5889))
([d93b753](d93b753)),
closes [#5021](#5021)
* **roadmap:** one open step for every pull request
([#5870](#5870))
([6e9f577](6e9f577)),
closes [#5020](#5020)

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: dan-petty-release[bot] <346998822+dan-petty-release[bot]@users.noreply.github.com>
dan-petty added a commit that referenced this pull request Nov 16, 2026
The savings panels of `ai-spend.json` priced local tokens at gpt-4o and
read devops-cli's `local` label, which gave hosted DeepSeek tokens
`local="true"` before #5874. For 6 h to 2026-11-16 01:35Z the 30-day
savings were $20,143. Now they are $31.99.

- Savings read the gateway counters
`litellm_input/output_tokens_metric_total` with `api_provider`
`ollama_chat` or `ollama`, at 0.035 and 1.50 USD (chat) and 0.01 USD
(embeddings) per million tokens.
- A test prices the reference models of `configmap.example.yaml` with
the registry of the spend reports and compares the dashboard constant.
- Hourly savings bars. The bars by backend take the service name from
`api_base`. Embedding deployments have no `api_base`, so their model
names them.
- Projections take savings from the last 7 days. Spend legend:
`{{api_provider}}: {{model}}`.

The savings queries of #5784 and #2202 are gone.

Closes #5914

Change:
`openspec/changes/archive/2026-11-16-5914-savings-at-reference-price/`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope/ai AI review pipeline, personas, prompts, LLM client, or RAG type/bug Type bug: the code does not do what it must

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(ai): do not classify gateway endpoint as local serving backend

1 participant