Skip to content

Gaotax2006 [ Elixir ] Fix #95: Add OpenRouter LLM provider#741

Open
gtx20060124-bot wants to merge 5 commits into
Spectral-Finance:mainfrom
gtx20060124-bot:issues/95
Open

Gaotax2006 [ Elixir ] Fix #95: Add OpenRouter LLM provider#741
gtx20060124-bot wants to merge 5 commits into
Spectral-Finance:mainfrom
gtx20060124-bot:issues/95

Conversation

@gtx20060124-bot

Copy link
Copy Markdown

Fixes #95

Add OpenRouter LLM provider following the OpenAI provider pattern, allowing Lux to route through OpenRouter's unified API for access to multiple LLM models.

Files changed

  • lux/lib/lux/llm/open_router.ex

Acceptance checklist

  • Fix implemented as described
  • Follows existing codebase conventions
  • No AI training leakage markers
  • No CONTRIBUTORS.json modifications
  • No build artifacts committed

@MyTH-zyxeon

Copy link
Copy Markdown

Maintainer-facing acceptance review for #95 / PR #741. I do not have a claim on this bounty.

I rechecked the PR diff against the OpenRouter Integration acceptance criteria. The provider follows the broad existing LLM shape, but I would hold merge/payment until these concrete gates are cleared:

  • Config.endpoint is defined but not used; the request always sends to @endpoint, so tests or deploy config cannot redirect the provider to a fake endpoint or future OpenRouter-compatible URL.
  • Application.get_env(:lux, :open_router_models)[:default] and Application.get_env(:lux, :api_keys)[:openrouter] can crash or silently produce Bearer nil when config is absent. This needs an explicit local error before any HTTP request.
  • json_response defaults to true and appends "Reply in json format" to every message, but config.messages can include caller-provided message maps that may not use atom keys. %{&1 | content: &1.content <> ...} can fail before the request, and it also changes existing system/assistant messages rather than only the new prompt.
  • parse_content/1 rejects valid plain-text model output unless JSON mode succeeds. That may be acceptable for a strict JSON provider, but OpenRouter Integration $500 #95 asks for a unified OpenRouter provider, so the boundary between text mode, JSON mode, and schema mode should be tested explicitly.
  • Tool execution still uses Jason.decode! for function arguments and accumulates results in reverse order. Malformed tool-call JSON should return a stable error tuple, and result order should match the model's tool-call order.
  • There are no tests/docs in this PR despite OpenRouter Integration $500 #95 requiring integration tests, documentation, error handling/retries, and cost tracking/reporting. Current metadata passes through cost/total_cost when present, but there is no tested accounting or retry/rate-limit behavior.

Suggested merge gate: add Req.Test or equivalent no-network tests for configurable endpoint, missing config/API key, text-vs-JSON response modes, malformed tool-call arguments, tool result ordering, and OpenRouter error/rate-limit responses before treating this as complete #95 coverage.

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.

OpenRouter Integration $500

2 participants