summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJérôme Benoit <[email protected]>2025-12-04 21:07:23 +0100
committerGitHub <[email protected]>2025-12-04 14:07:23 -0600
commitb9c1f100160d663e6372cf114d1d86d4c9575237 (patch)
tree4f06460a72c9b6b108e64dc4e53fb71cd3528ff6
parent8a0c86cbdb0f8fb2a7cf281d5a1dffb3291f40c7 (diff)
downloadopencode-b9c1f100160d663e6372cf114d1d86d4c9575237.tar.gz
opencode-b9c1f100160d663e6372cf114d1d86d4c9575237.zip
feat: Add SAP AI Core provider support (#5023)
Signed-off-by: Jérôme Benoit <[email protected]>
-rw-r--r--packages/opencode/src/provider/provider.ts13
-rw-r--r--packages/web/src/content/docs/providers.mdx55
2 files changed, 67 insertions, 1 deletions
diff --git a/packages/opencode/src/provider/provider.ts b/packages/opencode/src/provider/provider.ts
index 54367bcfe..ee081d87e 100644
--- a/packages/opencode/src/provider/provider.ts
+++ b/packages/opencode/src/provider/provider.ts
@@ -285,6 +285,17 @@ export namespace Provider {
},
}
},
+ "sap-ai-core": async () => {
+ const auth = await Auth.get("sap-ai-core")
+ const serviceKey = Env.get("SAP_AI_SERVICE_KEY") || (auth?.type === "api" ? auth.key : undefined)
+ const deploymentId = Env.get("SAP_AI_DEPLOYMENT_ID") || "d65d81e7c077e583"
+ const resourceGroup = Env.get("SAP_AI_RESOURCE_GROUP") || "default"
+
+ return {
+ autoload: !!serviceKey,
+ options: serviceKey ? { serviceKey, deploymentId, resourceGroup } : {},
+ }
+ },
zenmux: async () => {
return {
autoload: false,
@@ -776,7 +787,7 @@ export namespace Provider {
const mod = await import(installedPath)
const fn = mod[Object.keys(mod).find((key) => key.startsWith("create"))!]
- const loaded = fn({
+ const loaded = await fn({
name: model.providerID,
...options,
})
diff --git a/packages/web/src/content/docs/providers.mdx b/packages/web/src/content/docs/providers.mdx
index bb284901f..e8534ceee 100644
--- a/packages/web/src/content/docs/providers.mdx
+++ b/packages/web/src/content/docs/providers.mdx
@@ -891,6 +891,61 @@ OpenCode Zen is a list of tested and verified models provided by the OpenCode te
---
+### SAP AI Core
+
+SAP AI Core provides access to 40+ models from OpenAI, Anthropic, Google, Amazon, Meta, Mistral, and AI21 through a unified platform.
+
+1. Go to your [SAP BTP Cockpit](https://account.hana.ondemand.com/), navigate to your SAP AI Core service instance, and create a service key.
+
+ :::tip
+ The service key is a JSON object containing `clientid`, `clientsecret`, `url`, and `serviceurls.AI_API_URL`. You can find your AI Core instance under **Services** > **Instances and Subscriptions** in the BTP Cockpit.
+ :::
+
+2. Run the `/connect` command and search for **SAP AI Core**.
+
+ ```txt
+ /connect
+ ```
+
+3. Enter your service key JSON.
+
+ ```txt
+ ┌ Service key
+ │
+ │
+ └ enter
+ ```
+
+ Or set the `SAP_AI_SERVICE_KEY` environment variable:
+
+ ```bash
+ SAP_AI_SERVICE_KEY='{"clientid":"...","clientsecret":"...","url":"...","serviceurls":{"AI_API_URL":"..."}}' opencode
+ ```
+
+ Or add it to your bash profile:
+
+ ```bash title="~/.bash_profile"
+ export SAP_AI_SERVICE_KEY='{"clientid":"...","clientsecret":"...","url":"...","serviceurls":{"AI_API_URL":"..."}}'
+ ```
+
+4. Optionally set deployment ID and resource group:
+
+ ```bash
+ SAP_AI_DEPLOYMENT_ID=your-deployment-id SAP_AI_RESOURCE_GROUP=your-resource-group opencode
+ ```
+
+ :::note
+ If not set, uses deployment ID `d65d81e7c077e583` (general-purpose) and resource group `default`. Configure these for your specific setup.
+ :::
+
+5. Run the `/models` command to select from 40+ available models.
+
+ ```txt
+ /models
+ ```
+
+---
+
### OVHcloud AI Endpoints
1. Head over to the [OVHcloud panel](https://ovh.com/manager). Navigate to the `Public Cloud` section, `AI & Machine Learning` > `AI Endpoints` and in `API Keys` tab, click **Create a new API key**.