Step 1 — Add the integration

  1. Go to Devices & Services

    Settings → Devices & Services → Add Integration, search for OpenCode.

  2. 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.

  3. Done

    The integration validates your key and creates the entry.

Step 2 — Add a conversation agent

  1. Open the OpenCode entry

    Click the OpenCode Zen card in Devices & Services.

  2. Add conversation agent

    Click Add conversation agent and configure:

    SettingDescription
    ModelPick any OpenAI-compatible model from the live list (sorted).
    InstructionsOptional system prompt template. Leave empty for the default.
    Control Home AssistantEnable to let the model call tools to control your devices.
  3. 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

  1. Open the OpenCode entry

    Click the OpenCode Zen card in Devices & Services.

  2. Add AI task

    Click Add AI task and pick a model for structured data generation.

  3. Save

    The task appears as ai_task.<model> and can be used from automations and scripts via the ai_task.generate_data service.

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.

Model lists are fetched live from OpenCode Zen, so newly released OpenAI-compatible models appear automatically in the dropdown.