Skip to content

[jules] OpenRouter#5

Open
ronakice wants to merge 3 commits intomainfrom
jules_wip_5672977302345413455
Open

[jules] OpenRouter#5
ronakice wants to merge 3 commits intomainfrom
jules_wip_5672977302345413455

Conversation

@ronakice
Copy link
Copy Markdown
Member

@ronakice ronakice commented Jun 1, 2025

No description provided.

… done so far and provide feedback for Jules to continue.
This commit introduces support for using language models via OpenRouter.ai.

Key changes include:

1.  **Core LLM Handlers (`LLMHandler`, `AsyncLLMHandler`):**
    *   Modified to recognize "openrouter" as an `api_type`.
    *   Can automatically detect OpenRouter usage if the model name is prefixed with "openrouter/".
    *   Handle OpenRouter API key retrieval (from `OPENROUTER_API_KEY` env var or direct `api_keys` param).
    *   Set the correct API base URL (`https://openrouter.ai/api/v1` by default, configurable via `api_base` param).
    *   Initialize OpenAI/AsyncOpenAI clients appropriately for OpenRouter.
    *   Support API key rotation for OpenRouter keys.

2.  **API Key Utilities (`utils/api.py`):**
    *   Added `get_openrouter_api_key()` function to fetch keys from the environment.

3.  **Examples (`examples/e2e.py`, `examples/async_e2e.py`):**
    *   Added command-line arguments (`--api_type`, `--api_base`, `--api_key`) to allow easy configuration and testing of different API providers, including OpenRouter.
    *   Updated example instantiation of `Nuggetizer`/`AsyncNuggetizer` to pass these through.

4.  **Testing (`tests/core/test_llm.py`):**
    *   Created new test suite for `LLMHandler` and `AsyncLLMHandler`.
    *   Added comprehensive unit tests for OpenRouter integration, covering various initialization scenarios (model prefix, `api_type` parameter, custom base URL, direct API key), API key error handling, and API key rotation.

5.  **Documentation (`README.md`):**
    *   Updated to include instructions on configuring and using OpenRouter models.
    *   Added details on setting the `OPENROUTER_API_KEY` environment variable.
    *   Provided examples of initializing `Nuggetizer` with OpenRouter models.
    *   Updated example command lines to show OpenRouter usage.

This integration allows you to leverage a wider range of models available through OpenRouter, enhancing the flexibility of the nuggetizer library.
@ronakice
Copy link
Copy Markdown
Member Author

ronakice commented Mar 1, 2026

PR Comment Addressing Summary

Round: 1
Date: 2026-03-01

Addressed comments

File Source Verdict Summary
N/A N/A NOT APPLICABLE No unresolved review threads, no top-level review comments, and no inline PR comments were present.

CI failures fixed

  • None in this pass.
  • No checks are currently reported for this PR branch.

Verdict totals

  • FIXED: 0
  • ACKNOWLEDGED: 0
  • WON'T FIX: 0
  • NOT APPLICABLE: 1
  • NEEDS HUMAN INPUT: 0

Deferred items / TODOs

  • None.

Open NEEDS HUMAN INPUT items

  • None.

@ronakice
Copy link
Copy Markdown
Member Author

ronakice commented Mar 1, 2026

PR Comment Addressing Summary

Round: 2
Date: 2026-03-01
Commit: 50a9b5e

Addressed comments

File Source Verdict Summary
tests/core/test_llm.py Local CI validation FIXED Resolved Ruff F841 unused-variable failures and corrected OpenRouter key patch targets/rotation assertions so the updated tests execute reliably.
N/A Review threads NOT APPLICABLE No unresolved inline review threads were present on this PR at processing time.

CI failures fixed

  • ruff check on changed Python files: fixed and passing.
  • pytest -q tests/core/test_llm.py: passing (14 passed).
  • gh pr checks: no checks currently reported for this branch.

Verdict totals

  • FIXED: 1
  • ACKNOWLEDGED: 0
  • WON'T FIX: 0
  • NOT APPLICABLE: 1
  • NEEDS HUMAN INPUT: 0

Deferred items / TODOs

  • None.

Open NEEDS HUMAN INPUT items

  • None.

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