Log in Get Started

API Documentation

Quick Start

Get up and running in under a minute. AI Duet is a drop-in replacement for Anthropic and OpenAI APIs.

API Endpoint

https://api.aiduet.app

Authentication

Include your API key in the request header:

# Anthropic format
x-api-key: hr-your-api-key-here

# OpenAI format
Authorization: Bearer hr-your-api-key-here

Supported Formats

AI Duet accepts both Anthropic Messages API and OpenAI Chat Completions API formats.

A Anthropic Messages API

curl https://api.aiduet.app/v1/messages \
  -H "content-type: application/json" \
  -H "x-api-key: hr-your-api-key" \
  -H "anthropic-version: 2023-06-01" \
  -d '{
    "model": "claude-opus-4-6",
    "max_tokens": 4096,
    "messages": [
      {"role": "user", "content": "Write a Python function to sort a list"}
    ]
  }'

O OpenAI Chat API

curl https://api.aiduet.app/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer hr-your-api-key" \
  -d '{
    "model": "gpt-5.4",
    "messages": [
      {"role": "user", "content": "Write a Python function to sort a list"}
    ]
  }'

Model Orchestration

You don't need to specify a model. AI Duet automatically routes: Opus 4.6 for planning and review, GPT-5.4 for code generation. Just send your request and the orchestration happens transparently.

Opus 4.6

Planning, code review, orchestration

GPT-5.4

Code generation, fast execution

Using with AI Tools

OpenClaw

# In OpenClaw config
api_base: https://api.aiduet.app
api_key: hr-your-api-key

Cursor

# Cursor Settings β†’ Models β†’ OpenAI API Base
https://api.aiduet.app/v1

Any OpenAI-compatible Tool

OPENAI_API_BASE=https://api.aiduet.app/v1
OPENAI_API_KEY=hr-your-api-key

Error Codes

Code Description
401 Invalid or missing API key
402 Insufficient balance
429 Rate limit exceeded
500 Internal server error