Skip to content

feat: add optional llm extra with OpenRouter client - #25

Open
m-messer wants to merge 1 commit into
cli-groupfrom
llm-client
Open

feat: add optional llm extra with OpenRouter client#25
m-messer wants to merge 1 commit into
cli-groupfrom
llm-client

Conversation

@m-messer

@m-messer m-messer commented Sep 1, 2026

Copy link
Copy Markdown
Member

New in2lambda.llm package behind a Poetry llm extra (pip install 'in2lambda[llm]'openai, python-dotenv, pydantic):

  • client.get_client() returns an openai.OpenAI pointed at https://openrouter.ai/api/v1, keyed by $OPENROUTER_API_KEY (loaded from a .env file if present). Clear RuntimeError when the extra is missing or the key is unset.
  • client.resolve_model() picks the model slug: --model value, else $IN2LAMBDA_MODEL, else DEFAULT_MODEL (openai/gpt-4o-mini).

The package imports cleanly without the extra (openai/dotenv guarded), so --doctest-modules still works on a bare install. CI now installs --all-extras. Tests are fully offline.

openai floor is ^1.55 — older releases resolve against a too-new httpx and break with a proxies TypeError.


Stack: cli-group ← llm-client ← mathpix ← wizard-command
Base: cli-group#24.

🤖 Generated with Claude Code

New in2lambda.llm package behind a Poetry `llm` extra
(pip install 'in2lambda[llm]' -> openai, python-dotenv, pydantic):

- client.get_client() returns an openai.OpenAI pointed at
  https://openrouter.ai/api/v1, keyed by $OPENROUTER_API_KEY (loaded from a
  .env file if present). Raises a clear RuntimeError when the extra is
  missing or the key is unset.
- client.resolve_model() picks the model slug: --model value, else
  $IN2LAMBDA_MODEL, else DEFAULT_MODEL (openai/gpt-4o-mini).

The package imports cleanly without the extra (openai/dotenv guarded), so
--doctest-modules still works on a bare install. CI now installs
--all-extras so the llm code is covered. Tests are fully offline.

openai floor is ^1.55 - older releases resolve against a too-new httpx and
break with a `proxies` TypeError.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017VXb8aZqgFBjoeuuddjW6r
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