Repository navigation
Conversation
There was no way to add a header. Not one. OpenRouter reads HTTP-Referer and X-Title for app attribution, tracing needs a correlation id, and a gateway in front of either may want a tenant header; all of it required replacing the transport or subclassing the provider to override #headers. The JS SDK takes headers per call and per client, and this took neither. Nor was there a way to use a second model. `model:` is fixed when the client is built, so asking jev-preview one question meant a second client with a second connection and a second copy of the config. Client.new takes headers:, ask takes model: and headers:. They merge provider, then client, then call, matched without regard to case so an override of "content-type" replaces "Content-Type" instead of travelling beside it. A per-call model resolves through the provider's aliases like any other and leaves client.model alone. Header names and values are checked for newlines. Net::HTTP rejects those with an ArgumentError raised from inside the request, which tells you nothing about which header did it; this says so at the call site. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This branch has not been deployed
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.
There was no way to add a header. Not one.
OpenRouter reads
HTTP-RefererandX-Titlefor app attribution, tracing needs a correlation id, and a gateway in front of either may want a tenant header; all of it required replacing the transport or subclassing the provider to override#headers. The JS SDK takes headers per call and per client, and this took neither.Nor was there a way to use a second model —
model:is fixed when the client is built, so askingjev-previewone question meant a second client with a second connection and a second copy of the config.Headers merge provider, then client, then call, matched without regard to case so an override of
content-typereplacesContent-Typeinstead of travelling beside it. A per-call model resolves through the provider's aliases and leavesclient.modelalone.Header names and values are checked for newlines —
Net::HTTPrejects those with anArgumentErrorraised from inside the request, which tells you nothing about which header did it.Tests
test/request_options_test.rb, 15 cases, including that per-call values don't leak into the next call.Draft: part of a security and API-coverage audit, opened for reference rather than as a request for immediate review. Independent of the other branches, each off
main. Suite green on Ruby 3.2.11, 3.3.8 and 3.4.8.🤖 Generated with Claude Code