Skip to content

docs: Document provider addition process and npm package architecture#2

Draft
Copilot wants to merge 8 commits intodevfrom
copilot/review-models-provider-process
Draft

docs: Document provider addition process and npm package architecture#2
Copilot wants to merge 8 commits intodevfrom
copilot/review-models-provider-process

Conversation

Copy link

Copilot AI commented Feb 3, 2026

What does this PR do?

Documents how to add providers to OpenCode. Corrects misconception that providers must be on models.dev.

Key findings:

  • Most providers use single PR - models.dev is optional metadata registry, not requirement
  • API URLs come from npm packages, not OpenCode - OpenCode dynamically installs packages at runtime via BunProc.install()
  • PRs are small because they only add integration code (auth, config), not API clients

Architecture:

// In OpenCode PR (integration only):
"sap-ai-core": async () => ({
  autoload: !!serviceKey,
  options: { serviceKey, deploymentId, resourceGroup },
})

// Runtime behavior:
await BunProc.install("@mymediset/sap-ai-provider", "latest")
const fn = mod[Object.keys(mod).find(k => k.startsWith("create"))]
const sdk = fn({ name: "sap-ai-core", ...options })
// npm package contains API URL, request/response logic

Real example: SAP AI Core PR #5023 - added provider with single PR, NOT on models.dev, supports 40+ models via @mymediset/sap-ai-provider package.

Files created:

  1. ADDING_PROVIDERS_MODELS.md (616 lines)

    • Three approaches: OpenCode-only (common), models.dev + OpenCode (rare), config-only (personal)
    • npm package architecture explanation
    • Dynamic vs bundled provider loading
    • Real examples: SAP AI Core, openrouter, vercel
  2. PROVIDER_ADDITION_SUMMARY.md (249 lines) - Quick reference with decision tree

  3. Updated CONTRIBUTING.md - Links to new guide

How did you verify your code works?

  • Analyzed packages/opencode/src/provider/provider.ts - traced provider loading (lines 1045-1072 show bundled vs dynamic installation)
  • Verified SAP AI Core exists in codebase, NOT in models.dev repo
  • Confirmed npm package architecture: packages provide API URLs, OpenCode provides integration
  • Traced models.dev flow: fetched from https://models.dev/api.json, cached locally, optional for providers

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits February 3, 2026 20:52
Co-authored-by: velzie <58010778+velzie@users.noreply.github.com>
Co-authored-by: velzie <58010778+velzie@users.noreply.github.com>
Co-authored-by: velzie <58010778+velzie@users.noreply.github.com>
Copilot AI changed the title [WIP] Investigate adding new models and providers to Opencode docs: Document provider/model addition process and models.dev integration Feb 3, 2026
Copilot AI requested a review from velzie February 3, 2026 20:55
Copilot AI and others added 2 commits February 3, 2026 21:04
Co-authored-by: velzie <58010778+velzie@users.noreply.github.com>
Co-authored-by: velzie <58010778+velzie@users.noreply.github.com>
Copilot AI changed the title docs: Document provider/model addition process and models.dev integration docs: Fix provider addition guide to use real repo examples Feb 3, 2026
… on models.dev

Co-authored-by: velzie <58010778+velzie@users.noreply.github.com>
Copilot AI changed the title docs: Fix provider addition guide to use real repo examples docs: Document provider addition process with real examples Feb 3, 2026
Co-authored-by: velzie <58010778+velzie@users.noreply.github.com>
Copilot AI changed the title docs: Document provider addition process with real examples docs: Document provider addition process and npm package architecture Feb 3, 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