---
name: haimaker-api
description: Call 300+ AI models — Claude, GPT, Gemini, Llama, Qwen, DeepSeek, Kimi — through one OpenAI-compatible endpoint at api.haimaker.ai. Use when picking a model, checking token pricing or context limits, wiring an app or coding agent to a multi-model gateway, or debugging a 401/429 from haimaker.
license: MIT
---

# haimaker API

One base URL, one key, 300+ models. The surface is OpenAI-compatible, so any
OpenAI SDK works by changing two values.

## Setup

Base URL: `https://api.haimaker.ai/v1`
Auth: `Authorization: Bearer $HAIMAKER_API_KEY`

If there is no key yet, you can request one through device login and your user
approves it in their browser (they sign in or create an account there). You
never handle their password. See "Getting a key" below. Read the key from the
environment; never hard-code it.

```python
from openai import OpenAI
client = OpenAI(api_key=os.environ["HAIMAKER_API_KEY"],
                base_url="https://api.haimaker.ai/v1")
```

```javascript
const client = new OpenAI({
  apiKey: process.env.HAIMAKER_API_KEY,
  baseURL: 'https://api.haimaker.ai/v1',
});
```

To configure a coding agent (Claude Code, Codex, opencode, OpenClaw, Hermes,
Cline, Kilo Code, Pi) instead of an SDK, run `npx @haimaker/connect` — it writes
the agent's own config file and exits.

## Getting a key

With the user's OK, on their machine (Node 18+):

```bash
npx -y @haimaker/connect --login --claude   # or --codex, --cline, --kilo,
                                            # --opencode, --openclaw, --hermes, --pi
```

It opens their browser on the approval page, prints the link and an 8-character
code to stderr, and waits up to 15 minutes, so run it in the background. Without
a TTY an agent flag is required.

Anywhere else, run the device flow over HTTP:

1. `POST https://api.haimaker.ai/v1/device/code` with
   `{"client_id": "haimaker-connect", "client_name": "<short label>"}`.
2. Show the user `verification_uri_complete` and `user_code`.
3. Every `interval` seconds, `POST https://api.haimaker.ai/v1/device/token` with
   `{"client_id": "haimaker-connect", "device_code": "<device_code>"}`. A 400
   `authorization_pending` means keep waiting; `slow_down` means add 5 seconds;
   `access_denied` or `expired_token` means stop. A 200 returns `api_key`,
   `team_id` and `balance_usd`, once.

Full details: <https://haimaker.ai/auth.md>. A person can also create a key in
the dashboard at <https://app.haimaker.ai/sign-up>.

## Choosing a model

Model IDs are namespaced by provider: `anthropic/claude-sonnet-5`,
`openai/gpt-5`, `moonshotai/kimi-k2.5`, `deepseek/deepseek-v3`. Do not guess an
ID — read the catalog:

```bash
curl -s https://api.haimaker.ai/public/model_hub
```

That endpoint needs no auth and returns one object per model group with the
fields that decide the choice:

| Field | Use it for |
| --- | --- |
| `model_group` | The exact string to put in `"model"` |
| `input_cost_per_token`, `output_cost_per_token` | Cost per token — multiply by 1e6 for the familiar per-million figure |
| `max_input_tokens`, `max_output_tokens` | Context and generation limits |
| `supports_vision`, `supports_function_calling`, `supports_reasoning`, `supports_web_search` | Capability filters |
| `mode` | `chat`, `embedding`, `rerank`, `image_generation`, `audio_transcription` |
| `supported_openai_params` | Which request params that model actually honours |

Filter on capability first, then sort by cost. A model missing
`supports_function_calling` will fail a tool-calling request no matter how cheap
it is.

`GET /v1/models` (authenticated) returns the subset the caller's key is allowed
to reach, which may be narrower than the public catalog.

## Requests

```bash
curl https://api.haimaker.ai/v1/chat/completions \
  -H "Authorization: Bearer $HAIMAKER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"anthropic/claude-sonnet-5",
       "messages":[{"role":"user","content":"Hello"}]}'
```

Available endpoints: `/v1/chat/completions`, `/v1/responses`, `/v1/completions`,
`/v1/embeddings`, `/v1/rerank`, `/v1/images/generations`, `/v1/audio/speech`,
`/v1/audio/transcriptions`, `/v1/moderations`. Provider-native shapes are also
served — Anthropic Messages and Gemini `generateContent` — see
<https://docs.haimaker.ai/docs/anthropic_unified> and
<https://docs.haimaker.ai/docs/generateContent>.

Streaming is the standard `"stream": true` SSE flow.

Full request and response schemas: <https://api.haimaker.ai/openapi.json>.

## Errors

- `401 missing_api_key` — no `Authorization` header.
- `401 invalid_api_key` — revoked, mistyped, or from a different environment.
- `429` — rate or budget ceiling. Back off exponentially; do not retry in a tight loop.
- A capability error (tool calls rejected, image ignored) usually means the model
  lacks that flag in the catalog. Re-check `supports_*` before retrying.

## Related

- Auto-routing per request: the `haimaker-auto-router` skill.
- Authentication reference: <https://haimaker.ai/auth.md>
- Docs index for agents: <https://docs.haimaker.ai/llms.txt>
