Skip to content

docs: add a combined oauth2 + models-info example#23

Merged
stephane-segning merged 1 commit into
mainfrom
docs/oauth2-combined-example
May 29, 2026
Merged

docs: add a combined oauth2 + models-info example#23
stephane-segning merged 1 commit into
mainfrom
docs/oauth2-combined-example

Conversation

@stephane-segning
Copy link
Copy Markdown
Contributor

Summary

Adds a concrete example of the two plugins working together — one provider authenticated by @vymalo/opencode-oauth2 and enriched by @vymalo/opencode-models-info. Docs-only.

{
  "plugin": ["@vymalo/opencode-oauth2", "@vymalo/opencode-models-info"],
  "provider": {
    "my-provider": {
      "npm": "@ai-sdk/openai-compatible",
      "options": {
        "baseURL": "https://api.example.com/v1",
        "oauth2": { "issuer": "https://auth.example.com", "clientId": "opencode-client", "scopes": ["openid", "profile", "offline_access"] },
        "meta": { "modelsInfoUrl": "https://api.example.com/v1/models" }
      }
    }
  }
}

Key point called out

List @vymalo/opencode-oauth2 first in the plugin array. Config hooks run in registration order, so oauth2 must run before models-info to stamp the bearer onto the provider headers before the metadata fetch happens. The example explains the boot sequence (oauth2 auth + discovery + bearer stamp → models-info fetch + enrich) and notes that no models block or Authorization header is needed.

Where

  • Top-level README — new "Both plugins together" subsection in the companion section.
  • Package README — new example under "Auth composition".

Markdown only → Biome unaffected (62 files clean).

🤖 Generated with Claude Code

Show one provider authenticated by @vymalo/opencode-oauth2 and enriched
by @vymalo/opencode-models-info, with the key gotcha called out: list
the oauth2 plugin first so its config hook stamps the bearer onto the
provider headers before models-info runs its fetch.

Added to the top-level README companion section and the package README's
Auth composition section. Uses the absolute modelsInfoUrl form for
clarity; no models block / Authorization header needed.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the documentation in README.md and packages/opencode-models-info/README.md to include examples of configuring the @vymalo/opencode-oauth2 and @vymalo/opencode-models-info plugins together. The feedback suggests changing the example modelsInfoUrl from https://api.example.com/v1/models to https://api.example.com/v1/models/info in both files to prevent confusion with standard model discovery endpoints that do not return rich metadata.

Comment thread README.md
Comment thread packages/opencode-models-info/README.md
@stephane-segning stephane-segning merged commit 6bbfa67 into main May 29, 2026
3 checks passed
@stephane-segning stephane-segning deleted the docs/oauth2-combined-example branch May 29, 2026 14:20
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