Skip to content

Identify webfox to the Perplexity API - #57

Merged
mavam merged 2 commits into
mavam:mainfrom
qirh:add-pplx-integration-header
Oct 9, 2026
Merged

mavam merged 2 commits into
mavam:mainfrom
qirh:add-pplx-integration-header

Conversation

@qirh

@qirh qirh commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

The Perplexity provider now sends X-Pplx-Integration: webfox when 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 defaultHeaders only when:

  • the effective base URL (baseUrl, else PERPLEXITY_BASE_URL, else the SDK default) has the exact hostname api.perplexity.ai, and
  • PERPLEXITY_CUSTOM_HEADERS does not already contain an X-Pplx-Integration value (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.ts cover constructor options. Real-SDK tests with intercepted fetch in test/perplexity-headers.test.ts verify outgoing attribution, whitespace-only environment URLs, environment/explicit URL precedence, lookalike hosts, mixed-case caller overrides, unrelated headers, and authentication. Also adds an unreleased changelog entry.

Verification after maintainer follow-up (Node 24):

  • bun run test: 531 tests passed across 38 files
  • bun run check: passed
  • bun run format:check: passed

qirh and others added 2 commits October 9, 2026 13:30
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.
@mavam
mavam merged commit 939d8b5 into mavam:main Oct 9, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants