Repository navigation
feat(logging): record the OpenRouter provider that served each call (upstream_provider) - #151
Merged
Merged
Conversation
OpenRouter routes one model id across many hosts and names the one it
picked in the response body's `provider`; the log kept only our route
("openrouter"), so cost/latency couldn't be broken down by host.
Logged as `upstream_provider` on successful OpenRouter responses.
Also adds DISCLOSURE.md (tool-use disclosure), which the repo lacked.
This was referenced Oct 21, 2026
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.
Why
OpenRouter routes one model id across many hosts, and they differ a lot. GLM-5.2 has 34 endpoints with output prices from $1.68 to $10/M and quantizations from fp4 to fp8. MiMo-v2.6-pro has 4 endpoints, all priced the same. Our response log records only our route (
provider: "openrouter"), so we can't answer questions like:The OpenRouter response body already names the host it picked, in its top-level
providerfield. This PR logs it.Providers change from day to day, so the goal is to collect data over time, not to label any one host as "fast" or "slow".
Change
log_responsewritesupstream_providerwhen the upstream body has aproviderfield. That means successful OpenRouter calls only; the field is absent for NRP/nimbus and on errors. Failed OpenRouter calls already name their providers insideerror.test_upstream_provider_logged_when_present. All 42 tests intest_logging.pypass.DISCLOSURE.md, which the repo lacked, disclosing LLM tool use in the repo's development.It isn't a flat Parquet column yet; query it with
json_extract_string(entry,'$.upstream_provider'). If it proves useful, it can be promoted to a column in the consolidation jobs later, alongside the team traffic dashboard work.