Skip to content

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

Draft
velzie with Copilot wants to merge 8 commits into
devfrom
copilot/review-models-provider-process
Draft

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

Conversation

CopilotAI commented Feb 3, 2026

Copy link
Copy Markdown

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:awaitBunProc.install("@mymediset/sap-ai-provider","latest")constfn=mod[Object.keys(mod).find(k=>k.startsWith("create"))]constsdk=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.

CopilotAIand 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>
CopilotAI changed the title [WIP] Investigate adding new models and providers to Opencodedocs: Document provider/model addition process and models.dev integrationFeb 3, 2026
CopilotAI requested a review from velzieFebruary 3, 2026 20:55
CopilotAIand 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>
CopilotAI changed the title docs: Document provider/model addition process and models.dev integrationdocs: Fix provider addition guide to use real repo examplesFeb 3, 2026
… on models.dev
Co-authored-by: velzie <58010778+velzie@users.noreply.github.com>
CopilotAI changed the title docs: Fix provider addition guide to use real repo examplesdocs: Document provider addition process with real examplesFeb 3, 2026
Co-authored-by: velzie <58010778+velzie@users.noreply.github.com>
CopilotAI changed the title docs: Document provider addition process with real examplesdocs: Document provider addition process and npm package architectureFeb 3, 2026
Sign up for freeto 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

@velzie