Skip to content

Studio: load OpenRouter models from the API - #16562

Merged
Lyxot merged 8 commits into
unslothai:mainfrom
NilayYadav:studio-openrouter-live-catalog
Nov 4, 2026
Merged

Lyxot merged 8 commits into
unslothai:mainfrom
NilayYadav:studio-openrouter-live-catalog

Conversation

@NilayYadav

@NilayYadav NilayYadav commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

The OpenRouter model list in Studio was hardcoded and had gone stale. 8 of the 18 models in it no longer exist on OpenRouter (anthropic/claude-sonnet-4-5, deepseek/deepseek-r1, mistralai/mistral-large-2411, ...), so picking one just fails. "Reload models" was also disabled for OpenRouter, so the only way to use a newer model was to type its id by hand.

OpenRouter now loads its model list from https://openrouter.ai/api/v1/models. That endpoint doesn't need a key, so the list shows up as soon as you pick OpenRouter in the form. The backend caches the list for an hour and serves the last good copy if a refresh fails, so opening the form stays fast and nothing is fetched at startup. Only models that can chat are shown, newest first.

The suggested models at the top are now OpenRouter's ~*-latest aliases (like ~anthropic/claude-sonnet-latest) plus openrouter/free and openrouter/auto. OpenRouter keeps those aliases pointed at the newest model, so this list shouldn't need updating by hand again.

With today's catalog the form goes from 18 models (8 of them dead) to 380.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-04T06:55:25.898355Z 5e4aff5 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@NilayYadav

Copy link
Copy Markdown
Collaborator Author

@codex review

1 similar comment
@NilayYadav

Copy link
Copy Markdown
Collaborator Author

@codex review

@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: c75e4a0c3b

ℹ️ 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".

chatgpt-codex-connector[bot]

This comment was marked as resolved.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 0a46c5d943

ℹ️ 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".

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Nov 3, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Nov 3, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Nov 3, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Nov 3, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Nov 3, 2026
@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Nov 3, 2026
chatgpt-codex-connector[bot]

This comment was marked as resolved.

@unslothai unslothai deleted a comment from chatgpt-codex-connector Bot Nov 4, 2026
@NilayYadav

Copy link
Copy Markdown
Collaborator Author

@codex review

1 similar comment
@NilayYadav

Copy link
Copy Markdown
Collaborator Author

@codex review

@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: 783f70f006

ℹ️ 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".

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 783f70f006

ℹ️ 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".

@Lyxot Lyxot self-assigned this Nov 4, 2026
…tions and saving

Lock the catalog cache per base URL and key instead of globally, and back off for a minute after a failed refresh that serves the cached copy, so a slow endpoint no longer queues every other connection's catalog request behind repeated timeouts. The automatic catalog load on the OpenRouter form now has its own loading state, so it shows on the Reload button without disabling Save, and each load is retired by request when the form changes, closes or unmounts, so a late response cannot overwrite newer state.
@Lyxot

Lyxot commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

Pushed 5e4aff5 on top of this branch. It fixes three things I hit while reviewing:

  • One lock for every connection. The catalog cache used one global lock held during the network fetch, so a slow endpoint stalled every other connection's model list. After a failed refresh, every queued request also retried in turn. Locks are now per base URL and key. A failed refresh that serves the cached copy now waits a minute before trying again.
  • Save blocked while the list loads. The automatic load on the OpenRouter form set modelsLoading, which disables Save. Just opening the form disabled Save until the fetch finished. The automatic load now has its own state, which only drives the Reload spinner.
  • Late responses overwriting newer state. An automatic-load response could still be applied after the same connection was closed and reopened, or after the dialog unmounted. Each load is now its own request, checked by identity and retired by the effect's cleanup.

Tests cover each of these and each was mutation-checked: the backend tests now overlap concurrent requests, and there are new frontend source checks.

@Lyxot

Lyxot commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

@codex review

1 similar comment
@NilayYadav

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 5e4aff557b

ℹ️ 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".

@Lyxot

Lyxot commented Nov 4, 2026

Copy link
Copy Markdown
Collaborator

Review done on head 5e4aff557bf.

@Lyxot Lyxot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM. The live catalog replaces the stale hardcoded list. Codex converged, staging CI is green, and a trial merge onto current main passes the related tests.

@Lyxot
Lyxot merged commit 9e1b9d5 into unslothai:main Nov 4, 2026
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.

2 participants