1 Commits

Author SHA1 Message Date
b0e2b6eeb8 introduce separate weave-proxy service which holds the API key
This prevents opencode from having access to the `WEAVE_API_KEY` enviroment variable.
2026-10-20 13:56:08 +02:00
4 changed files with 67 additions and 60 deletions

View File

@@ -22,9 +22,10 @@ A first run from a clean checkout.
```yaml
services:
opencode:
weave-proxy:
environment:
WEAVE_API_KEY: "your-key-here"
opencode:
volumes:
- /path/to/your/repo:/workspace/repo
```
@@ -121,8 +122,7 @@ name** from that stack's compose and `<port>` is the container's *internal* port
- **`model` / `small_model`** — default model and the model used for lighter
tasks. Both default to `weave/glm-5.2`.
- **`provider.weave`** — the weave provider, using the
`@ai-sdk/openai-compatible` adapter against `https://weave.redpencil.io/v1`
with the key from `WEAVE_API_KEY`.
`@ai-sdk/openai-compatible` adapter against `http://weave-proxy/v1`.
- **`provider.weave.models`** — the models offered in `/models`.
- **`lsp`** — language servers baked into the image:
`typescript-language-server` for TS/JS and `pyright` for Python.

View File

@@ -0,0 +1,11 @@
server {
listen 80;
location / {
proxy_pass https://weave.redpencil.io;
proxy_ssl_server_name on;
proxy_set_header Host weave.redpencil.io;
proxy_set_header Authorization "Bearer ${WEAVE_API_KEY}";
proxy_buffering off; # SSE streaming
proxy_read_timeout 600s; # match opencode's 5-min defaults
}
}

View File

@@ -1,83 +1,75 @@
{
"$schema": "https://opencode.ai/config.json",
"model": "weave/glm-5.3-flash",
"agents": {
"title": {
"model": "weave/glm-5.3-flash"
"small_model": "weave/glm-5.3-flash",
"lsp": {
"typescript": {
"command": [
"typescript-language-server",
"--stdio"
],
"extensions": [
".ts",
".tsx",
".js",
".jsx",
".mjs",
".cjs",
".mts",
".cts"
]
},
"pyright": {
"command": [
"pyright-langserver",
"--stdio"
],
"extensions": [
".py",
".pyi"
]
}
},
"providers": {
"provider": {
"weave": {
"package": "@opencode/ai/providers/openai-compatible",
"settings": {
"baseURL": "https://weave.redpencil.io/v1",
"apiKey": "{env:WEAVE_API_KEY}"
"npm": "@ai-sdk/openai-compatible",
"options": {
"baseURL": "http://weave-proxy/v1",
"apiKey": "not-needed"
},
"models": {
"kimi-K2.7-code": {
"capabilities": {
"tools": true
}
"tools": true
},
"glm-5.3": {
"capabilities": {
"tools": true
}
"tools": true
},
"glm-5.3-flash": {
"capabilities": {
"tools": true
}
"tools": true
},
"mistral-glm-5.2": {
"capabilities": {
"tools": true,
"reasoning": {
"supported": true
}
},
"settings": {
"tools": true,
"reasoning": true,
"options": {
"reasoningEffort": "xhigh"
}
},
"devstral": {
"capabilities": {
"tools": true
}
"tools": true
},
"local-qwen3.6:27b": {
"capabilities": {
"tools": true
}
"tools": true
},
"mistral-medium": {
"capabilities": {
"tools": true
}
"tools": true
}
}
}
},
"permissions": [
{
"action": "read",
"resource": "*",
"effect": "ask",
},
{
"action": "edit",
"resource": "*",
"effect": "ask",
},
{
"action": "shell",
"resource": "*",
"effect": "ask",
},
{
"action": "external_directory",
"resource": "*",
"effect": "ask",
},
],
}
"permission": {
"read": "ask",
"edit": "ask",
"bash": "ask",
"external_directory": "ask"
}
}

View File

@@ -1,6 +1,10 @@
services:
weave-proxy:
image: nginx:1.31.7-alpine
volumes:
- ./config/nginx/templates:/etc/nginx/templates:ro
opencode:
image: redpencil/opencode:feature-opencode-v2
image: redpencil/opencode:0.0.2
volumes:
- ./data/opencode/share:/root/.local/share/opencode
- ./config/opencode/opencode.json:/root/.config/opencode/opencode.json