HexaClawHexaClaw

API Reference

HexaClaw gives you a single API key for every AI service your agent needs: LLM completions, web search, image generation, text-to-speech, speech-to-text, embeddings, vector storage, browser automation, and security scanning.

Base URL

https://api.hexaclaw.com

All endpoints use HTTPS. Requests and responses are JSON unless otherwise noted. The API is OpenAI-compatible for chat completions, embeddings, TTS, and STT -- drop in your existing OpenAI SDK code and change the base URL.

Authentication

Include your API key in the Authorization header as a Bearer token.

Authorization header
Authorization: Bearer hx_live_YOUR_API_KEY

Auth methods

1. API Key (recommended)

Create keys in the dashboard or via the POST /v1/keys endpoint. Keys start with hx_live_ and are 48 characters.

2. Device Token

Used by the HexaClaw CLI. Provision via POST /v1/device/provision, then link to your account with POST /v1/device/link.

3. Firebase ID Token

For web dashboard and key management endpoints. Pass a Firebase Auth ID token in the same Bearer header.

Response headers

Every API response includes useful metadata headers:

HeaderDescription
X-Generation-IdUnique ID for this generation (use with GET /v1/generation)
X-Model-RequestedThe model ID you requested
X-Model-UsedThe actual model used (may differ if alias was used)
X-RateLimit-LimitYour rate limit ceiling for this window
X-RateLimit-RemainingRequests remaining in current window
X-RateLimit-ResetSeconds until the rate limit resets
Idempotency-KeyEcho of your Idempotency-Key header (if sent)
X-Idempotent-ReplayedSet to 'true' if response was a cached replay

Idempotency

Include an Idempotency-Key header to safely retry requests. If the same key is sent again within 24 hours, the cached response is returned instead of creating a new generation.

Bring Your Own Key (BYOK)

Pass your own provider API key via the X-Provider-Key header to route directly to the provider. BYOK requests are charged a 5% platform fee (minimum 1 credit) instead of the full credit cost.

Quickstart

Send your first request in seconds. HexaClaw is OpenAI-compatible -- just change the base URL and API key.

cURL
curl -X POST https://api.hexaclaw.com/v1/chat/completions \
  -H "Authorization: Bearer hx_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-4-6",
    "messages": [{"role": "user", "content": "Hello, world!"}]
  }'
Python (OpenAI SDK)
from openai import OpenAI

client = OpenAI(
    base_url="https://api.hexaclaw.com/v1",
    api_key="hx_live_YOUR_KEY",
)

response = client.chat.completions.create(
    model="claude-sonnet-4-6",
    messages=[{"role": "user", "content": "Hello, world!"}],
)
print(response.choices[0].message.content)
TypeScript (OpenAI SDK)
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.hexaclaw.com/v1",
  apiKey: "hx_live_YOUR_KEY",
});

const response = await client.chat.completions.create({
  model: "claude-sonnet-4-6",
  messages: [{ role: "user", content: "Hello, world!" }],
});
console.log(response.choices[0].message.content);

Models

Discover available models and their pricing. All tiers have access to all models.

GET/v1/models

List all available models with pricing information.

GET/v1/models/:id

Get details for a specific model.

Model aliases

You can use convenient short aliases instead of full model IDs. For example, claude-sonnet resolves to claude-sonnet-4-6.

AliasResolves to
claude-sonnetclaude-sonnet-4-6
claude-haikuclaude-haiku-4-5
claude-opusclaude-opus-4-6
gpt-4ogpt-4.1
gpt-4o-minigpt-4.1-mini
gemini-flashgemini-2.5-flash
gemini-progemini-2.5-pro
grokgrok-3
deepseekdeepseek-chat
mistralmistral-large-latest
llamallama-3.3-70b-versatile

50+ aliases are supported in total. Use GET /v1/models to see the full list.

Chat Completions

OpenAI-compatible chat completions endpoint. Supports streaming, function calling, JSON mode, and vision across all providers.

POST/v1/chat/completions

Create a chat completion. Routes to the appropriate provider based on model ID.

Request body

ParameterTypeRequiredDescription
modelstringRequiredModel ID (e.g. claude-sonnet-4-6, gpt-4.1, gemini-2.5-flash)
messagesarrayRequiredArray of message objects with role and content
streambooleanDefault: falseEnable server-sent events streaming
temperaturenumberDefault: 1.0Sampling temperature (0-2)
max_tokensintegerOptionalMaximum tokens to generate
toolsarrayOptionalFunction calling tools (OpenAI format)
response_formatobjectOptionalSet to {"type":"json_object"} for JSON mode
Streaming example
curl -X POST https://api.hexaclaw.com/v1/chat/completions \
  -H "Authorization: Bearer hx_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4.1",
    "stream": true,
    "messages": [{"role": "user", "content": "Write a haiku about APIs"}]
  }'

Messages (Anthropic Native)

Native Anthropic Messages API for Claude models. Use this if you need Anthropic-specific features like extended thinking or cache control. Also supports x-api-key header authentication (Anthropic SDK convention). The anthropic-version and anthropic-beta headers are forwarded to the upstream provider.

POST/v1/messages

Create a message using the Anthropic Messages API format.

Request body

ParameterTypeRequiredDescription
modelstringRequiredClaude model ID (claude-opus-4-6, claude-sonnet-4-6, claude-haiku-4-5)
messagesarrayRequiredArray of message objects (Anthropic format)
max_tokensintegerRequiredMaximum tokens to generate
streambooleanDefault: falseEnable SSE streaming
systemstringOptionalSystem prompt
temperaturenumberDefault: 1.0Sampling temperature (0-1)
Anthropic SDK
import anthropic

client = anthropic.Anthropic(
    base_url="https://api.hexaclaw.com/v1",
    api_key="hx_live_YOUR_KEY",
)

message = client.messages.create(
    model="claude-sonnet-4-6",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Explain quantum computing"}],
)
print(message.content[0].text)

Image Generation

Generate images using Flux models via fal.ai. Three quality tiers available.

POST/v1/images/generate1-6 credits

Generate an image from a text prompt.

Request body

ParameterTypeRequiredDescription
promptstringRequiredImage description
modelstringDefault: schnellQuality tier: "schnell" (1cr), "dev" (3cr), or "pro" (6cr)
sizestringDefault: 1024x1024Image dimensions
Generate an image
curl -X POST https://api.hexaclaw.com/v1/images/generate \
  -H "Authorization: Bearer hx_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"prompt": "A cyberpunk city at sunset", "model": "dev"}'

Text-to-Speech

POST/v1/audio/speech1-2 credits/1K chars

Convert text to speech using OpenAI TTS. Returns audio data.

Request body

ParameterTypeRequiredDescription
inputstringRequiredText to convert to speech
modelstringDefault: tts-1"tts-1" (1cr/1K chars) or "tts-1-hd" (2cr/1K chars)
voicestringDefault: alloyVoice: alloy, echo, fable, onyx, nova, shimmer
response_formatstringDefault: mp3Output format: mp3, opus, aac, flac

Speech-to-Text

POST/v1/audio/transcriptions1 credit/min

Transcribe audio to text using Whisper. Accepts multipart/form-data.

Request body (multipart/form-data)

ParameterTypeRequiredDescription
filefileRequiredAudio file (mp3, wav, webm, m4a, etc.)
modelstringDefault: whisper-1Transcription model
languagestringOptionalISO-639-1 language code (optional, auto-detected)

Embeddings

Generate text embeddings for semantic search, clustering, and RAG pipelines. OpenAI-compatible endpoint.

POST/v1/embeddings1-13 credits/1M tokens

Create embeddings for input text.

Request body

ParameterTypeRequiredDescription
inputstring | string[]RequiredText to embed (single string or array)
modelstringRequiredModel ID (see table below)

Available embedding models

ModelProviderDimensionsCredits/1M tokens
text-embedding-3-smallOpenAI1,5362
text-embedding-3-largeOpenAI3,07213
gemini-embedding-001Google3,0721

Vector Storage

Managed vector database for RAG, semantic search, and long-term memory. Each user gets an isolated namespace.

POST/v1/vectors/upsert1 credit/1K vectors

Insert or update vectors. Auto-creates collection on first use.

POST/v1/vectors/queryFree

Search for similar vectors by embedding. Returns scored results with payloads.

DELETE/v1/vectors/deleteFree

Delete vectors by IDs or filter.

Upsert request body

ParameterTypeRequiredDescription
pointsarrayRequiredArray of {id, vector, payload?} objects. Max 10,000 per request.
Upsert vectors
curl -X POST https://api.hexaclaw.com/v1/vectors/upsert \
  -H "Authorization: Bearer hx_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "points": [
      {"id": "doc-1", "vector": [0.1, 0.2, ...], "payload": {"text": "Hello world"}},
      {"id": "doc-2", "vector": [0.3, 0.4, ...], "payload": {"text": "Goodbye world"}}
    ]
  }'

Query request body

ParameterTypeRequiredDescription
vectornumber[]RequiredQuery embedding vector
top_kintegerDefault: 10Number of results (max 100)
filterobjectOptionalQdrant filter object for metadata filtering

Browser Sessions

Launch headless browser sessions for web scraping, testing, and automation via Browserbase. Billed per minute of session time.

POST/v1/browser/sessions2 credits/min

Create a new browser session. Returns a WebSocket connect URL.

GET/v1/browser/sessions/:id

Get the status of a browser session.

DELETE/v1/browser/sessions/:id

Terminate a browser session. Credits are billed on termination (minimum 1 minute).

Create session body

ParameterTypeRequiredDescription
proxybooleanDefault: falseEnable proxy for the session

Guardian Security Max Plan

AI security scanning for prompt injection, PII leaks, and malicious content. Guardian runs automatically on all Max plan requests. These endpoints are for explicit on-demand scanning.

Available on the Max plan ($49/mo). Coming soon as a standalone API for all tiers.
POST/v1/guardian/scan/input1 creditMax Only

Scan user input for prompt injection and data exfiltration attempts.

POST/v1/guardian/scan/output1 creditMax Only

Scan LLM output for secrets, PII, and policy violations.

POST/v1/guardian/scan1 creditMax Only

Full scan: input + output in a single request.

POST/v1/guardian/analyze1 creditMax Only

Deep threat analysis with detailed risk breakdown.

GET/v1/guardian/statusMax Only

Check Guardian availability and capabilities.

API Key Management

Create, list, update, and deactivate API keys. These endpoints require Firebase ID token authentication (not API key auth).

GET/v1/key

Introspect the current API key -- returns key metadata, scopes, and owner info.

POST/v1/keys

Create a new API key with optional name and permission scopes.

GET/v1/keys

List all active API keys for your account.

PATCH/v1/keys/:id

Update key name, scopes, or rate limits.

DELETE/v1/keys/:id

Deactivate an API key (cannot be undone).

Usage & Credits

Track credit balance, usage history, and spending across models and services.

GET/v1/usage

Current credit balance and usage summary.

GET/v1/usage/history

Daily usage history with per-service breakdown.

GET/v1/usage/summary

Dashboard summary widget data (aggregated stats).

GET/v1/usage/by-model

Usage breakdown by model. Supports ?from= and ?to= date filters.

GET/v1/usage/by-service

Usage breakdown by service type. Supports ?from= and ?to= date filters.

GET/v1/credits/ledger

Detailed credit transaction ledger.

Pricing

1 credit = $0.01 USD. Credits are deducted per request based on token usage.

LLM Models

ModelProviderInput/1MOutput/1M
Anthropic
claude-opus-4-6Claude Opus 4.66503,250
claude-sonnet-4-6Claude Sonnet 4.63901,950
claude-haiku-4-5Claude Haiku 4.5100500
OpenAI
gpt-4.1GPT-4.12601,040
gpt-4.1-miniGPT-4.1 Mini40160
gpt-4.1-nanoGPT-4.1 Nano1040
o3o32601,040
o4-minio4-mini143572
Google
gemini-2.5-flash-liteGemini 2.5 Flash Lite1040
gemini-2.5-flashGemini 2.5 Flash1560
gemini-2.5-proGemini 2.5 Pro1631,300
gemini-3-flash-previewGemini 3.0 Flash65390
xAI
grok-3Grok 33901,950
grok-3-fastGrok 3 Fast6503,250
grok-3-miniGrok 3 Mini3965
grok-3-mini-fastGrok 3 Mini Fast78520
DeepSeek
deepseek-chatDeepSeek V31836
deepseek-reasonerDeepSeek R172290
Mistral
mistral-large-latestMistral Large260780
mistral-small-latestMistral Small1339
codestral-latestCodestral39117
Groq
llama-3.3-70b-versatileLlama 3.3 70B78103
llama-4-scout-17b-16e-instructLlama 4 Scout1515
llama-4-maverick-17b-128e-instructLlama 4 Maverick65100
qwen-qwq-32bQwen QwQ 32B3952
gemma2-9b-itGemma 2 9B33

Services

ServiceCostUnit
Web Search1 creditPer query
Image Gen (schnell)1 creditPer image
Image Gen (dev)3 creditsPer image
Image Gen (pro)6 creditsPer image
TTS (standard)1 creditPer 1K characters
TTS (HD)2 creditsPer 1K characters
Speech-to-Text1 creditPer minute
Browser Session2 creditsPer minute
Embeddings (small)2 creditsPer 1M tokens
Embeddings (large)13 creditsPer 1M tokens
Embeddings (gemini)1 creditPer 1M tokens
Vectors Upsert1 creditPer 1K vectors
Vectors QueryFree--
Guardian Scan1 creditPer scan

Rate Limits

Rate limits are applied per API key. Exceeding limits returns HTTP 429.

TierReq/minReq/dayConcurrentMonthly Credits
Trial305003200
Pro ($19.99/mo)602,00052,000
Max ($49/mo)12010,000105,000
Enterprise600100,0005050,000

Rate limit headers are included in every response: X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset.

Errors

All errors return a consistent JSON format with an error object.

Error response format
{
  "error": {
    "message": "Insufficient credits",
    "type": "payment_required",
    "code": 402
  }
}

Status codes

CodeDescription
200Success
400Bad request -- invalid parameters
401Unauthorized -- missing or invalid API key
402Payment required -- insufficient credits
403Forbidden -- API key lacks required scope
404Not found -- invalid endpoint or resource
429Too many requests -- rate limit exceeded
500Internal server error
502Bad gateway -- upstream provider error
503Service unavailable -- provider temporarily down
504Gateway timeout -- provider request timed out

SDKs & Libraries

HexaClaw is compatible with existing OpenAI and Anthropic SDKs. No custom SDK needed -- just change the base URL.

OpenAI Python SDK

python
pip install openai

from openai import OpenAI
client = OpenAI(base_url="https://api.hexaclaw.com/v1", api_key="hx_live_YOUR_KEY")

OpenAI Node.js SDK

typescript
npm install openai

import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.hexaclaw.com/v1", apiKey: "hx_live_YOUR_KEY" });

Anthropic Python SDK

python
pip install anthropic

import anthropic
client = anthropic.Anthropic(base_url="https://api.hexaclaw.com/v1", api_key="hx_live_YOUR_KEY")

cURL

bash
curl https://api.hexaclaw.com/v1/chat/completions \
  -H "Authorization: Bearer hx_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"claude-sonnet-4-6","messages":[{"role":"user","content":"Hi"}]}'

CLI & Terminal

HexaClaw includes a full CLI for managing agents, channels, and cloud services from your terminal. Install it with a single command.

Installation

bash
# One-line install (macOS / Linux)
curl -sSL https://hexaclaw.com/install-cli | bash

# Or install via npm
npm install -g hexaclaw

# Verify installation
hexaclaw --version

The installer writes your auth token, enables the HexaClaw cloud plugin, and optionally starts the gateway. You can also generate a pre-authenticated install command from the Dashboard.

Basic Commands

CommandDescription
hexaclaw --versionShow installed version
hexaclaw --helpList all available commands
hexaclaw configureInteractive setup wizard
hexaclaw config get <key>Read a config value
hexaclaw channels statusCheck connected channels and gateway health
hexaclaw agents listList configured agents and their models
hexaclaw dashboardOpen the gateway web UI in your browser

Configuration Files

All config lives in ~/.openclaw/:

FilePurpose
cloud-auth.jsonFirebase auth tokens (auto-refreshed)
hexaclaw.jsonCloud credits, spending cap, plugin settings
openclaw.jsonCore config (plugins, models, agent defaults)
auth-profiles.jsonDevice auth profiles (optional)

Agent Commands

Run AI agent turns directly from your terminal. The agent has access to 60+ skills, web search, image generation, file operations, scheduling, and more.

Quick Start

bash
# Ask a question
hexaclaw agent --agent main --message "What is the capital of France?"

# Get JSON output (for scripting)
hexaclaw agent --agent main --message "What is 2+2?" --json

# Set thinking level
hexaclaw agent --agent main --message "Analyze this code" --thinking medium

Web Search

The agent can search the web in real-time using the built-in web search tool:

bash
hexaclaw agent --agent main \
  --message "Search the web for the latest AI news and summarize the top 3 stories"

Image Generation

Generate images using fal.ai models (1-6 credits per image):

bash
hexaclaw agent --agent main \
  --message "Generate an image of a sunset over mountains, photorealistic style"

# The agent returns the image URL in its response

File Operations

Read, write, and edit files on your machine:

bash
# Read a file
hexaclaw agent --agent main --message "Read ~/notes.txt and summarize it"

# Write a file
hexaclaw agent --agent main \
  --message "Write a Python script that sorts a list of numbers to ~/sort.py"

Scheduling (Cron)

Set up recurring tasks via the built-in scheduler:

bash
# List scheduled jobs
hexaclaw agent --agent main --message "List my cron jobs"

# Create a daily summary
hexaclaw agent --agent main \
  --message "Schedule a daily job at 9am that searches for AI news and sends me a summary"

Agent Options

FlagDescription
--agent <id>Target a specific agent (default: main)
-m, --message <text>The message to send to the agent
--jsonOutput result as JSON (for scripting and pipelines)
--thinking <level>Thinking depth: off, minimal, low, medium, high
--timeout <seconds>Max execution time (default: 600s)
--localRun locally with your own API keys
--deliverSend the reply to a connected channel
--session-id <id>Continue an existing conversation session
--verbose onEnable detailed logging for debugging

JSON Output Format

When using --json, the response includes the full result with metadata:

Agent JSON Response
{
  "runId": "ce6fcc29-c3f3-4653-ad16-9057c6d04ecf",
  "status": "ok",
  "summary": "completed",
  "result": {
    "payloads": [
      {
        "text": "The capital of France is Paris.",
        "mediaUrl": null
      }
    ],
    "meta": {
      "durationMs": 2270,
      "agentMeta": {
        "provider": "hexaclaw-cloud",
        "model": "gemini-2.5-flash",
        "usage": {
          "input": 49977,
          "output": 12,
          "total": 49989
        }
      }
    }
  }
}

Common Use Cases

Real-world examples showing how to use HexaClaw for everyday tasks. All commands below assume you have HexaClaw installed and authenticated.

LLM Proxy (Basic Chat)

Send prompts to any model via the CLI. HexaClaw routes to the best provider automatically.

bash
# Simple prompt
hexaclaw agent --local --message "What is 2+2? Reply with just the number." --agent main --thinking low

# Specific model (use any of the 25+ models)
hexaclaw agent --local --message "Hello, who are you?" --agent main --thinking low

Slash Commands (Interactive)

Run these inside the HexaClaw shell or in an agent conversation. Each command uses the service API and deducts credits accordingly.

Web Search (Brave) — 1 credit
/search "latest news on AI agents"
Image Generation (fal.ai) — 1-6 credits
/imagine a cyberpunk cat wearing sunglasses --model schnell
/imagine a mountain landscape at sunset --model dev
/imagine photorealistic portrait of a robot --model pro
Text-to-Speech (OpenAI) — 1-2 credits per 1K chars
/speak "Hello, this is HexaClaw speaking" --voice nova
Speech-to-Text (Whisper) — 1 credit/min
/transcribe /path/to/audio.mp3
Browser Automation (Browserbase) — 2 credits/min
/browse
Video Generation (fal.ai) — 5-20 credits
/video a cat walking on the moon --model wan-2.1-turbo
Music Generation (fal.ai) — 3 credits
/music upbeat electronic lo-fi beat --duration 10
Web Scrape (Firecrawl) — 2 credits
/scrape https://example.com
Vector Memory — 1 credit to store, free to recall
/remember HexaClaw launched in March 2026
/recall when did HexaClaw launch
Email (Resend) — 1 credit
/email user@example.com "Test Subject" This is a test email
Check Credit Balance
/budget

Agent with Tool Use

The agent automatically picks the right tool based on your request. No need to specify which service to use — the agent decides.

bash
# Agent will use web search tool
hexaclaw agent --local --message "Search the web for the latest Claude model and summarize" --agent main --thinking low

# Agent will use image gen tool
hexaclaw agent --local --message "Generate an image of a futuristic city" --agent main --thinking low

# Agent factory — spawn a specialist
hexaclaw agent --local --message "Analyze my system and create a Python data analysis agent" --agent main --thinking low

Other Useful CLI Commands

bash
# Check auth status
hexaclaw login --status

# List available models
hexaclaw models list

# List agents
hexaclaw agents list

# List plugins
hexaclaw plugins list

# Check config
hexaclaw config get agents.defaults.model

Gateway & TUI

The HexaClaw gateway is a local server that provides a web-based control UI, WebSocket connections for real-time chat, and manages channel integrations.

Starting the Gateway

bash
# Start the gateway (runs as a background service)
hexaclaw gateway start

# Or run interactively
hexaclaw gateway run --bind loopback --port 18789

# Check gateway status
hexaclaw gateway status

Web Control UI

Once the gateway is running, open the control UI in your browser:

bash
# Open the dashboard
hexaclaw dashboard

# Or navigate directly to:
# http://127.0.0.1:18789/

The control UI provides a chat interface, agent management, skill browser, and system overview -- all accessible from your browser at http://127.0.0.1:18789.

Available routes:

RouteDescription
/overviewSystem status, health, and uptime
/chatInteractive chat with your AI agent
/agentsManage agents and their configurations
/skillsBrowse and manage installed skills

Gateway Management

CommandDescription
hexaclaw gateway startStart the gateway as a background service
hexaclaw gateway stopStop the running gateway
hexaclaw gateway restartRestart the gateway service
hexaclaw gateway statusShow gateway process status and config
hexaclaw gateway runRun gateway in foreground (for debugging)

Available Tools

The agent has access to a variety of built-in tools. Here are the most commonly used:

read / write / edit

File operations on your machine

exec

Run shell commands

web_search

Search the web via Brave API

web_fetch

Fetch and parse web pages

generate_image

Create images via fal.ai

tts

Text-to-speech audio

browser

Control a headless browser

cron

Schedule recurring tasks

message

Send messages to channels

agent_factory

Create and compose new agents

memory_search

Search agent memory

sessions_spawn

Spawn sub-agents

Skills

HexaClaw ships with 60+ skills across categories like productivity, development, communication, research, and automation. Skills extend the agent with domain-specific capabilities.

bash
# The agent automatically loads skills based on your message
# Examples of skill-powered tasks:

# Email (via himalaya / gmail skill)
hexaclaw agent --agent main --message "Check my inbox for unread emails"

# GitHub (via github / gh-issues skill)
hexaclaw agent --agent main --message "List open PRs in my repo"

# Calendar (via calendar skill)
hexaclaw agent --agent main --message "What meetings do I have today?"

# Weather
hexaclaw agent --agent main --message "What's the weather in San Francisco?"

# Research
hexaclaw agent --agent main --message "Do a deep research on quantum computing trends"