API Doc-CometAPI
HomeDashBoardModel Marketplace
HomeDashBoardModel Marketplace
Discord_Support
  1. 🧩 Integration Guides
  • How to Use CometAPI?
  • šŸš€ Overview
    • Quick Start
    • Important Guidelines
    • Release Notes
    • Quickly request CometAPI via ApiDog
    • Models
  • šŸ’¬ Text Models
    • Chat Completions
    • Responses
    • Anthropic Messages
    • Gemini Generating Content
    • Embeddings
  • šŸ–¼ļø Image Models
    • OpenAI
      • gpt-4o-image generates image
      • Images
      • Image Editing (gpt-image-1)
    • Gemini
      • Guide to calling gemini-3-pro-image (Nano Banana)
      • Gemini generates image
    • Midjourney
      • Midjourney API Quick Start
      • Task Fetching API
        • List by Condition
        • Fetch Single Task (most recommended)
      • Imagine
      • Submit Video
      • Submit Editor
      • Action (UPSCALE; VARIATION; REROLL; ZOOM, etc.)
      • Blend (image -> image)
      • Describe (image -> text)
      • Modal (Area Redesign & Zoom)
    • Replicate(image)
      • Create Predictions - General
      • replicate query
    • seededit/seedream
      • bytedance-image-generation(seedream)
      • bytedance-Image Editing (seededit)
    • bria
      • Generate Image
      • Generate Vector Graphics - Base (Beta)
      • Image Editing
      • Query Status
    • Flux(images)
      • flux generate image
      • flux query
  • šŸ“ŗ Video Models
    • sora-2
      • official
        • Create video
        • Remix video
        • Retrieve video
        • Retrieve video content
    • veo3
      • self-developed
        • Veo3 Async Generation
        • Veo3 Retrive
    • XAI
      • Video Generation
      • Video Edit
      • Get video generation results
    • kling (video)
      • callback_url
      • Multimodal Video Editing
        • Initialize Video for Editing
        • Add Video Selection
        • Delete Video Selection
        • Clear Video Selection
        • Preview Selected Video Area
        • Create Task
      • Text to Video
      • Image to Video
      • Multi-Image To Video
      • Video Extension
      • TTS
      • Avatar
      • Lip-Sync
      • [Counterpart] Creating Tasks
      • Video Effects
      • Text to Audio
      • Video to Audio
      • Image Generation
      • Multi-Image to Image
      • Image Expansion
      • Image Recognize
      • Virtual Try-On
      • Individual queries
      • Omni Video
      • Omni Query
    • runway(video)
      • official format
        • runway images raw video
        • Generate a video from a video
        • Generate an image from text
        • Upscale a video
        • Control a character
        • runway to get task details
      • Reverse Format
        • generate(text)
        • generate(Reference images)
        • Video to Video Style Redraw
        • Act-one Expression Migration
        • feed-get task
    • bytedance
      • bytedance-video
      • bytedance-video get
    • MiniMax Conch(video)
      • MiniMax Conch Official Documentation
      • MiniMax Conch Generation
      • MiniMax Conch Query
      • MiniMax Conch Download
  • šŸ”Š Audio Models
    • Realtime
    • Create speech
    • Create transcription
    • Create translation
  • 🧩 Integration Guides
    • OpenClaw
    • CodeX
    • LiteLLM
    • Dify
    • Make
    • n8n
    • Lobe-Chat
    • COZE
    • Zapier
    • Activepieces
    • LlamaIndex
    • Continue
    • FlowiseAI
    • Chatbox
    • CherryStudio
    • AnythingLLM
    • LangChain
    • BuildShip
    • gptme
    • Immersive Translation
    • Cline
    • Eudic Translation
    • ChatHub
    • OpenAI Translator
    • ChatAll Translation
    • Pot Translation
    • Zotero
    • NEXT CHAT (ChatGPT Next Web)
    • Obsidian's Text Generator Plugin
    • librechat
    • utools-ChatGPT Friend
    • avante.nvim
    • Open WebUI
    • GPT Academic Optimization (gpt_academic)
    • OpenManus
    • IntelliJ Translation Plugin
    • FastGPT
    • n8n Local Deployment
  • āš ļø Errors
    • Error Codes & Handling
  • šŸ“ Code Examples
    • Text-to-Image Generation
    • Image-to-image generation URL upload
    • Regular Post Text Conversation
    • OpenAI Official Library Usage Example
    • Streamed Output
    • Json Fixed Format Output Code Display
    • Embedding code example
    • o1-preview Model Code Example
    • LangChain Usage Example (Successful Test Date: 2024-11-25)
    • Openai dall-e-3 & flux series drawing model
    • gpt, claude, gemini multimodal network image parsing example
    • Multimodal PDF File Parsing Examples for GPT, Claude, and Gemini
    • Code example
  • šŸ„šŸ¼ā€ā™€ļø Best Practices
    • Retry Logic Documentation for CometAPI and OpenAI Official API
    • Runway Best Practices
    • Gemini CLI Installation and Usage Guide
    • Codex Usage Guide
    • CometAPI Account Balance Query API Usage Instructions
    • Midjourney Best Practices
    • Claude Code Installation and Usage Guide
  • šŸ’³ Pricing & Billing
    • About Pricing
  • šŸ¤šŸ¼ Support
    • Help Center
    • Interface Stability
    • Privacy policy
    • Terms of service
    • Common Misconceptions
    • Confusion about use
  1. 🧩 Integration Guides

OpenClaw

Configure OpenClaw with CometAPI#

Use CometAPI as a custom model provider for OpenClaw - 500+ models in one API, up to 20% off.
This guide is updated for the current OpenClaw onboarding flow (2026.3.8+).

Prerequisites#

Node.js >= 22
CometAPI API Key
image.png
image.png

1. Install or Update OpenClaw#

Recommended (official installer):
Or keep using a global npm install:

2. Run Onboarding Once#

Run the current setup wizard:
During onboarding:
In Model/Auth, choose Skip if you only want the base install first.
Keep the default workspace unless you already use a custom one.
Let the wizard install the daemon and run the health check.
After onboarding, confirm the gateway is up:
This creates the current OpenClaw state layout under ~/.openclaw, including openclaw.json, the default workspace, and the per-agent directories under ~/.openclaw/agents/.

3. Store Your CometAPI Key#

For daemon installs, the most reliable place is ~/.openclaw/.env:
If you already inject COMETAPI_KEY through your shell, service manager, or another secrets workflow, keep doing that. The config below uses ${COMETAPI_KEY} so the key never needs to be hardcoded into openclaw.json.

4. Add CometAPI Providers#

Edit ~/.openclaw/openclaw.json and merge in the following fields:
ProviderAPI FormatBase URL
cometapi-openaiopenai-completionshttps://api.cometapi.com/v1
cometapi-claudeanthropic-messageshttps://api.cometapi.com
cometapi-googlegoogle-generative-aihttps://api.cometapi.com/v1beta
These are three separate provider entries because OpenClaw routes by API compatibility, not by vendor name alone. You can keep only one of them, or keep all three and switch between OpenAI-compatible, Anthropic-compatible, and Google-compatible model APIs with normal provider/model refs.
{
  agents: {
    defaults: {
      model: {
        primary: "cometapi-claude/claude-sonnet-4-6",
      },
    },
  },
  models: {
    mode: "merge",
    providers: {
      "cometapi-openai": {
        baseUrl: "https://api.cometapi.com/v1",
        apiKey: "${COMETAPI_KEY}",
        api: "openai-completions",
        models: [{ id: "gpt-5.4", name: "GPT-5.4" }],
      },
      "cometapi-claude": {
        baseUrl: "https://api.cometapi.com",
        apiKey: "${COMETAPI_KEY}",
        api: "anthropic-messages",
        models: [{ id: "claude-sonnet-4-6", name: "Claude Sonnet 4.6" }],
      },
      "cometapi-google": {
        baseUrl: "https://api.cometapi.com/v1beta",
        apiKey: "${COMETAPI_KEY}",
        api: "google-generative-ai",
        models: [{ id: "gemini-3.1-pro-preview", name: "Gemini 3.1 Pro" }],
      },
    },
  },
}
Notes:
OpenClaw uses ~/.openclaw/openclaw.json as the config source you edit.
Custom providers are materialized into the per-agent models.json under ~/.openclaw/agents/<agentId>/.
For this basic setup, you do not need to hand-create auth-profiles.json. The provider key is resolved from models.providers.*.apiKey via ${COMETAPI_KEY}.
auth-profiles.json is only needed if you want stored per-profile secrets or rotation across multiple credentials.
The exact example model IDs in this guide are gpt-5.4, claude-sonnet-4-6, and gemini-3.1-pro-preview.
Use the full provider/model string everywhere so the configured model stays explicit.
You can add any model from the CometAPI Models Page to the matching provider block.

5. Restart and Verify#

Restart once after adding ~/.openclaw/.env or changing provider config:
Then run the current diagnostics:
What success looks like:
openclaw models status resolves the primary model to cometapi-claude/claude-sonnet-4-6 and does not show missing auth for the CometAPI providers.
openclaw models list --provider cometapi-claude lists the configured CometAPI models.
openclaw doctor does not report config schema errors or missing auth for the CometAPI providers. It may still warn about unrelated local issues such as permissions, legacy services, or optional embedding providers.

6. Switch Models#

7. Clean Reinstall (Optional)#

If you are fixing a broken older setup and want to retest from zero, stop the gateway, remove ~/.openclaw, then rerun onboarding before applying the CometAPI config again. This deletes local config, sessions, logs, auth state, and the default workspace.
Modified atĀ 2026-03-10 08:04:13
Previous
Create translation
Next
CodeX
Built with