feat(openrouter): add with_app_identity and with_app_categories builders for app attribution#1806
Open
jimmiebfulton wants to merge 2 commits into
Open
feat(openrouter): add with_app_identity and with_app_categories builders for app attribution#1806jimmiebfulton wants to merge 2 commits into
jimmiebfulton wants to merge 2 commits into
Conversation
…Referer headers OpenRouter uses the X-Title and HTTP-Referer request headers to identify the calling application in the dashboard activity feed and public rankings page. Without them, all requests appear under the API key with no named app. Adds `ClientBuilder::with_app_identity(title, url)` that sets both headers on every request made by the client. The method is callable at any point in the builder chain (before or after api_key). Invalid header values (non-ASCII characters) are silently skipped rather than returning an error, matching the behaviour of header helpers elsewhere in the codebase. Three tests: headers present after with_app_identity, headers absent without it, and the existing client-initialization smoke-test.
Contributor
|
Hi! Can you replace |
Contributor
Author
Thanks for pointing this out. I'll take a thorough pass at the docs and put together a more comprehensive approach. I'll update the PR tomorrow some time. |
Contributor
Author
|
@Mnwa Requested changes incorporated. |
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.
Summary
OpenRouter uses the `X-OpenRouter-Title`, `HTTP-Referer`, and `X-OpenRouter-Categories` request headers to identify the calling application in the dashboard activity feed, public rankings page, and marketplace categories.
Changes
AI Assistance
This implementation was developed with significant AI assistance (Claude). The design and tests were reviewed and validated by the author before submission.
Issue
Fixes #1805