Skip to content

Conversation

@jerome-benoit
Copy link
Contributor

Add SAP AI Core provider integration using @mymediset/sap-ai-provider package. Enables access to 40+ models via SAP BTP. Configuration via SAP_AI_SERVICE_KEY environment variable.

Copy link
Contributor Author

@jerome-benoit jerome-benoit left a comment

Choose a reason for hiding this comment

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

[Duplicate - please ignore, see next comment]

Copy link
Contributor Author

@jerome-benoit jerome-benoit left a comment

Choose a reason for hiding this comment

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

Thanks for the automated reviews! I've addressed all comments in commit 85dc856:

#2586265498 (Deployment ID): The ID d65d81e7c077e583 comes from official @mymediset/sap-ai-provider docs as a 'general-purpose deployment'. Updated docs to clarify these are configurable defaults.

#2586265951 (Documentation): ✅ Fixed - docs now accurately describe hardcoded defaults

#2586266385 (Unused parameter): ✅ Fixed - removed unused provider parameter

#2586266865 (Ternary): ✅ Fixed - simplified ternary expression

@wsx999outlook
Copy link

Good to go

@jerome-benoit jerome-benoit marked this pull request as ready for review December 3, 2025 19:48
Copilot AI review requested due to automatic review settings December 3, 2025 19:48
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds SAP AI Core as a new provider, enabling access to 40+ models from multiple vendors (OpenAI, Anthropic, Google, Amazon, Meta, Mistral, AI21) through SAP's BTP platform. The integration uses the @mymediset/sap-ai-provider package and supports configuration via environment variables or the /connect command.

  • Adds SAP AI Core provider implementation with support for service key authentication
  • Includes comprehensive documentation with setup instructions and environment variable configuration
  • Adds @mymediset/sap-ai-provider@1.3.1 package dependency

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.

File Description
packages/web/src/content/docs/providers.mdx Adds user-facing documentation for SAP AI Core setup and configuration
packages/opencode/src/provider/provider.ts Implements SAP AI Core provider loader with authentication and configuration handling
packages/opencode/package.json Adds dependency on @mymediset/sap-ai-provider package
bun.lock Updates lock file with new dependency and its transitive dependencies

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jerome-benoit
Copy link
Contributor Author

jerome-benoit commented Dec 3, 2025

Addressed in commit 25b413b

#2586418762 - Added SAP AI to BUNDLED_PROVIDERS and updated type to support async providers

#2586418775 - Removed custom getModel that recreated the provider on every call. Now uses default sdk.languageModel(modelID) pattern with proper caching.

@jerome-benoit
Copy link
Contributor Author

jerome-benoit commented Dec 3, 2025

⚠️ Blocked by models.dev PR

This PR requires anomalyco/models.dev#466 to be merged first.

Why: The custom loader depends on database['sap-ai-core'] which doesn't exist yet. Without the models.dev entry, mergeProvider() returns early at line 355.

Merge order: models.dev anomalyco/models.dev#466 → this PR

Comment on lines 284 to 293
"sap-ai-core": async () => {
const auth = await Auth.get("sap-ai-core")
const serviceKey = process.env["SAP_AI_SERVICE_KEY"] || (auth?.type === "api" ? auth.key : undefined)
const deploymentId = process.env["SAP_AI_DEPLOYMENT_ID"] || "d65d81e7c077e583"
const resourceGroup = process.env["SAP_AI_RESOURCE_GROUP"] || "default"

Copy link
Collaborator

Choose a reason for hiding this comment

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

does your provider not automatically respect these env vars?

Copy link
Contributor Author

@jerome-benoit jerome-benoit Dec 3, 2025

Choose a reason for hiding this comment

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

Unfortunately, no, createSAPAIProvider needs the options to be passed explicitly and being compatible with documented env vars on the vercel sdk package is a good practice.

@wsx999outlook
Copy link

It’s good to go

@wsx999outlook
Copy link

Looks good

@rekram1-node
Copy link
Collaborator

Okay this looks good to me if we can resolve the conflicts

Add integration for SAP AI Core using @mymediset/sap-ai-provider, enabling access to 40+ AI models (GPT-4o, Claude, Gemini, Amazon Nova, etc.) through SAP BTP.

Features:
- OAuth2 authentication with service key
- Support for 40+ models via SAP AI Core Orchestration API
- Configurable deployment ID and resource group
- Full Vercel AI SDK compatibility (streaming, tools, multi-modal)
- Environment variable configuration support

Configuration:
- SAP_AI_SERVICE_KEY: Service key from SAP BTP Cockpit
- SAP_AI_DEPLOYMENT_ID: Optional custom deployment (default: d65d81e7c077e583)
- SAP_AI_RESOURCE_GROUP: Optional resource group (default: default)

Documentation added to providers.mdx with setup instructions.
- Remove unused provider parameter
- Simplify ternary in options
- Fix misleading documentation about default values
Add support for async create...Provider functions.
The overhead is negligible sync the provider is created only once and cached.

Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
@jerome-benoit jerome-benoit force-pushed the feat/add-sap-ai-core-provider branch from d15fb81 to 6001775 Compare December 4, 2025 11:15
@rekram1-node rekram1-node merged commit b9c1f10 into anomalyco:dev Dec 4, 2025
3 checks passed
shuv1337 added a commit to Latitudes-Dev/shuvcode that referenced this pull request Dec 4, 2025
* fix: ensure checkUpgrade sets `init:` (anomalyco#5040)

* chore: format code

* ci: use blacksmith runners in review workflow too (anomalyco#5042)

* zen: make session provider sticky

* ci: only maintainer can trigger

* ci: cleaner

* ignore: update download stats 2025-12-04

* fix(tui): cursor color

* Preserve prompt input when creating new session (anomalyco#4993)

* fix: model not being passed correctly to tool

* tweak: bash tool messages regarding timeouts and truncation more clear for agent (anomalyco#5066)

* tui: fix /new slash command being persisted in prompt input

* add optional prompt Input to Github Action (anomalyco#4828)

Co-authored-by: Github Action <action@github.com>
Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com>
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>

* bump: builtin plugin versions

* feat: Add SAP AI Core provider support (anomalyco#5023)

Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>

* core: ensure model npm package falls back to dev models config when not explicitly defined

* docs: add CodeCompanion.nvim integration instructions (anomalyco#5079)

* tweak: bash tool description re commit stuff

* core: add test for custom model npm package inheritance

* feat(desktop): terminal pane (anomalyco#5081)

Co-authored-by: Github Action <action@github.com>
Co-authored-by: Dax Raad <d@ironbay.co>

* Revert "feat(desktop): terminal pane (anomalyco#5081)"

This reverts commit d763c11.

* release: v1.0.133

* sync: record last synced tag v1.0.133

---------

Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
Co-authored-by: YeonGyu-Kim <code.yeon.gyu@gmail.com>
Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: wsx99outlook <247713593+wsx99outlook@users.noreply.github.com>
Co-authored-by: Frank <frank@sst.dev>
Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
Co-authored-by: Adam <2363879+adamdotdevin@users.noreply.github.com>
Co-authored-by: Daniel Gray <DanielFGray@gmail.com>
Co-authored-by: Shantur Rathore <i@shantur.com>
Co-authored-by: Daniel Polito <danielbpolito@gmail.com>
Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com>
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
Co-authored-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
Co-authored-by: Dax Raad <d@ironbay.co>
Co-authored-by: Cason Adams <casonadams@gmail.com>
Co-authored-by: opencode <opencode@sst.dev>
shuv1337 added a commit to Latitudes-Dev/shuvcode that referenced this pull request Dec 5, 2025
* fix: ensure checkUpgrade sets `init:` (anomalyco#5040)

* chore: format code

* ci: use blacksmith runners in review workflow too (anomalyco#5042)

* zen: make session provider sticky

* ci: only maintainer can trigger

* ci: cleaner

* ignore: update download stats 2025-12-04

* fix(tui): cursor color

* Preserve prompt input when creating new session (anomalyco#4993)

* fix: model not being passed correctly to tool

* tweak: bash tool messages regarding timeouts and truncation more clear for agent (anomalyco#5066)

* tui: fix /new slash command being persisted in prompt input

* add optional prompt Input to Github Action (anomalyco#4828)

Co-authored-by: Github Action <action@github.com>
Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com>
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>

* bump: builtin plugin versions

* feat: Add SAP AI Core provider support (anomalyco#5023)

Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>

* core: ensure model npm package falls back to dev models config when not explicitly defined

* docs: add CodeCompanion.nvim integration instructions (anomalyco#5079)

* tweak: bash tool description re commit stuff

* core: add test for custom model npm package inheritance

* feat(desktop): terminal pane (anomalyco#5081)

Co-authored-by: Github Action <action@github.com>
Co-authored-by: Dax Raad <d@ironbay.co>

* Revert "feat(desktop): terminal pane (anomalyco#5081)"

This reverts commit d763c11.

* release: v1.0.133

* Update Nix flake.lock and hashes

* Reapply "feat(desktop): terminal pane (anomalyco#5081)"

This reverts commit f9dcd97.

* chore: format code

* Update Nix flake.lock and hashes

* zen: fix byok

* ignore: fix provider credentials query for BYOK

Provider credentials field was being selected from ProviderTable even when the table wasn't joined (when byokProvider was undefined). Now the join is conditional - when byokProvider exists, we join and get the credentials; when it doesn't, the join condition is always false so provider remains null.

* docs: llama.cpp docs: `limit` moved under model (anomalyco#5089)

Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
Co-authored-by: GitHub Action <action@github.com>

* fix: add getModel to SAP AI Core provider for correct SDK initialization (anomalyco#5086)

Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>

* fix pty builds

* fix

* increase default scroll speed

* ci: review

* fix: ensure that vcs is still set to git even if no commits in repo

* ignore: rm slop commnand (only for opencode repo this isnt shipping)

* chore: format code

* ignore: cmd tweak

* tui: wrap dialog option descriptions (anomalyco#5083)

* ci: keybinds

* fix: ensure projects that go from having no commits to having commits have sessions migrated (anomalyco#5105)

Co-authored-by: GitHub Action <action@github.com>

* ignore: tweak

* ignore: update download stats 2025-12-05

* Zen: add codex max

* do not use required pty for local dev

* fix: anomalyco#5064 ProviderInitError github-copilot-enterprise (anomalyco#5123)

* feat(theme): Vercel (anomalyco#5119)

Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
Co-authored-by: rekram1-node <rekram1-node@users.noreply.github.com>

* fix(desktop): new session not selecting tab

* fix(desktop): clone pty session on reconnect

* add experimental.open_telemetry config option to enable OTEL spans (anomalyco#4978)

Co-authored-by: noamzbr <noamzbr@users.noreply.github.com>
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
Co-authored-by: rekram1-node <rekram1-node@users.noreply.github.com>

* ignore: regen sdk

* fix(desktop): prompting

* fix(desktop): terminal cursor position

* feat: add max steps for supervisor and sub-agents (anomalyco#4062)

Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
Co-authored-by: rekram1-node <rekram1-node@users.noreply.github.com>

* tweak: bash tool improve output metadata for agent consumption, fix small timeout issue (anomalyco#5131)

* OpenCode Desktop app (anomalyco#5044)

Co-authored-by: Adam <2363879+adamdotdevin@users.noreply.github.com>

* Update Nix flake.lock and hashes

* release: v1.0.134

* sync: record last synced tag v1.0.134

* chore: format code

---------

Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
Co-authored-by: YeonGyu-Kim <code.yeon.gyu@gmail.com>
Co-authored-by: GitHub Action <action@github.com>
Co-authored-by: wsx99outlook <247713593+wsx99outlook@users.noreply.github.com>
Co-authored-by: Frank <frank@sst.dev>
Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
Co-authored-by: Adam <2363879+adamdotdevin@users.noreply.github.com>
Co-authored-by: Daniel Gray <DanielFGray@gmail.com>
Co-authored-by: Shantur Rathore <i@shantur.com>
Co-authored-by: Daniel Polito <danielbpolito@gmail.com>
Co-authored-by: Aiden Cline <63023139+rekram1-node@users.noreply.github.com>
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
Co-authored-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
Co-authored-by: Dax Raad <d@ironbay.co>
Co-authored-by: Cason Adams <casonadams@gmail.com>
Co-authored-by: opencode <opencode@sst.dev>
Co-authored-by: opencode-agent[bot] <219766164+opencode-agent[bot]@users.noreply.github.com>
Co-authored-by: ry2009 <134240944+ry2009@users.noreply.github.com>
Co-authored-by: Julian Visser <12615757+justmejulian@users.noreply.github.com>
Co-authored-by: Anthony Shew <anthonyshew@gmail.com>
Co-authored-by: rekram1-node <rekram1-node@users.noreply.github.com>
Co-authored-by: Noam Bressler <noamzbr@gmail.com>
Co-authored-by: noamzbr <noamzbr@users.noreply.github.com>
Co-authored-by: Nathan Thomas <nwthomas@me.com>
Co-authored-by: Brendan Allan <brendonovich@outlook.com>
@jerome-benoit jerome-benoit deleted the feat/add-sap-ai-core-provider branch December 5, 2025 22:37
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.

3 participants