Repository navigation
Identify webfox to the Perplexity API - #57
Merged
Merged
Conversation
Normalize the environment URL like the SDK so whitespace-only values still identify requests to the default API. Exercise outgoing headers with the real SDK, including URL precedence and caller overrides.
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.
The Perplexity provider now sends
X-Pplx-Integration: webfoxwhen its client talks to the public Perplexity API, so Perplexity can attribute API traffic to webfox. Authentication, request bodies, and response handling are unchanged.The header is set through the SDK's
defaultHeadersonly when:baseUrl, elsePERPLEXITY_BASE_URL, else the SDK default) has the exact hostnameapi.perplexity.ai, andPERPLEXITY_CUSTOM_HEADERSdoes not already contain anX-Pplx-Integrationvalue (any casing).Custom or local base URLs, including lookalike hosts, get no webfox attribution; they retain the SDK's existing attribution header.
Tests in
test/perplexity-provider.test.tscover constructor options. Real-SDK tests with intercepted fetch intest/perplexity-headers.test.tsverify outgoing attribution, whitespace-only environment URLs, environment/explicit URL precedence, lookalike hosts, mixed-case caller overrides, unrelated headers, and authentication. Also adds anunreleasedchangelog entry.Verification after maintainer follow-up (Node 24):
bun run test: 531 tests passed across 38 filesbun run check: passedbun run format:check: passed