---
title: "Add Haimaker to OpenCode: Custom Provider Setup (2026)"
description: "Add Haimaker as a provider in OpenCode in 3 steps. Access 50+ models through one API key. Copy-paste config included."
date: 2026-01-25
updatedDate: 2026-06-26
location: San Francisco, CA – Jan 25th, 2026
image: /images/how-to-add-haimaker-opencode-hero.jpg
faq:
  - question: "How do I add Haimaker as a custom provider in OpenCode?"
    answer: "The fastest way is to run 'npx -y @haimaker/connect --opencode', which writes the provider block and stores your credential for you. To do it by hand, add a provider entry in ~/.config/opencode/opencode.jsonc with npm set to '@ai-sdk/openai-compatible', baseURL to 'https://api.haimaker.ai/v1', and your desired models, then add your API key to ~/.local/share/opencode/auth.json. Restart OpenCode and use /models to switch."
  - question: "What models are available through Haimaker in OpenCode?"
    answer: "Haimaker provides access to dozens of models through a single API key, including models from Z.AI, Anthropic, OpenAI, Meta Llama, and more. Check the model hub at app.haimaker.ai/model_hub_table for the full list. Model IDs follow the format on the hub."
---

OpenCode supports 75+ LLM providers out of the box, but what if you want to use a provider that isn't in the directory? You can add any OpenAI-compatible API as a custom provider with a few lines of config.

This guide walks through adding [Haimaker](https://haimaker.ai) — an inference routing platform that gives you access to dozens of models through a single API.

The fastest way to wire it in, with no config files to edit, is a single command:

```bash
export HAIMAKER_API_KEY=your-haimaker-key
npx -y @haimaker/connect --opencode
```

[`@haimaker/connect`](/connect) writes the OpenCode provider block, stores your credential in the right place, verifies the connection, then exits — nothing of ours sits in the request path afterward. Add `--project` to write a project-local config instead of the global one, or `--pick-model` to choose a model interactively. Restart OpenCode and run `/models` to select a Haimaker model.

The same command also wires up Claude Code, Codex, OpenClaw, Hermes, Cline, and Kilo Code — see the [connect guide](/connect) for every flag.

Prefer to see exactly what gets written, or want to wire up a provider the CLI doesn't cover? The manual steps below do the same thing by hand.

## Why use a custom provider?

A few reasons you might want this:

- **Access to different models.** Haimaker routes to models you won't find on other platforms, including cost-optimized and specialized options.
- **Cost control.** Route by price, latency, or compliance requirements. Haimaker is typically 5% cheaper than comparable providers.
- **Single API key.** One key, many models. Less config sprawl.

## Step 1: Get your Haimaker API key

1. Sign up at [haimaker.ai](https://haimaker.ai)
2. Grab your API key from the dashboard

## Step 2: Configure the provider

OpenCode uses a config file to define custom providers. Open (or create) your config at:

```
~/.config/opencode/opencode.jsonc
```

Add Haimaker as a provider:

```jsonc
{
  "provider": {
    "haimaker": {
      "npm": "@ai-sdk/openai-compatible",
      "options": {
        "baseURL": "https://api.haimaker.ai/v1"
      },
      "models": {
        "z-ai/glm-4.6": {}
      }
    }
  }
}
```

A few notes:

- The `npm` field tells OpenCode to use the OpenAI-compatible SDK adapter
- `baseURL` points to Haimaker's API endpoint
- `models` lists which models you want available — add more as needed

## Step 3: Add your API key

OpenCode stores credentials separately from config. Add your Haimaker key to:

```
~/.local/share/opencode/auth.json
```

```json
{
  "haimaker": {
    "type": "api",
    "key": "HAIMAKER_API_KEY"
  }
}
```

Replace `HAIMAKER_API_KEY` with the actual key from your dashboard.

## Step 4: Select a model

Run OpenCode and use the `/models` command to switch to your Haimaker model. You should see `haimaker/z-ai/glm-4.6` (or whatever models you configured) in the list.

## Adding more models

Haimaker gives you access to a bunch of models. Check the [model hub](https://haimaker.ai/models) to see what's available, then add them to your config:

```jsonc
{
  "provider": {
    "haimaker": {
      "npm": "@ai-sdk/openai-compatible",
      "options": {
        "baseURL": "https://api.haimaker.ai/v1"
      },
      "models": {
        "z-ai/glm-4.6": {},
        "anthropic/claude-3-5-sonnet": {},
        "openai/gpt-4o": {},
        "meta-llama/llama-3.1-405b": {}
      }
    }
  }
}
```

Model IDs follow the format on Haimaker's model hub. Copy them exactly.

## Troubleshooting

**"Model not found" error**
Double-check the model ID matches what's in Haimaker's model hub. Case and formatting matter.

**Authentication failed**
Make sure `auth.json` has the right structure and your API key is valid. You can test your key with a quick curl:

```bash
curl https://api.haimaker.ai/v1/models \
  -H "Authorization: Bearer HAIMAKER_API_KEY"
```

**Provider not showing up**
Restart OpenCode after editing config files. Changes aren't picked up automatically.

---

This same pattern works for any OpenAI-compatible API. Just swap the `baseURL` and model names.

Questions? Hit us up in [Discord](https://discord.gg/6fG89cbZ).
