--- order: 5 title: Lab 5 - API & Harnesses description: Generate an Open WebUI API key, connect one of three coding harnesses, and build a small Zork-style game. --- # Lab 5 - API & Harnesses In this lab, we will: - Generate a personal API key inside Open WebUI - Install one of three coding harnesses - Configure that harness to talk to Open WebUI as the backend - Use the harness to build a small Zork-style game
Select a path to reveal that harness's instructions throughout the rest of the lab. Select the same card again if you want to hide the harness-specific instructions and return to the shared overview.
### Execute: Install the harness you want to usePath A
OpenCode is a terminal-native coding agent. Its official docs recommend either the install script or the npm package.
curl -fsSL https://opencode.ai/install | bash
opencode --version
If you prefer npm and already have Node.js installed:
npm install -g opencode-ai
opencode --version
Once installed, stay in the terminal. We will configure OpenCode in Objective 3.
Path B
Kilo Code is primarily used through the editor UI. For this Linux-first lab flow, use VS Code on the student workstation and install the extension from the marketplace.
Path C
Factory's Droid harness runs in the terminal and supports BYOK custom models through Factory configuration files.
curl -fsSL https://app.factory.ai/cli | sh
droid --version
If the shell needs to be reloaded after install, open a fresh terminal and rerun droid --version.
Path A
OpenCode supports OpenAI-compatible providers through its JSON config. Create either a project-local opencode.json file or a global config under ~/.config/opencode/opencode.json.
It can also be easier to start opencode once, and exit with /exit. Use the following example to help structure your opencode.json file.
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"openwebui": {
"name": "Open WebUI",
"options": {
"baseURL": "http://<YOUR STUDENT IP>:8080/api",
},
"models": {
"qwen3.5:4b": {
"name": "Qwen 3.5 4B"
}
}
}
},
"model": "openwebui/qwen3.5:4b"
}
After saving the config, you can login with opencode auth login:
After logging in, start OpenCode from your project directory:
cd /path/to/your/project
opencode
Path B
Kilo Code's documented workflow is provider-driven through the extension settings UI. Use the following values when creating or editing your provider profile.
API Provider - OpenAI CompatibleOpenAI Base URL - http://<YOUR STUDENT IP>:8080/apiAPI Key - YOUR_OPENWEBUI_API_KEYModel ID - qwen3.5:4b or another model exposed by Open WebUIApproval Mode - Leave the safer default enabled for your first run
curl /api/models check from Objective 1. The harness and the curl command use the same authentication path.
Path C
Factory's BYOK documentation supports custom model entries in ~/.factory/config.json. Because Open WebUI exposes a chat-completions-compatible API, use the generic-chat-completion-api provider type.
{
"custom_models": [
{
"model_display_name": "Open WebUI - Qwen 3.5 4B",
"model": "qwen3.5:4b",
"base_url": "http://<YOUR STUDENT IP>:8080/api",
"api_key": "YOUR_OPENWEBUI_API_KEY",
"provider": "generic-chat-completion-api",
"max_tokens": 4096
}
]
}
After saving the config:
droid./model.opencode inside the project directory.
droid, type "/mission", and ensure you've selected your custom model for each phase.