mlx-optiq
Integration · OpenClaw

OpenClaw

OpenClaw is an open-source AI agent interface that connects to a model server to run tasks across your project. It speaks the Anthropic Messages API, which optiq serve exposes via /v1/messages.

1. Install OpenClaw

terminalbash
# macOS / Linux / WSL:
$ curl -fsSL https://openclaw.ai/install.sh | bash

# Windows PowerShell:
PS> iwr -useb https://openclaw.ai/install.ps1 | iex

# or, project-local via npm:
$ npm install openclaw

2. Start optiq serve

terminalbash
$ optiq serve \
    --model mlx-community/Qwen3.5-9B-OptiQ-4bit \
    --mtp --mtp-depth 2 \
    --port 8080

3. Configure OpenClaw

Drop this into ~/.openclaw/openclaw.json. If you already have other providers configured, add "mode": "merge" next to "providers" so OpenClaw splices OptIQ in without replacing them:

~/.openclaw/openclaw.jsonjson
{
  "models": {
    "providers": {
      "optiq": {
        "baseUrl": "http://localhost:8080/v1",
        "apiKey": "sk-optiq-local",
        "api": "anthropic-messages",
        "models": [
          { "id": "qwen-9b", "name": "Qwen3.5-9B (OptIQ)" }
        ]
      }
    }
  }
}

Keys are camelCase (baseUrl, apiKey), api is "anthropic-messages", and models is an array (not a dict). The id is a short alias OpenClaw uses to address the model — optiq serve ignores the request body's model field and serves whatever you started it with. Validate with openclaw config validate after saving.

Sanity-check the wire with a one-shot:

terminalbash
$ openclaw capability model run --local \
    --model "optiq/qwen-9b" \
    --prompt "What is 2+2? Just the number."

Notes

  • Same endpoint as Claude Code: both tools use /v1/messages. You can run both against the same optiq serve simultaneously.
  • Tool use: Qwen/Llama-style <tool_call> blocks are translated to Anthropic tool_use blocks; OpenClaw's agent loop works on 9B+ models.
  • Verified: tested against OpenClaw 2026.5.12 on macOS (Apple Silicon).