Skip to content
Trazum

1.52.1

Two more providers, from facts already here

Added#

The gateway fronts Google — 1.53's third chapter, and the first where the model is in the URL. Four of seven.

Every fact needed was already committed here, which is why this chapter could be written and three others still cannot. packages/core/src/llm.ts has sent a real API key to https://generativelanguage.googleapis.com at /v1beta/models/{model}:generateContent, in an x-goog-api-key header rather than the query string, since the Gemini provider landed. packages/core/src/usage.ts has read usageMetadata back since the Gemini importer landed. Host, path, credential header and response shape: four facts this repository holds, none recalled.

The one forwarded path becomes a pattern, and that is narrower than it sounds. Google puts the model in the URL, so "the one path" cannot be a literal for it. The pattern is anchored at both ends and its model segment accepts only [A-Za-z0-9._-] — a stricter grammar than a string comparison against something a caller could have put a ? or a .. in. security.test.js now extracts pattern paths as exactly as it extracts literal ones, asserts each is anchored, and refuses any that accepts arbitrary text. Without that, the first pattern would have reached a credential-forwarding proxy without appearing in the allowlist at all — the hole opening in the same commit that made it possible, with the guard still passing.

And the URL sent upstream is rebuilt, never echoed. A pattern that matched is evidence the request was well formed; it is not permission to forward the string that satisfied it. Eight hostile paths are refused by test — a smuggled query string, traversal in the model segment, a second path segment, a different operation, text appended after :generateContent, a prefix before the version — and each asserts the upstream saw no connection at all, not an error relayed back.

:streamGenerateContent is not forwarded, and Google's streamed shape is not read. Its buffered shape being established does not establish its streamed one. streamingUsageReader('google') returns nothing for both an OpenAI-shaped event and a Gemini-shaped one, so the two facts cannot be quietly merged by a later edit.

The gateway fronts DeepSeek — 1.53's second chapter. Three of seven, up from two.

The host is not a new fact, and that is the whole reason this chapter could be written. scripts/measure-token-band.mjs has sent a real API key to https://api.deepseek.com/chat/completions since the band harness learned a second provider. Reusing an endpoint this repository already trusts with a credential is the difference between adding an upstream and inventing one — and the path genuinely has no /v1, which is exactly the detail recall gets wrong.

The remaining four providers are still unfronted for that reason and no other: their hosts appear nowhere in this repository, and compiling one in from memory, into the single place a user's credential is forwarded, is what the doctrine forbids treating as known.

WIRE_SHAPES puts "which response shape does this provider speak" in one place. DeepSeek serves the OpenAI format, so reading prompt_tokens out of it is the same code — but the buffered reader and the streaming reader each had their own provider === 'openai' test, and two parallel lists of provider names always eventually disagree. Both resolve through the map now.

A provider absent from that map gets null, not a guess. mistral, xai, moonshot and google are asserted to read as nothing rather than being scraped for fields that might mean tokens — and the gateway then reports the call as unmeasured, which is true, instead of recording a number nobody can defend.

Adding an upstream means editing an allowlist inside a security test, and that friction is the point: security.test.js compares the exact origins and paths, extracted rather than searched for, so a new destination for somebody's credential cannot arrive without a deliberate edit to a file that exists to notice.

Everything derived adapted on its own, which is what the last two chapters were for: the gateway's provider list grew, #309's gap guard dropped a case without being touched, and trazum connect deepseek still says the true and now-different thing — priced, fronted, no connector.

Fixed#

The buffered path went unmeasured in silence, on the other side of one if. 1.52 taught the streaming path to say this call is unmeasured when no usage event arrived, and left the buffered branch recording nothing and saying nothing. Found by a Gemini response with no counts in it: the call was forwarded, answered, and vanished from the total without a word. It now names the cause — but only when the provider called the response ok, because an upstream error carries no counts for the honest reason that it produced none, and announcing those would bury the ones that actually spent money.

A third unmeasured cause would have inherited the second one's sentence. gateway.unmeasured was a two-branch ternary whose else explained OpenAI's stream_options.include_usage — so the new cause would have told a Gemini user about a setting that does not exist in their SDK. One branch per cause now, no else. The eleventh time this project has bounded a message by its neighbour instead of by its subject.

docs/gateway.md said "five of the seven, still" through an entire release in which it became four. The table beside that sentence was guarded against UPSTREAMS; the sentence introducing the table was not. The count is gone — there is no number to get wrong if there is no number — and a guard now fails any spelled or digit count in that paragraph. ROADMAP.md carried the same stale two and lost its number the same way. The eleventh occurrence of a count written above a derived list, and the third file to lose one.

A provider Trazum prices but cannot front was refused as though it were a typo — 1.53's first chapter. trazum gateway mistral and trazum gateway bogus got the same sentence:

Error: "mistral" is not a provider this gateway speaks for. Known: anthropic, openai.

One of those is a gap in this tool with a real workaround; the other is a misspelling. Telling them apart is the difference between a user reaching for trazum profile and a user checking their keyboard. trazum connect did the same thing.

Seven providers are priced. Two are fronted by the gateway and two have connectors — that gap is the whole subject of the 1.53 arc, and the first honest thing to do about it is stop describing it as the user's mistake.

Both refusals now answer three cases instead of two, and the priced-but- unsupported one says what is true: that the gap is real and on the roadmap, that trazum profile prices an exported log from that provider today, and — the part worth stating — what you do not get, which is a refusal before the money is spent, the whole point of the gateway.

The split is derived from the catalogue rather than a list kept beside it, so a provider added to pricing starts getting the better answer, and one that gains an upstream stops needing it, without anyone remembering either.

Added#

A guard that generates itself from the gap. It walks every priced provider without an upstream or a connector and asserts the refusal names the provider as priced, does not use the typo wording, and points somewhere — a refusal never arrives bare.

Its first assertion is that the gap exists at all: if every priced provider is ever supported, the suite fails and says to delete it rather than quietly testing nothing.

Proven in both directions, and the second is the one that matters. Reverting to one answer fails ten of the twelve. Greeting every unknown name as priced-but-unsupported — the tempting over-fix — fails the assertion that a name Trazum has never heard is still refused as one: that version would tell somebody who mistyped nonesuch that Trazum prices their imaginary provider.