# OpenCode

[OpenCode](https://opencode.ai) is an open source AI coding agent. You can use Aqueduct as a provider by adding it to your OpenCode configuration.

!!! tip
    See the [OpenCode docs](https://opencode.ai/docs#configure) for general configuration and the [custom provider guide](https://opencode.ai/docs/providers/#custom-provider) for details.

## Setup

### 1. Configure the provider

Add Aqueduct to your OpenCode config (`opencode.json` in your project root, or `~/.config/opencode/opencode.jsonc` for global settings). Requires your API Key to be in the environment variable "AQUEDUCT_API_KEY" :

``` 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": {
    "servers": {
      "brave": {
        "type": "remote",
        "url": "https://aqueduct.ai.datalab.tuwien.ac.at/mcp-servers/brave/mcp",
        "headers": {
          "Authorization": "Bearer {env:AQUEDUCT_API_KEY}"
        },
        "oauth": false,
        "disabled": false
      },
      "context7": {
        "type": "remote",
        "url": "https://aqueduct.ai.datalab.tuwien.ac.at/mcp-servers/context7/mcp",
        "headers": {
          "Authorization": "Bearer {env:AQUEDUCT_API_KEY}"
        },
        "oauth": false,
        "disabled": false
      },
      "fetch": {
        "type": "remote",
        "url": "https://aqueduct.ai.datalab.tuwien.ac.at/mcp-servers/fetch/mcp",
        "headers": {
          "Authorization": "Bearer {env:AQUEDUCT_API_KEY}"
        },
        "oauth": false,
        "disabled": false
      },
      "time": {
        "type": "remote",
        "url": "https://aqueduct.ai.datalab.tuwien.ac.at/mcp-servers/time/mcp",
        "headers": {
          "Authorization": "Bearer {env:AQUEDUCT_API_KEY}"
        },
        "oauth": false,
        "disabled": false
      },
      "cit-support": {
        "type": "remote",
        "url": "https://aqueduct.ai.datalab.tuwien.ac.at/mcp-servers/cit-support/mcp",
        "headers": {
          "Authorization": "Bearer {env:AQUEDUCT_API_KEY}"
        },
        "oauth": false,
        "disabled": true
      },
      "tu-search": {
        "type": "remote",
        "url": "https://aqueduct.ai.datalab.tuwien.ac.at/mcp-servers/tu-search/mcp",
        "headers": {
          "Authorization": "Bearer {env:AQUEDUCT_API_KEY}"
        },
        "oauth": false,
        "disabled": true
      },
      "everything": {
        "type": "remote",
        "url": "https://aqueduct.ai.datalab.tuwien.ac.at/mcp-servers/everything/mcp",
        "headers": {
          "Authorization": "Bearer {env:AQUEDUCT_API_KEY}"
        },
        "oauth": false,
        "disabled": true
      }
    }
  }
}

```

!!! info "Key settings"

    - `"aqueduct"` – the provider ID you'll reference in `/connect`.
    - `"npm": "@ai-sdk/openai-compatible"` – Aqueduct speaks the OpenAI API.
    - `"options.baseURL"` – Aqueduct's API base URL.
    - `"models"` – maps Aqueduct model IDs to display names. Update as models change (see [available models](https://datalab.tuwien.ac.at/aiml/aqueduct/models/)).
    - `"interleaved"` / `"options.chat_template_kwargs"` / `"variants"` – enables thinking for the reasoning models. `main` (DeepSeek V4 Vision) and `glm-5.3-744b-experimental` both support `high` and `max` reasoning efforts; the `variants` expose `/models-{variant}` to switch efforts on the fly.

### 2. Add your API key

Run `/connect` in OpenCode, select **Aqueduct** as the provider, and paste your API key (get one at [aqueduct.ai.datalab.tuwien.ac.at](https://aqueduct.ai.datalab.tuwien.ac.at/)).

### 3. Start coding

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

Run `/init` to let OpenCode analyze your project, then use `/models` to pick an Aqueduct model.