Skip to content

Conversation

@STRRL
Copy link
Contributor

@STRRL STRRL commented Jun 20, 2025

Describe Your Changes

  • update header template for openrouter, add HTTP-Referer: https://jan.ai, X-Title: Jan

reference: https://openrouter.ai/docs/api-reference/overview#headers

Fixes Issues

Self Checklist

  • Added relevant comments, esp in complex areas
  • Updated docs (for bug fixes / features)
  • Created issues for follow-up changes or refactoring needed

Important

Update header_template in openrouter.json to include HTTP-Referer and X-Title headers for OpenRouter API requests.

  • Behavior:
    • Update header_template in openrouter.json to include HTTP-Referer: https://jan.ai and X-Title: Jan for OpenRouter API requests.
  • References:

This description was created by Ellipsis for 7a8a38a. You can customize this summary. It will automatically update as commits are pushed.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Looks good to me! 👍

Reviewed everything up to 7a8a38a in 1 minute and 34 seconds. Click for details.
  • Reviewed 13 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. extensions/engine-management-extension/resources/openrouter.json:9
  • Draft comment:
    Ensure header entries are properly delimited. If the consuming code expects multiple headers to be separated by newlines (e.g., '\n'), update the template accordingly.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50% The comment raises a valid concern about HTTP header formatting. HTTP headers are typically separated by newlines in raw HTTP requests. However, without seeing the code that consumes this template, we don't know if newlines are required - the consuming code might handle space-separated headers just fine. The comment is speculative since it starts with "Ensure" and depends on implementation details we can't see. I might be wrong about dismissing this - improper header formatting could cause API requests to fail. This could be a real issue. While header formatting is important, without seeing the consuming code, this comment is speculative. It starts with "Ensure" which violates our rules, and asks the author to verify something rather than pointing out a definite issue. The comment should be deleted because it's speculative and asks for verification rather than pointing out a definite issue. We don't have strong evidence that the current format is problematic.
2. extensions/engine-management-extension/resources/openrouter.json:9
  • Draft comment:
    It looks like the header template now includes multiple header fields in a single string. In particular, check the term "HTTP-Referer" – if you intend to use the standard header, it is usually just "Referer". Please verify if this is intentional or a typographical error.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% This is a tricky case. While "HTTP-Referer" is indeed non-standard compared to just "Referer", we don't know if OpenRouter specifically requires this format. The comment suggests a change but without strong evidence that it would work. The current format might be intentional for OpenRouter's specific requirements. We don't have access to OpenRouter's API documentation to verify the correct header format. The current format might be specifically required by OpenRouter. Without clear evidence that this is incorrect and would break functionality, we shouldn't suggest changing it. Delete the comment. While it raises an interesting point about HTTP headers, we don't have strong evidence that the current format is wrong or that the suggested change would work with OpenRouter's API.

Workflow ID: wflow_5D7iYeSBEPSKW6Xs

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

louis-jan
louis-jan previously approved these changes Jun 20, 2025
Copy link
Contributor

@louis-jan louis-jan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's awesome. Thanks!!!

@louis-jan
Copy link
Contributor

Oops! I just noticed that we don't route the request via this extension any longer. Can you help me verify the fix again? I think it should be done from useChat hook or completion.

@louis-jan louis-jan self-requested a review June 20, 2025 06:32
@louis-jan louis-jan dismissed their stale review June 20, 2025 06:41

Update needed

@STRRL
Copy link
Contributor Author

STRRL commented Jun 20, 2025

Hi @louis-menlo ! I have updated code. PTAL ❤️

But I can not test on my local machine because when I execute make dev it tells me the dep rmcp can not be resolved properly:


....

♻️  Generating routes...
✅ Processed routes in 83ms

  VITE v6.3.2  ready in 555 ms

  ➜  Local:   http://localhost:1420/
     Running DevCommand (`cargo  run --no-default-features --color always --`)
        Info Watching /Users/strrl/playground/GitHub/jan/src-tauri for changes...
    Updating git repository `https://github.com/modelcontextprotocol/rust-sdk`
error: no matching package named `rmcp` found
location searched: https://github.com/modelcontextprotocol/rust-sdk?rev=c1c4c9a0c9afbfbbf9eb42d6f8b00d8546fbdc2c
required by package `Jan v0.5.16 (/Users/strrl/playground/GitHub/jan/src-tauri)`

Should I open another issue for that? Or I missed something ... thanks!

@louis-jan
Copy link
Contributor

Looks great now, thanks @STRRL. I'll do some tests and then proceed with the merge.

@louis-jan
Copy link
Contributor

I encountered an issue where Token.JS (an inference middleware dependency) injected a referer URL. We'll fix it and then proceed with this PR.
CleanShot 2025-06-21 at 15 44 23@2x

@STRRL
Copy link
Contributor Author

STRRL commented Jun 21, 2025

Looking forward to your good news! 🤞

@louis-jan louis-jan requested a review from samhvw8 June 23, 2025 03:25
@samhvw8 samhvw8 assigned samhvw8 and unassigned samhvw8 Jun 23, 2025
@louis-jan louis-jan changed the base branch from dev to release/v0.6.2 June 24, 2025 08:23
@louis-jan
Copy link
Contributor

Hi @STRRL can you please help rebase release/v0.6.2. We are scheduling this fix into the upcoming patch release.

@STRRL
Copy link
Contributor Author

STRRL commented Jun 24, 2025

No problem! I will take a look!

@louis-jan louis-jan changed the base branch from release/v0.6.2 to release/v0.6.4 June 29, 2025 13:50
@louis-jan louis-jan changed the base branch from release/v0.6.4 to dev June 29, 2025 13:51
@louis-jan
Copy link
Contributor

@samhvw8 can you work with @STRRL to resolve conflict and proceed?

@LazyYuuki LazyYuuki moved this to In Progress in Jan Jul 3, 2025
@samhvw8
Copy link
Contributor

samhvw8 commented Jul 3, 2025

@STRRL how can i help you to complete this pr ?

@louis-jan
Copy link
Contributor

Hi @STRRL please help resolve conflict, we will merge then

@STRRL
Copy link
Contributor Author

STRRL commented Jul 6, 2025

sorry for the late reponse, updated PTAL @louis-menlo @samhvw8

Copy link
Contributor

@louis-jan louis-jan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@louis-jan louis-jan merged commit 9696589 into janhq:dev Jul 7, 2025
5 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to QA in Jan Jul 7, 2025
@LazyYuuki LazyYuuki added this to the v0.6.5 milestone Jul 7, 2025
louis-jan added a commit that referenced this pull request Jul 7, 2025
@louis-jan
Copy link
Contributor

Cherry-picked into version 0.6.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

feat: identifies Jan on openrouter

4 participants