Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.anyapi.ai/llms.txt

Use this file to discover all available pages before exploring further.

OpenClaw

OpenClaw is an AI coding agent with support for custom OpenAI-compatible providers, fallback chains, and messaging gateway mode (Discord, Slack, Telegram, etc.).
AnyAPI is not a bundled provider in OpenClaw. You wire it in as a custom OpenAI-compatible provider under models.providers. Once registered, OpenClaw addresses models as anyapi/<vendor>/<model> (your provider ID prefix + the upstream model ID).
OpenClaw uses JSON5 at ~/.openclaw/openclaw.json — unquoted keys, trailing commas, and // comments are all valid.

Quick Start

The fastest path is the non-interactive onboarding wizard:
ANYAPI_API_KEY='your-key-here' openclaw onboard --non-interactive \
  --auth-choice custom-api-key \
  --custom-base-url "https://api.anyapi.ai/v1" \
  --custom-model-id "openai/gpt-4o" \
  --secret-input-mode ref \
  --custom-compatibility openai \
  --accept-risk
This registers a custom provider with baseUrl: https://api.anyapi.ai/v1, stores the API key as an env reference, and sets openai/gpt-4o as the default model. Then start OpenClaw:
openclaw
Prefer interactive setup? Run openclaw onboard without flags to walk through provider, URL, key, and model selection step by step.

Manual Configuration

Edit ~/.openclaw/openclaw.json directly for full control:
{
  env: {
    ANYAPI_API_KEY: "your-key-here",
  },
  models: {
    providers: {
      anyapi: {
        baseUrl: "https://api.anyapi.ai/v1",
        apiKey: {
          source: "env",
          provider: "default",
          id: "ANYAPI_API_KEY",
        },
        api: "openai-completions",
        models: [
          { id: "openai/gpt-4o" },
          { id: "openai/gpt-4o-mini" },
          { id: "anthropic/claude-sonnet-4.6" },
          { id: "google/gemini-2.5-pro" },
        ],
      },
    },
  },
  agents: {
    defaults: {
      model: {
        primary: "anyapi/openai/gpt-4o",
        fallbacks: [
          "anyapi/anthropic/claude-sonnet-4.6",
          "anyapi/openai/gpt-4o-mini",
        ],
      },
    },
  },
}
Restart OpenClaw for changes to take effect:
openclaw gateway restart   # if running as gateway daemon

Model Reference Format

OpenClaw composes model refs as <provider-id>/<upstream-model-id>. With provider ID anyapi:
  • anyapi/openai/gpt-4o — correct
  • anyapi/anthropic/claude-sonnet-4.6 — correct
  • openai/gpt-4o — won’t route through the anyapi provider
  • gpt-4o — missing vendor prefix, AnyAPI returns HTTP 400
The id field inside models.providers.anyapi.models[] is the upstream ID sent to AnyAPI (e.g. openai/gpt-4o). The anyapi/ prefix is added by OpenClaw based on your provider ID. Browse all available models at anyapi.ai/ai-models or query the API:
curl -sS -H "Authorization: Bearer $ANYAPI_API_KEY" \
  https://api.anyapi.ai/v1/models | jq -r '.data[].id'

Configuration Examples

{
  models: {
    providers: {
      anyapi: {
        baseUrl: "https://api.anyapi.ai/v1",
        apiKey: { source: "env", provider: "default", id: "ANYAPI_API_KEY" },
        models: [{ id: "openai/gpt-4o" }],
      },
    },
  },
  agents: {
    defaults: {
      model: { primary: "anyapi/openai/gpt-4o" },
    },
  },
}

Advanced Configuration

Set per-model defaults via agents.defaults.models:
{
  agents: {
    defaults: {
      models: {
        "anyapi/openai/gpt-4o": {
          params: {
            temperature: 0.7,
            max_tokens: 4096,
          },
        },
        "anyapi/openai/o3": {
          params: {
            max_completion_tokens: 8192,  // o-series uses max_completion_tokens
          },
        },
      },
    },
  },
}
Enrich model entries to enable image inputs and set context windows:
models: [
  {
    id: "openai/gpt-4o",
    name: "GPT-4o (via AnyAPI)",
    input: ["text", "image"],
    contextWindow: 128000,
    maxTokens: 16384,
  },
  {
    id: "google/gemini-2.5-pro",
    input: ["text", "image"],
    contextWindow: 1000000,
    reasoning: true,
  },
]
OpenClaw won’t infer image capability for custom providers automatically — declare it explicitly.
Add request headers for tracking:
anyapi: {
  baseUrl: "https://api.anyapi.ai/v1",
  apiKey: { source: "env", provider: "default", id: "ANYAPI_API_KEY" },
  headers: {
    "X-My-App": "my-app-v1",
  },
  models: [{ id: "openai/gpt-4o" }],
}
For multi-account setups, OpenClaw supports auth profiles. Store a key in OS keychain:
openclaw models auth add --provider anyapi

CLI Reference

# Onboarding
openclaw onboard                          # interactive setup
openclaw onboard --non-interactive ...    # scripted setup

# Model management
openclaw models list                      # list configured models
openclaw models set anyapi/openai/gpt-4o  # set default model

# Config
openclaw config validate                  # validate config
openclaw config get models.providers.anyapi.baseUrl
openclaw config set agents.defaults.model.primary "anyapi/openai/gpt-4o"

# Gateway
openclaw gateway status
openclaw gateway restart
openclaw gateway logs

Troubleshooting

OpenClaw rejects unknown keys. Use the canonical field names:
  • baseUrl (camelCase, not baseURL)
  • apiKey (object or ${VAR} template, not apiKeyEnvVar)
Validate with openclaw config validate.
The apiKey reference doesn’t resolve.
  1. Confirm the env var is set: echo $ANYAPI_API_KEY
  2. Confirm the apiKey block points to it:
    apiKey: { source: "env", provider: "default", id: "ANYAPI_API_KEY" }
    
  3. Restart OpenClaw — env changes don’t apply to a running daemon.
Your key is invalid, expired, or revoked.
  1. Validate the key at dash.anyapi.ai
  2. Test directly:
    curl https://api.anyapi.ai/v1/chat/completions \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer $ANYAPI_API_KEY" \
      -d '{"model":"openai/gpt-4o-mini","messages":[{"role":"user","content":"test"}],"max_tokens":10}'
    
The model ID is unknown or missing the vendor prefix.
  1. List the catalog: curl -H "Authorization: Bearer $ANYAPI_API_KEY" https://api.anyapi.ai/v1/models
  2. Use vendor/model form (e.g. openai/gpt-4o, not bare gpt-4o)
  3. Confirm the model is listed under models.providers.anyapi.models[] in your config
Set baseUrl to exactly https://api.anyapi.ai/v1 — no trailing slash, no /chat/completions suffix (OpenClaw appends that).
Check usage at dash.anyapi.ai, upgrade your plan, or add fallbacks to spread load.

Best Practices

  1. Store keys as env refs, not plaintext — prefer secret-input-mode ref during onboarding
  2. Configure fallbacks across different vendors for cross-provider resilience
  3. Set timeoutMs for slow models — reasoning models like openai/o3 can take minutes
  4. Pin model capability metadata — declare input: ["text", "image"] explicitly for vision models
  5. Always use vendor/model format — bare names return HTTP 400
  6. Monitor usage at dash.anyapi.ai

Support