# OpenCode

[OpenCode](https://opencode.ai) ist ein Open-Source-Coding-Agent. Du kannst Aqueduct als Provider nutzen, indem du es zu deiner OpenCode-Konfiguration hinzufügst.

!!! tip
    Die allgemeine Konfiguration erklärt die [OpenCode-Dokumentation](https://opencode.ai/docs#configure), Details stehen in der [Anleitung für Custom Provider](https://opencode.ai/docs/providers/#custom-provider).

## Einrichtung { #setup }

### 1. Provider konfigurieren { #1-configure-the-provider }

Füg Aqueduct zu deiner OpenCode-Konfiguration hinzu (`opencode.json` im Root-Verzeichnis deines Projekts oder `~/.config/opencode/opencode.jsonc` für globale Einstellungen). Dein API-Key muss dafür in der Umgebungsvariable `AQUEDUCT_API_KEY` stehen:

``` json
{
  "$schema": "https://opencode.ai/config.json",
  "model": "aqueduct/main",
  "small_model": "aqueduct/vision",
  "default_agent": "plan",
  "permission": {
    "read": "allow",
    "glob": "allow",
    "grep": "allow",
    "list": "allow",
    "webfetch": "allow",
    "websearch": "allow",
    "edit": "ask",
    "bash": "ask",
    "external_directory": {
      "/tmp/*": "allow"
    }
  },
  "provider": {
    "aqueduct": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Aqueduct",
      "options": {
        "baseURL": "https://aqueduct.ai.datalab.tuwien.ac.at/v1",
        "apiKey": "{env:AQUEDUCT_API_KEY}"
      },
      "models": {
        "main": {
          "name": "Main (alias → DeepSeek V4 Vision)",
          "interleaved": { "field": "reasoning_content" },
          "modalities": { "input": ["text", "image"], "output": ["text"] },
          "options": {
            "chat_template_kwargs": {
              "thinking": true,
              "reasoning_effort": "high"
            }
          },
          "variants": {
            "high": {
              "chat_template_kwargs": {
                "thinking": true,
                "reasoning_effort": "high"
              }
            },
            "max": {
              "chat_template_kwargs": {
                "thinking": true,
                "reasoning_effort": "max"
              }
            }
          }
        },
        // "glm-5.3-744b-experimental": {
        //   "name": "GLM 5.3",
        //   "interleaved": { "field": "reasoning_content" },
        //   "options": {
        //     "chat_template_kwargs": {
        //       "thinking": true,
        //       "reasoning_effort": "high"
        //     }
        //   },
        //   "variants": {
        //     "high": {
        //       "chat_template_kwargs": {
        //         "thinking": true,
        //         "reasoning_effort": "high"
        //       }
        //     },
        //     "max": {
        //       "chat_template_kwargs": {
        //         "thinking": true,
        //         "reasoning_effort": "max"
        //       }
        //     }
        //   }
        // },
        "vision": {
          "name": "Qwen 3.8 27B (alias → vision)",
          "modalities": { "input": ["text", "image"], "output": ["text"] }
        }
      }
    }
  },
  "mcp": {
    "brave": {
      "type": "remote",
      "headers": {
        "Authorization": "Bearer {env:AQUEDUCT_API_KEY}"
      },
      "url": "https://aqueduct.ai.datalab.tuwien.ac.at/mcp-servers/brave/mcp",
      "enabled": true
    },
    "context7": {
      "type": "remote",
      "headers": {
        "Authorization": "Bearer {env:AQUEDUCT_API_KEY}"
      },
      "url": "https://aqueduct.ai.datalab.tuwien.ac.at/mcp-servers/context7/mcp",
      "enabled": true
    },
    "fetch": {
      "type": "remote",
      "headers": {
        "Authorization": "Bearer {env:AQUEDUCT_API_KEY}"
      },
      "url": "https://aqueduct.ai.datalab.tuwien.ac.at/mcp-servers/fetch/mcp",
      "enabled": true
    },
    "time": {
      "type": "remote",
      "headers": {
        "Authorization": "Bearer {env:AQUEDUCT_API_KEY}"
      },
      "url": "https://aqueduct.ai.datalab.tuwien.ac.at/mcp-servers/time/mcp",
      "enabled": true
    },
    "cit-support": {
      "type": "remote",
      "headers": {
        "Authorization": "Bearer {env:AQUEDUCT_API_KEY}"
      },
      "url": "https://aqueduct.ai.datalab.tuwien.ac.at/mcp-servers/cit-support/mcp",
      "enabled": false
    },
    "tu-search": {
      "type": "remote",
      "headers": {
        "Authorization": "Bearer {env:AQUEDUCT_API_KEY}"
      },
      "url": "https://aqueduct.ai.datalab.tuwien.ac.at/mcp-servers/tu-search/mcp",
      "enabled": false
    },
    "everything": {
      "type": "remote",
      "headers": {
        "Authorization": "Bearer {env:AQUEDUCT_API_KEY}"
      },
      "url": "https://aqueduct.ai.datalab.tuwien.ac.at/mcp-servers/everything/mcp",
      "enabled": false
    }
  }
}
```

!!! info "Wichtige Einstellungen"

    - `"aqueduct"` – die Provider-ID, die du in `/connect` auswählst.
    - `"npm": "@ai-sdk/openai-compatible"` – Aqueduct spricht die OpenAI-API.
    - `"options.baseURL"` – die API-Base-URL von Aqueduct.
    - `"models"` – ordnet Aqueduct-Modell-IDs Anzeigenamen zu. Pass die Liste an, wenn sich die Modelle ändern (siehe [verfügbare Modelle](https://datalab.tuwien.ac.at/de/aiml/aqueduct/models/)).
    - `"interleaved"` / `"options.chat_template_kwargs"` / `"variants"` – schaltet Thinking für die Reasoning-Modelle ein. `main` (DeepSeek V4 Vision) und `glm-5.3-744b-experimental` unterstützen beide die Reasoning Efforts `high` und `max`. Über die `variants` kannst du mit `/models-{variant}` den Effort im laufenden Betrieb wechseln.

### 2. API-Key eintragen { #2-add-your-api-key }

Führ in OpenCode `/connect` aus, wähl **Aqueduct** als Provider und füg deinen API-Key ein (einen Key bekommst du unter [aqueduct.ai.datalab.tuwien.ac.at](https://aqueduct.ai.datalab.tuwien.ac.at/)).

### 3. Loslegen { #3-start-coding }

``` bash
cd /path/to/your/project
opencode
```

Führ `/init` aus, damit OpenCode dein Projekt analysiert, und wähl dann mit `/models` ein Aqueduct-Modell aus.