[GH-ISSUE #3581] [FEAT]: showing citations when using Perplexity through OpenRouter #2312

Closed
opened 2026-02-22 18:29:07 -05:00 by yindo · 2 comments
Owner

Originally created by @rudimichal on GitHub (Apr 2, 2025).
Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/3581

What would you like to see?

AnythingLLM already shows citations when Perplexity is used through its own api #2827 . When accessing Perplexity through OpenRouter the citations are not shown.

I checked that OpenRouter does return these citations:

import os

from openai import OpenAI


def main():
    client = OpenAI(
        base_url="https://openrouter.ai/api/v1/",
        api_key=os.getenv("OPENROUTER_API_KEY"),
    )
    response = client.chat.completions.create(
        model="perplexity/sonar",
        messages=[
            {
                "role": "user",
                "content": [
                    {"type": "text", "text": "battle of waterloo"},
                ],
            },
        ],
    )

    print(response.citations)


if __name__ == "__main__":
    main()
Originally created by @rudimichal on GitHub (Apr 2, 2025). Original GitHub issue: https://github.com/Mintplex-Labs/anything-llm/issues/3581 ### What would you like to see? AnythingLLM already shows citations when Perplexity is used through its own api #2827 . When accessing Perplexity through OpenRouter the citations are not shown. I checked that OpenRouter does return these citations: ```python import os from openai import OpenAI def main(): client = OpenAI( base_url="https://openrouter.ai/api/v1/", api_key=os.getenv("OPENROUTER_API_KEY"), ) response = client.chat.completions.create( model="perplexity/sonar", messages=[ { "role": "user", "content": [ {"type": "text", "text": "battle of waterloo"}, ], }, ], ) print(response.citations) if __name__ == "__main__": main() ```
yindo added the enhancementfeature request labels 2026-02-22 18:29:07 -05:00
yindo closed this issue 2026-02-22 18:29:07 -05:00
Author
Owner

@timothycarambat commented on GitHub (Apr 2, 2025):

OpenRouter is an LLM aggregator and Perplexity is the only provider they have that does this. We do this since it is a unique perplexity feature, but it would be additional code for just a single model for OpenRouter

@timothycarambat commented on GitHub (Apr 2, 2025): OpenRouter is an LLM aggregator and Perplexity is the only provider they have that does this. We do this since it is a unique perplexity feature, but it would be additional code for _just a single model_ for OpenRouter
Author
Owner

@rudimichal commented on GitHub (Apr 2, 2025):

Not just for a single model since OpenRouter provides many more from Perplexity https://openrouter.ai/perplexity .

I thought that, since this feature already exists, it would just be applying this response post processing (moving the code to superclass or similar refactoring) to some openrouter responses. However, if it's not that easy, I get that there may be issues with higher priority :)

@rudimichal commented on GitHub (Apr 2, 2025): Not just for a single model since OpenRouter provides many more from Perplexity https://openrouter.ai/perplexity . I thought that, since this feature already exists, it would just be applying this response post processing (moving the code to superclass or similar refactoring) to some openrouter responses. However, if it's not that easy, I get that there may be issues with higher priority :)
yindo changed title from [FEAT]: showing citations when using Perplexity through OpenRouter to [GH-ISSUE #3581] [FEAT]: showing citations when using Perplexity through OpenRouter 2026-06-05 14:45:50 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mintplex-Labs/anything-llm#2312