Skip to content

fix(studio): accept trailing slash for model discovery - #9876

Merged
mahiatlinux merged 1 commit into
unslothai:mainfrom
Imagineer99:fix/devonthink-model-discovery
Aug 28, 2026
Merged

mahiatlinux merged 1 commit into
unslothai:mainfrom
Imagineer99:fix/devonthink-model-discovery

Conversation

@Imagineer99

@Imagineer99 Imagineer99 commented Aug 27, 2026 •

Copy link
Copy Markdown
Member

Summary

  • register /v1/models/ as a direct compatibility alias for /v1/models
  • keep the alias out of OpenAPI while preserving the existing authentication dependency
  • cover both paths in the router contract test

Why

DEVONthink probes GET /v1/models/ when configuring an OpenAI-compatible provider. Without an explicit collection route for the trailing-slash form, the existing /models/{model_id:path} catch-all consumes the empty path segment and returns an authenticated 404 model_not_found response instead of the model catalog.

Registering /v1/models/ directly makes that request return the same OpenAI-compatible catalog as /v1/models.

DEVONthink documents the required discovery endpoint here: https://discourse.devontechnologies.com/t/how-to-use-an-api-gateway/84925/5

Validation

  • python3 -m py_compile studio/backend/routes/inference.py studio/backend/tests/test_openai_auto_switch.py
  • verified both route decorators and the get_current_subject dependency via AST
  • git diff --check

@danielhanchen

Copy link
Copy Markdown
Member

Confirmed that on main a GET to /v1/models/ falls through to the retrieve route at studio/backend/routes/inference.py:22411 and comes back empty rather than listing the catalog, so the alias does fix a real discovery failure. Note the redirect described in the summary is not what happens here; will get this reviewed.

@mahiatlinux
mahiatlinux self-requested a review August 28, 2026 02:57
@mahiatlinux

Copy link
Copy Markdown
Contributor

@codex review

@mahiatlinux mahiatlinux left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, reviewed the changes. Does what it needs to do.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 5270322097

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

@mahiatlinux
mahiatlinux merged commit 0a472c7 into unslothai:main Aug 28, 2026
42 of 48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants