OpenCode Integration
Use OpenCode as an AI coding assistant with TULIP.
Prerequisites
- OpenCode installed, for example with
curl -fsSL https://opencode.ai/install | bash. See the OpenCode installation documentation for other installation methods. - A valid TULIP API key.
- Access to the TU Delft network, either on campus or through eduVPN.
Setup
1. Configure OpenCode
Create or edit ~/.config/opencode/opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"tudelft-tulip": {
"npm": "@ai-sdk/openai-compatible",
"name": "TU Delft TULIP",
"options": {
"baseURL": "https://api.tulip.tudelft.nl/code/v1",
"apiKey": "{env:TUDELFT_TULIP_API_KEY}"
},
"models": {
"code": {
"name": "TULIP Code"
}
}
}
}
}
Using another TULIP model
Each TULIP model has a corresponding endpoint and model alias. When changing models, update both baseURL and the key under models.
See Model Mapping for the available aliases and their current backing models.
To configure multiple TULIP models simultaneously, define a separate OpenCode provider for each one because baseURL is configured at the provider level.
2. Set your API key
Add the environment variable to your shell profile (~/.bashrc, ~/.zshrc, or equivalent):
Open a new terminal, or reload your current shell configuration:
For Zsh, use source ~/.zshrc instead.
3. Verify the connection
Run a simple request using the configured provider and model:
A successful response confirms that OpenCode can authenticate with TULIP and access the coding endpoint.
Usage
From the project directory in which you want to work, start OpenCode with the TULIP coding model:
Use /models within OpenCode to view or select configured models.
Warning
OpenCode can read and modify files and run commands in its working directory. Start it in the intended project directory and review requested actions before approving them.
Troubleshooting
Unauthorized
Check whether the API-key environment variable is set:
Also ensure that the apiKey field in opencode.json uses the correct syntax:
Restart OpenCode after setting or changing the environment variable.
Connection timeout or request blocked
Verify that you are connected to the TU Delft network, either on campus or through eduVPN.
Model not found
Ensure that the endpoint and model alias correspond. For example, the code alias must be used with the /code/v1 endpoint.
Use the TULIP model alias in OpenCode, not the backing model name shown in Model Mapping.
To check the models configured for the provider, run:
The output should include tudelft-tulip/code.