Find answers from the community

Updated last month

How To Make Use Of Openrouter App Name/url

At a glance

The community member is asking how to use the OpenRouter app name/url and the extra_headers parameter, specifically the "HTTP-Referer" and "X-Title" fields. They mention that LlamaIndex has a default_headers parameter, but they haven't seen anyone use it with OpenRouter and haven't been able to do it themselves. In the comments, another community member suggests using additional_kwargs={"extra_headers": {....}}, which the original poster confirms worked for them.

Useful resources
How to make use of OpenRouter app name/url?

https://openrouter.ai/google/gemini-2.0-flash-001/api
the endpoint takes this:
Plain Text
extra_headers={
  "HTTP-Referer": "<YOUR_LLAMAINDEX_APP_URL>", # Optional. Site URL for rankings on openrouter.ai.
  "X-Title": "<YOUR_LLAMAINDEX_APP_NAME>", # Optional. Site title for rankings on openrouter.ai.
}


LlamaIndex has a default_headers, but I haven't seen anyone use it with OpenRouter. And I haven't managed to do it myself.
https://github.com/search?q=repo%3Arun-llama%2Fllama_index%20default_headers&type=code
L
n
3 comments
additional_kwargs={"extra_headers": {....}}
You are a hero. This worked in first go. Yay. Have a great day πŸ™‚
Add a reply
Sign up and join the conversation on Discord