litellm - 💡(How to fix) Fix [Bug]: Perplexity search ignores custom env api key [1 pull requests]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

WebSearchInterception: Search 0 failed with error: litellm.APIConnectionError: APIConnectionError: PerplexityException - PERPLEXITYAI_API_KEY is not set. Set PERPLEXITYAI_API_KEY environment variable.

Fix Action

Fixed

Code Example

search_tools:
  - search_tool_name: perplexity-search
    litellm_params:
      search_provider: perplexity
      api_key: os.environ/FOO_BAR

---

WebSearchInterception:
  Search 0 failed with error: litellm.APIConnectionError: APIConnectionError: PerplexityException - PERPLEXITYAI_API_KEY is not set. Set
  `PERPLEXITYAI_API_KEY` environment variable.

---

WebSearchInterception:
  Search 0 failed with error: litellm.APIConnectionError: APIConnectionError: PerplexityException - PERPLEXITYAI_API_KEY is not set. Set
  `PERPLEXITYAI_API_KEY` environment variable.
RAW_BUFFERClick to expand / collapse

Check for existing issues

  • I have searched the existing issues and checked that my issue is not a duplicate.

What happened?

Following an example at https://docs.litellm.ai/docs/integrations/websearch_interception I've set this in the config

search_tools:
  - search_tool_name: perplexity-search
    litellm_params:
      search_provider: perplexity
      api_key: os.environ/FOO_BAR

Note that the api_key is using a custom env var name.

Then I tried to use search and got following error

WebSearchInterception:
  Search 0 failed with error: litellm.APIConnectionError: APIConnectionError: PerplexityException - PERPLEXITYAI_API_KEY is not set. Set
  `PERPLEXITYAI_API_KEY` environment variable.

I would expect LLM to use env var name specified by me in the config, not forced hardcoded value.

Steps to Reproduce

  1. set FOO_BAR env var containing Perplexity API key
  2. configure perplexity search tool
  3. call search tool

Relevant log output

WebSearchInterception:
  Search 0 failed with error: litellm.APIConnectionError: APIConnectionError: PerplexityException - PERPLEXITYAI_API_KEY is not set. Set
  `PERPLEXITYAI_API_KEY` environment variable.

What part of LiteLLM is this about?

Proxy

What LiteLLM version are you on ?

v1.83.13

Twitter / LinkedIn details

No response

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

litellm - 💡(How to fix) Fix [Bug]: Perplexity search ignores custom env api key [1 pull requests]