Skip to content
Merged
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
2 changes: 2 additions & 0 deletions packages/opencode/src/provider/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,8 @@ export namespace ProviderTransform {
model.providerID === "anthropic" ||
model.api.id.includes("anthropic") ||
model.api.id.includes("claude") ||
model.id.includes("anthropic") ||
model.id.includes("claude") ||
model.api.npm === "@ai-sdk/anthropic"
) {
msgs = applyCaching(msgs, model.providerID)
Expand Down
35 changes: 35 additions & 0 deletions packages/opencode/test/provider/transform.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -996,6 +996,41 @@ describe("ProviderTransform.message - providerOptions key remapping", () => {
})
})

describe("ProviderTransform.message - claude w/bedrock custom inference profile", () => {
test("adds cachePoint", () => {
const model = {
id: "amazon-bedrock/custom-claude-sonnet-4.5",
providerID: "amazon-bedrock",
api: {
id: "arn:aws:bedrock:xxx:yyy:application-inference-profile/zzz",
url: "https://api.test.com",
npm: "@ai-sdk/amazon-bedrock",
},
name: "Custom inference profile",
capabilities: {},
options: {},
headers: {},
} as any

const msgs = [
{
role: "user",
content: "Hello",
},
] as any[]

const result = ProviderTransform.message(msgs, model, {})

expect(result[0].providerOptions?.bedrock).toEqual(
expect.objectContaining({
cachePoint: {
type: "ephemeral",
},
}),
)
})
})

describe("ProviderTransform.variants", () => {
const createMockModel = (overrides: Partial<any> = {}): any => ({
id: "test/test-model",
Expand Down
21 changes: 21 additions & 0 deletions packages/web/src/content/docs/providers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,27 @@ To use Amazon Bedrock with OpenCode:
/models
```

:::note
For custom inference profiles, use the model and provider name in the key and set the `id` property to the arn. This ensures correct caching:

```json title="opencode.json"
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"amazon-bedrock": {
// ...
"models": {
"anthropic-claude-sonnet-4.5": {
"id": "arn:aws:bedrock:us-east-1:xxx:application-inference-profile/yyy"
}
}
}
}
}
```

:::

---

### Anthropic
Expand Down