Add LLM Gateway to the AI gateway benchmark#215
Merged
Conversation
Some OpenAI-compatible gateways stream cumulative usage on early SSE events (mirroring Anthropic's message_start) rather than only on the final chunk. First-match extraction under-counts output tokens for those streams; take the last match, consistent with the anthropic wire-format path. Claude-Session: https://claude.ai/code/session_01DLdncZM43JVsEEhYkEhby2
Contributor License AgreementAll contributors are covered by a CLA. |
Contributor
Storage Benchmark Results1MB Files
View full run · SVGs available as build artifacts |
Contributor
Browser Throughput Benchmark Results
View full run · SVG available as build artifact |
Contributor
Browser Benchmark Results
View full run · SVG available as build artifact |
Contributor
Snapshot/Fork Benchmark Resultssmall dataset
|
Contributor
Sandbox Benchmark ResultsSequential
Staggered
Burst
View full run · SVGs available as build artifacts |
Contributor
Sandbox Dax Benchmark Results
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this adds
LLM Gateway as a fifth participant in the AI gateway benchmark:
src/ai-gateway/providers.ts— provider entry: OpenAI wire format,api.llmgateway.io, modelanthropic/claude-haiku-4-5. Theanthropic/prefix is LLM Gateway's provider-pinning syntax (provider/model), so requests route to Anthropic itself — same underlying model and deployment as the other participants, satisfying the "every gateway is hit directly via its own native routing" fairness rule.src/ai-gateway/generate-svg.ts— display label.env.example—LLMGATEWAY_API_KEY. Missing key → reported asSKIPPED, as with the other gateways.package.json—bench:ai-gateway:llmgatewayfilter script.AI_GATEWAYS.md— participant list, model naming, wire formats, fairness section, round-robin example, and env var docs updated.No committed results are touched — happy to leave publishing numbers to a run from your usual vantage point once
LLMGATEWAY_API_KEYis added to the runner env.Token-extraction fix (second commit)
While validating, LLM Gateway scored ~1 tok/s:
extractOutputTokenson theopenaipath takes the first"usage":{..."completion_tokens":N}match in the SSE buffer, but some OpenAI-compatible gateways stream cumulative usage on early events (mirroring Anthropic'smessage_start) rather than only on the final chunk. The fix takes the last match — consistent with theanthropicpath directly below it and with the function's own docstring ("latest known output-token count"). No behavior change for streams that only emit usage on the final chunk (OpenRouter, Vercel).Local validation
npm run bench:ai-gateway(10 cold + 10 warm, other gateways skipped for lack of keys), from a residential vantage point:Phase medians: DNS 6ms, TCP 20ms, TLS 39ms, cold TTFB 271ms, warm TTFB 197ms.
Disclosure: I work on LLM Gateway.
https://claude.ai/code/session_01DLdncZM43JVsEEhYkEhby2