Step 1 — Add the integration
-
Go to Devices & Services
Settings → Devices & Services → Add Integration, search for OpenCode.
-
Enter your API key
Paste your key from opencode.ai/auth.
Endpoint (optional) defaults to
https://opencode.ai/zen/v1. Leave it as-is unless you're using a custom gateway. -
Done
The integration validates your key and creates the entry.
Step 2 — Add a conversation agent
-
Open the OpenCode entry
Click the OpenCode Zen card in Devices & Services.
-
Add conversation agent
Click Add conversation agent and configure:
Setting Description Model Pick any OpenAI-compatible model from the live list (sorted). Instructions Optional system prompt template. Leave empty for the default. Control Home Assistant Enable to let the model call tools to control your devices. -
Save
The agent appears as
conversation.<model>and is ready to use.
Adding more agents
Repeat Step 2 to add as many agents as you like — one per model. Each gets its own device and can be selected independently in Assist, dashboards, and automations.
Step 3 — Add an AI task
-
Open the OpenCode entry
Click the OpenCode Zen card in Devices & Services.
-
Add AI task
Click Add AI task and pick a model for structured data generation.
-
Save
The task appears as
ai_task.<model>and can be used from automations and scripts via theai_task.generate_dataservice.
Reconfiguring
On the OpenCode entry card, select a conversation agent and choose Reconfigure to change its model, instructions, or Home Assistant control. AI tasks can be reconfigured the same way to change the model.