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
37 changes: 17 additions & 20 deletions LOCAL_AWS_SETUP.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,44 +69,38 @@ Create `~/.config/opencode/opencode.json`:
"region": "<your-preferred-region>"
},
"models": {
"writer.palmyra-x4": {
"id": "us.writer.palmyra-x4-v1:0",
"writer.palmyra-x4-v1:0": {
"name": "Writer Palmyra X4",
"tool_call": false,
"limit": { "context": 128000, "output": 8192 }
},
"writer.palmyra-x5": {
"id": "us.writer.palmyra-x5-v1:0",
"writer.palmyra-x5-v1:0": {
"name": "Writer Palmyra X5",
"tool_call": false,
"limit": { "context": 1000000, "output": 8192 }
},
"deepseek.r1": {
"id": "us.deepseek.r1-v1:0",
"name": "DeepSeek R1",
"deepseek.r1-v1:0": {
"name": "DeepSeek R1 (A)",
"tool_call": false,
"reasoning": false,
"limit": { "context": 64000, "output": 32768 }
},
"mistral.pixtral-large-2502": {
"id": "us.mistral.pixtral-large-2502-v1:0",
"mistral.pixtral-large-2502-v1:0": {
"name": "Mistral Pixtral Large",
"tool_call": false,
"limit": { "context": 128000, "output": 8192 }
},
"meta.llama4-maverick-17b-instruct": {
"id": "us.meta.llama4-maverick-17b-instruct-v1:0",
"meta.llama4-maverick-17b-instruct-v1:0": {
"name": "Meta Llama 4 Maverick 17B",
"tool_call": false,
"limit": { "context": 1000000, "output": 8192 }
},
"meta.llama4-scout-17b-instruct": {
"id": "us.meta.llama4-scout-17b-instruct-v1:0",
"meta.llama4-scout-17b-instruct-v1:0": {
"name": "Meta Llama 4 Scout 17B",
"tool_call": false,
"limit": { "context": 10000000, "output": 8192 }
},
"amazon.nova-2-lite": {
"id": "us.amazon.nova-2-lite-v1:0",
"amazon.nova-2-lite-v1:0": {
"name": "Amazon Nova 2 Lite",
"limit": { "context": 300000, "output": 5120 }
}
Expand All @@ -116,11 +110,11 @@ Create `~/.config/opencode/opencode.json`:
}
```

> **Note on `tool_call: false`:** Models marked with `tool_call: false` do not support
> tool use in streaming mode on Bedrock. This config prevents opencode from sending
> tool definitions to those models. The `flex` branch includes a fix that makes
> `tool_call: false` actually respected at runtime — see the tracking PR
> [flexion/opencode#2](https://github.com/flexion/opencode/pull/2) for details.
> **Notes on model config keys:** Config keys must match the snapshot model ID exactly (e.g. `writer.palmyra-x5-v1:0`) — the `us.` cross-region inference profile prefix is added automatically at runtime for supported models and regions. The `id` field is only needed if you want the key to differ from the API model ID.
>
> **`tool_call: false`:** Models marked with `tool_call: false` do not support tool use in streaming mode on Bedrock. This prevents opencode from sending tool definitions to those models.
>
> **`reasoning: false`:** Models marked with `reasoning: false` will have reasoning content stripped from message history before being sent to the model. Required for models like DeepSeek R1 on Bedrock that generate reasoning output but reject it as input in subsequent turns.

### 3. Shell alias

Expand Down Expand Up @@ -173,6 +167,9 @@ See [flexion/opencode#2](https://github.com/flexion/opencode/pull/2) for the ful
| Hide skill prompt text from chat UI | `packages/opencode/src/session/prompt.ts` | Marks skill template as `synthetic` so the full prompt is sent to the model but hidden from the user |
| Respect `tool_call: false` at runtime | `packages/opencode/src/session/llm.ts` | Gates tool resolution behind `capabilities.toolcall` — fixes failures on Bedrock models that don't support streaming + tool use |
| Re-sign macOS binaries after build | `packages/opencode/script/build.ts` | Strips Bun's embedded signature and applies a fresh ad-hoc one — fixes SIGKILL (exit 137) on Darwin 25+ where Bun's signature format is rejected |
| Add inference profile prefixes for palmyra and pixtral | `packages/opencode/src/provider/provider.ts` | Adds `us.` cross-region inference profile prefix for Writer Palmyra and Mistral Pixtral models in US regions |
| Strip reasoning from history for non-reasoning models | `packages/opencode/src/provider/transform.ts` | Removes reasoning content parts from assistant message history before sending to models with `reasoning: false` — fixes Bedrock rejections when switching from a reasoning model |
| Exclude palmyra from reasoning variant generation | `packages/opencode/src/provider/transform.ts` | Prevents unsupported `reasoningConfig` parameters from being sent to Writer Palmyra models |
| Local build & AWS Bedrock setup docs | `LOCAL_AWS_SETUP.md` | This file |

Full details and upstream tracking: [flexion/opencode#2](https://github.com/flexion/opencode/pull/2)
Expand Down
2 changes: 2 additions & 0 deletions packages/opencode/src/provider/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,8 @@ export namespace Provider {
"nova-2",
"claude",
"deepseek",
"palmyra",
"pixtral",
].some((m) => modelID.includes(m))
const isGovCloud = region.startsWith("us-gov")
if (modelRequiresPrefix && !isGovCloud) {
Expand Down
12 changes: 11 additions & 1 deletion packages/opencode/src/provider/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ export namespace ProviderTransform {
model: Provider.Model,
options: Record<string, unknown>,
): ModelMessage[] {
// Strip reasoning parts from assistant messages for models that don't support reasoning
if (!model.capabilities.reasoning) {
msgs = msgs.map((msg) => {
if (msg.role !== "assistant" || !Array.isArray(msg.content)) return msg
const filtered = msg.content.filter((part) => (part as any).type !== "reasoning")
return { ...msg, content: filtered }
})
}

// Anthropic rejects messages with empty content - filter out empty string messages
// and remove empty text/reasoning parts from array content
if (model.api.npm === "@ai-sdk/anthropic" || model.api.npm === "@ai-sdk/amazon-bedrock") {
Expand Down Expand Up @@ -381,7 +390,8 @@ export namespace ProviderTransform {
id.includes("kimi") ||
id.includes("k2p5") ||
id.includes("qwen") ||
id.includes("big-pickle")
id.includes("big-pickle") ||
id.includes("palmyra")
)
return {}

Expand Down
Loading