Skip to content

Recognize gateway-routed models in telemetry and render scope - #151

Merged
teamchong merged 1 commit into
mainfrom
gateway-model-telemetry
Jul 26, 2026
Merged

Recognize gateway-routed models in telemetry and render scope#151
teamchong merged 1 commit into
mainfrom
gateway-model-telemetry

Conversation

@teamchong

@teamchong teamchong commented Jul 26, 2026

Copy link
Copy Markdown
Owner

70 compat and 306 grok events rendered with Model, Sent as, As text, Sent and Saved blank. /compat/chat/completions matched no known wire shape, so the parse block was skipped and the event defaulted to anthropic accounting.

Before:
POST /compat/chat/completions  shape: none    model: ""       acct: anthropic

After:
POST /compat/chat/completions  shape: openai  model: kimi-k3  acct: openai

Non-obvious mechanism:

  • One leading provider segment is accepted on OpenAI chat/responses paths. Routing is unchanged — a prefixed path still forwards to passthrough.

  • Profiles resolve by full id, then bare final segment. Vendor picks an upstream, not a geometry.

    moonshotai/kimi-k3, workers-ai/@cf/moonshotai/kimi-k3  ->  kimi-k3
    
  • On POST paths pxpipe does not transform, the top-level model field is read for labeling only. Gated to JSON under a size cap, since that route also carries uploads. Gate declines -> model blank as before, body streams unchanged.

  • Ids naming no measured family resolve to DEFAULT_GPT_PROFILE instead of being refused.

Trust boundary moved. Matching was hardcoded to google/; it now strips everything before the last /.

untrusted/google/gemini-3.6-flash  ->  in scope (was rejected)
gpt-5.6-sol/gpt-5.5                ->  still rejected

Intended: PXPIPE_MODELS stays the gate on which models get imaged, and the prefix is not part of that decision. If model is attacker-controlled, this widens billing misattribution surface.

For unmeasured families, savings is OpenAI tile math, not a measurement, and nothing checks the model accepts images — a text-only model 400s on the first imaged request. No vision gate by design: the scope list is hand-written, so a capability check re-asks a question the operator already answered, and the failure is a loud 400 rather than silent corruption.

@teamchong
teamchong force-pushed the gateway-model-telemetry branch from 8112075 to a82bdc8 Compare July 26, 2026 13:30
Requests arriving through a gateway's OpenAI-compatible route were invisible
to the dashboard: /compat/chat/completions and /grok/chat/completions matched
no known wire shape, so the proxy skipped the parse block, and the emitted
event carried no model and defaulted to anthropic accounting. 70 compat and
306 grok events rendered with Model, Sent as, As text, Sent and Saved blank.

Four changes, all in service of that:

- Recognize one leading provider segment on OpenAI chat/responses paths, so
  gateway-prefixed requests are read as the OpenAI shapes they are. Routing is
  untouched: a provider-prefixed path still forwards to the passthrough
  upstream.
- Resolve profiles by full id then bare final segment, so moonshotai/kimi-k3
  and workers-ai/@cf/moonshotai/kimi-k3 resolve as kimi-k3. Vendor segments
  pick an upstream, not a geometry.
- On POST paths pxpipe does not transform, read the top-level model field so
  the row is labeled. Buffering is gated to JSON under a size cap, since that
  route also carries uploads; when the gate declines, the model stays blank as
  before and the body streams through unchanged.
- Stop refusing ids that name no measured family. They now resolve to
  DEFAULT_GPT_PROFILE, gated with OpenAI tile math as an approximation.

The last one widens render scope, so state its limits plainly. PXPIPE_MODELS
becomes the only gate for these models: listing one asserts it is worth
imaging. Savings for them is an approximation, not a measurement, and nothing
verifies the model accepts images at all — a text-only model 400s on the first
imaged request. Deliberately not adding a vision-capability gate: the scope
list is hand-written, so a capability check re-asks a question the operator
already answered, and the failure is a loud 400 rather than silent corruption.
Docs record the tradeoff.
@teamchong
teamchong force-pushed the gateway-model-telemetry branch from a82bdc8 to af0004f Compare July 26, 2026 14:02
@teamchong
teamchong merged commit 8300afc into main Jul 26, 2026
5 of 6 checks passed
@teamchong
teamchong deleted the gateway-model-telemetry branch July 26, 2026 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant