Skip to content

feat(openrouter): fetch live model catalogue for the picker#140

Merged
owainlewis merged 1 commit into
mainfrom
feat/openrouter-live-models
Jun 22, 2026
Merged

feat(openrouter): fetch live model catalogue for the picker#140
owainlewis merged 1 commit into
mainfrom
feat/openrouter-live-models

Conversation

@owainlewis

Copy link
Copy Markdown
Owner

Summary

Replaces the hardcoded OpenRouter model list in the model picker with a live query against OpenRouter's public /models endpoint, so the picker never goes stale.

  • New openrouter.Models(ctx, httpClient): fetches, decodes, drops empty ids, sorts by id. Sends OPENROUTER_API_KEY if present (higher rate limits) but works without it.
  • Picker (cmd/neo): OpenRouter case now fetches live, time-boxed to 5s, with graceful fallback to the provider default on failure (offline/timeout/API change).
  • Config template: dropped hardcoded model ids from the provider examples in the embedded default + generated config docs; point users at each provider's live model list instead.

Tests

  • openrouter: mock-server tests for fetch/sort/blank-id filtering and non-OK status.
  • cmd/neo: fallback test (cancelled context still yields the default).
  • Full go test ./..., go vet, and neo-docs --check all pass.

Follow-up

OpenAI's api-key model list is still hardcoded (its /models endpoint needs a key and returns everything with no coding-suitability signal).

Replace the hardcoded OpenRouter model list in the model picker with a live
query against OpenRouter's public /models endpoint, so the list never goes
stale. Falls back to the provider default on fetch failure (offline/timeout)
and is time-boxed so startup never hangs.

Also refresh the config template (embedded default + generated config docs):
drop hardcoded model ids from the provider examples and point users at each
provider's live model list instead.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 677168e826

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread cmd/neo/main.go
if name == "" {
name = m.ID
}
choices = append(choices, tui.ModelChoice{ID: m.ID, Name: name, Description: m.Description})

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Filter OpenRouter choices to tool-capable models

When an OpenRouter user selects a catalogue entry that does not advertise tools in supported_parameters, normal chat turns will fail because internal/llm/chatcompletions.BuildRequest always sends Neo's tool specs and sets tool_choice whenever tools are registered. OpenRouter's /models response includes non-tool-capable models, and its docs describe supported_parameters as the field indicating tools support, but this loop adds every id without decoding/filtering that field, so the picker offers unusable models. Please filter the live catalogue to tool-capable text chat models before appending them.

Useful? React with 👍 / 👎.

@owainlewis owainlewis merged commit c590c2b into main Jun 22, 2026
2 checks passed
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