Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/opencode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"@hono/standard-validator": "0.1.5",
"@hono/zod-validator": "catalog:",
"@modelcontextprotocol/sdk": "1.15.1",
"@mymediset/sap-ai-provider": "1.3.1",
"@octokit/graphql": "9.0.2",
"@octokit/rest": "22.0.0",
"@openauthjs/openauth": "catalog:",
Expand Down
27 changes: 27 additions & 0 deletions packages/opencode/src/provider/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { createOpenAI } from "@ai-sdk/openai"
import { createOpenAICompatible } from "@ai-sdk/openai-compatible"
import { createOpenRouter } from "@openrouter/ai-sdk-provider"
import { createOpenaiCompatible as createGitHubCopilotOpenAICompatible } from "./sdk/openai-compatible/src"
import { createSAPAIProvider } from "@mymediset/sap-ai-provider"

export namespace Provider {
const log = Log.create({ service: "provider" })
Expand Down Expand Up @@ -279,6 +280,32 @@ export namespace Provider {
},
}
},
"sap-ai-core": async (provider) => {
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"

return {
autoload: !!serviceKey,
getModel: async (sdk, modelID, options) => {
const sapaiProvider = await createSAPAIProvider({
serviceKey,
deploymentId,
resourceGroup,
...options,
})
return sapaiProvider.languageModel(modelID)
},
options: serviceKey
? {
serviceKey,
deploymentId,
resourceGroup,
}
: {},
}
},
zenmux: async () => {
return {
autoload: false,
Expand Down
55 changes: 55 additions & 0 deletions packages/web/src/content/docs/providers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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, the provider will use default values from your SAP AI Core instance.
:::

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**.
Expand Down
Loading