#!/bin/sh # Aelius Code setup for opencode (https://aeliusai.com/code#opencode). # Asks for your key and writes ~/.config/opencode/opencode.json. Nothing else. set -e printf "Paste your aelius_code_ key, then press Enter: " read -r KEY < /dev/tty case "$KEY" in aelius_code_*) ;; *) echo "That does not look like an Aelius Code key (it starts with aelius_code_)." >&2; exit 1 ;; esac DIR="$HOME/.config/opencode" FILE="$DIR/opencode.json" mkdir -p "$DIR" if [ -f "$FILE" ]; then cp "$FILE" "$FILE.bak"; echo "Old settings kept as $FILE.bak"; fi cat > "$FILE" <<'AELIUS_EOF' { "$schema": "https://opencode.ai/config.json", "model": "aelius/qwen3.8-27b", "provider": { "aelius": { "models": { "qwen3.8-27b": { "attachment": true, "limit": { "context": 262144, "output": 32768 }, "modalities": { "input": [ "text", "image" ], "output": [ "text" ] }, "name": "Aelius Code", "tool_call": true } }, "name": "Aelius Code", "npm": "@ai-sdk/openai-compatible", "options": { "apiKey": "KEYHERE", "baseURL": "https://code.aeliusai.com/v1", "chunkTimeout": 300000, "headerTimeout": 900000, "timeout": false } } }, "small_model": "aelius/qwen3.8-27b" } AELIUS_EOF sed "s/KEYHERE/$KEY/" "$FILE" > "$FILE.tmp" && mv "$FILE.tmp" "$FILE" echo "Saved. Now open opencode."