Skip to content

Add integration header to Perplexity requests - #6

Open
qirh wants to merge 1 commit into
FlyingFathead:mainfrom
qirh:add-perplexity-attribution
Open

qirh wants to merge 1 commit into
FlyingFathead:mainfrom
qirh:add-perplexity-attribution

Conversation

@qirh

@qirh qirh commented Oct 14, 2026

Copy link
Copy Markdown

Adds an X-Pplx-Integration: telegrambot-openai-api header to the Perplexity request headers in src/api_perplexity_search.py, so Perplexity can identify requests coming from this bot and support the integration. The header is only added when the configured endpoint's host is exactly api.perplexity.ai; a custom [Perplexity] Endpoint gets no extra header. The API key, payload, retries and response handling are unchanged.

tests/test_perplexity_headers.py checks the default endpoint gets the header once and that custom or lookalike hosts do not.

Verification:

  • python -m pytest -q tests: 13 passed (the new default-header test fails without the source change)

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.

1 participant