Content overview for developers

Find API documentation, integration steps, and workflow examples. Access everything needed to connect, deploy, and optimize with the largest free model catalog and energy-smart routing.

Getting Started

Welcome to CLōD's API documentation! Here you'll find everything you need to integrate our unified API into your applications. CLōD simplifies interaction with various Large Language Models (LLMs) by providing a single, consistent API endpoint. This allows you to switch between models and providers with minimal code changes, optimize for cost, latency, or token rate, and leverage advanced features like unified function calling.

Test endpoints & explore further (Swagger Docs)

Prerequisites

  • A CLōD account.
  • A CLōD API key.

API Key & Authentication

Users must authenticate requests using an API key. Your API key carries many privileges, so be sure to keep it secret! Do not share your secret API keys in publicly accessible areas such as GitHub, client-side code, and so forth.

API keys are generated in your CLōD dashboard under the "API Keys" section.

Chat Completions API

/v1/chat/completions

The /v1/chat/completions API is designed to generate text-based responses from various language models. It's built for flexibility, allowing you to choose your model, adjust settings, and optimize for cost, speed, or token rate.

Request Structure

Property Value
HTTP Method POST
Base URL https://api.clod.io
Endpoint /v1/chat/completions

Headers

Parameter Description
Authorization Bearer (apikey) Your unique CLōD API key
Content-Type application/json

Request Body

Parameter Type Description
model string Identifier of the model or strategy to use (e.g., "GPT 4o", "GPT 4o@price", "@latency").
messages array An array of message objects, each with role ("user", "assistant", "system") and content.
temperature number Optional. Sampling temperature (0-2). Higher values make output more random. Default varies by model.
max_completion_tokens integer Optional. Maximum number of tokens to generate. Default varies by model.
stream boolean Optional. If true, enables streaming of results. Default: false.
Other OpenAI-compatible parameters are supported.

Example Request

JSON Example
{
  "model": "GPT 4o",
  "messages": [
    {
      "role": "system",
      "content": "You are a helpful assistant."
    },
    {
      "role": "user",
      "content": "What is the capital of France?"
    }
  ],
  "temperature": 0.7,
  "max_completion_tokens": 50
}

CURL Example
curl -X POST "https://api.clod.io/v1/chat/completions" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "GPT 4o",
    "messages": [
      {
        "role": "system",
        "content": "You are a helpful assistant."
      },
      {
        "role": "user",
        "content": "What is the capital of France?"
      }
    ],
    "temperature": 0.7,
    "max_completion_tokens": 50
  }'

Python Example
import requests
import json

url = "https://api.clod.io/v1/chat/completions"

headers = {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
}

data = {
    "model": "GPT 4o",
    "messages": [
        {
            "role": "system",
            "content": "You are a helpful assistant."
        },
        {
            "role": "user",
            "content": "What is the capital of France?"
        }
    ],
    "temperature": 0.7,
    "max_completion_tokens": 50
}

response = requests.post(url, headers=headers, json=data)
result = response.json()

print(json.dumps(result, indent=2))

Example Response
{
  "id": "chatcmpl-xxxxxxxxxxxxxxxxxxxx",
  "object": "chat.completion",
  "created": 1677652288,
  "model": "GPT 4o", // Actual model used
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "The capital of France is Paris."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 20,
    "completion_tokens": 8,
    "total_tokens": 28
  }
}

Model Optimization Strategies

The strategy feature allows you to optimize model selection for specific criteria when multiple providers offer the same model. By adding strategy tags to your model parameter, you can prioritize models based on price, latency, or token rate.

Available Strategies

Parameter Type Description
field_name string Describe what this field does. Optional notes go here.
another_field integer Describe this field.
Additional fields supported.

Usage

Strategy tags are appended to the model name using the "@" separator. You can combine multiple strategies in any order:

Single Strategy Examples

Price:

{
  "model": "GPT 4o@price",
  "messages": [...]
}

Latency:

{
  "model": "GPT 4o@latency",
  "messages": [...]
}

Token Rate:

{
  "model": "GPT 4o@token_rate",
  "messages": [...]
}

Multiple Strategy Examples

When using multiple strategies, they can be combined in any order:

Price & Latency:

{
  "model": "GPT 4o@price@latency",
  "messages": [...]
}

Token Rate & Price

{
  "model": "GPT 4o@token_rate@latency",
  "messages": [...]
}

Latanecy + Token Rate + Price

{
  "model": "GPT 4o@price@latency@token_rate",
  "messages": [...]
}

OpenClaw Integration with CLōD

Integrate OpenClaw with CLōD to route your AI agent inference through CLōD’s OpenAI-compatible API endpoint.

This allows your OpenClaw agents to access multiple models through a single endpoint while using CLōD for unified model access and usage monitoring.

What is OpenClaw?

OpenClaw is an open-source AI agent gateway that routes agent inference requests to configurable model providers.

By configuring CLōD as a provider, OpenClaw agents can send inference requests directly through the CLōD API.

Setup

There are two ways to configure OpenClaw to use CLōD.

Recommended:
Use the OpenClaw onboarding wizard.

Advanced:
Manually configure the provider in the OpenClaw JSON configuration file.

Recommended Setup (OpenClaw Onboard Wizard)

If you are setting up OpenClaw for the first time, the easiest method is using the built-in onboarding tool.

Run:

openclaw onboard

During onboarding select:

Provider: Custom Provider

Provider Name:

custom-api-clod-io

Base URL:

https://api.clod.io/v1

Note:
The /v1 suffix is required because CLōD uses an OpenAI-compatible API format.

You will also be prompted to enter your CLōD API key and configure your default model.

Once onboarding finishes, OpenClaw automatically creates the required configuration entries.

Getting Your CLōD API Key

Before configuring OpenClaw you will need a CLōD API key.

  1. Log in to the CLōD dashboard
  2. Navigate to the API keys section
  3. Generate a new API key

Dashboard:

https://app.clod.io

Copy the API key. You will use it in your OpenClaw configuration.

Recommended Security Method (Environment Variable)

For better security, store your API key in an environment variable instead of placing it directly inside configuration files.

Example:

export CLOD_API_KEY="your_clod_api_key"

This keeps your API key out of version control and configuration files.

Manual Configuration (Advanced)

Advanced users can configure CLōD directly in the OpenClaw configuration file.

Open:

~/.openclaw/openclaw.json

Add the CLōD provider configuration.

Example:

{
  "models": {
    "mode": "merge",
    "providers": {
      "custom-api-clod-io": {
        "baseUrl": "https://api.clod.io/v1",
        "apiKey": "YOUR_CLOD_API_KEY",
        "api": "openai-completions",
        "models": [
          {
            "id": "DeepSeek V3",
            "name": "DeepSeek V3 (CLŌD)",
            "reasoning": false,
            "input": ["text"],
            "contextWindow": 128000,
            "maxTokens": 4096
          }
        ]
      }
    }
  }
}

Replace:

YOUR_CLOD_API_KEY

with your actual CLōD API key.

Using Environment Variables in JSON (Recommended)

Instead of placing the API key directly in the config file, you can reference the environment variable.

Example:

{
  "models": {
    "mode": "merge",
    "providers": {
      "custom-api-clod-io": {
        "baseUrl": "https://api.clod.io/v1",
        "apiKey": "$CLOD_API_KEY",
        "api": "openai-completions",
        "models": [
          {
            "id": "DeepSeek V3",
            "name": "DeepSeek V3 (CLŌD)",
            "reasoning": false,
            "input": ["text"],
            "contextWindow": 128000,
            "maxTokens": 4096
          }
        ]
      }
    }
  }
}

Then define the key:

export CLOD_API_KEY="your_clod_api_key"

Choosing a Model

CLōD supports multiple models that can be used through OpenClaw.

Model identifiers should match the names listed in the CLōD model catalog.

Model catalog:

https://app.clod.io/user/models

Examples of available models:

• DeepSeek V3
• Llama 3.1 8B
• Minimax M2.5

When configuring a model in OpenClaw, use the exact name provided in the CLōD model list.

Example:

"id": "Llama 3.1 8B"

Context Window Configuration

The contextWindow parameter must match the maximum context supported by the model you are using.

Typical values include:

Model Context Window
DeepSeek V3 128000
Llama 3.1 8B 128000
Some extended models up to 400000

If you configure a context window larger than what the model supports, inference requests may fail.

Always verify supported context sizes on the CLōD model page.

Starting OpenClaw

After configuration is complete, start or restart the OpenClaw gateway.

Example:

openclaw gateway run

OpenClaw will load the custom-api-clod-io provider and route inference requests through CLōD.

Monitoring Usage

Once OpenClaw is running with CLōD, you can monitor inference usage from the CLōD dashboard.

Dashboard:

https://app.clod.io

From the dashboard you can view:

• Request activity
• Token usage
• Model usage
• Total consumption

This helps track how your OpenClaw agents are using inference resources.

n8n Integration with CLōD

This is an n8n community node for the CLōD API, an OpenAI-compatible LLM service.

Installation

In your n8n instance, go to Settings > Community Nodes and install:

@clod_io/n8n-nodes-clod

Or install via npm:

npm install @clod_io/n8n-nodes-clod

Credentials

  1. Go to https://app.clod.io and sign in
  2. Navigate to your account settings to get your API key
  3. In n8n, create new credentials of type CLōD API and enter your API key

Usage

The CLōD node supports chat completions with the following parameters:

  • Model (required): The model name to use (e.g., "Llama 3.1 8B")
  • Messages (required): JSON array of message objects with role and content
  • Options:
    • Temperature (0-2)
    • Max Tokens
    • Stream

Example Messages Format

[
  {"role": "system", "content": "You are a helpful assistant."},
  {"role": "user", "content": "Hello!"}
]

License

MIT

Kilo Code Integration with CLōD

Use the Kilo Code VS Code extension with CLōD by connecting it to CLōD’s OpenAI-compatible API endpoint.

This allows Kilo Code to route inference requests through CLōD and access any model available in your CLōD account.

What is Kilo Code?

Kilo Code is a VS Code extension for agentic coding, allowing AI models to read files, run commands, and assist with development workflows inside your code editor.

By connecting Kilo Code to CLōD, you can use CLōD-hosted models directly inside VS Code.

Setup

Follow these steps to connect Kilo Code to CLōD.

Step 1  Install the Kilo Code Extension

  1. Open VS Code
  2. Open the Extensions panel

Ctrl + Shift + X

  1. Search for Kilo Code
  2. Click Install

Step 2  Configure CLōD as an OpenAI-Compatible Provider

Open the Kilo Code settings and configure the provider.

Set the following values:

Provider:
OpenAI Compatible

Base URL:

https://api.clod.io/v1

Note:
The /v1 suffix is required because CLōD uses an OpenAI-compatible API format.

API Key
Enter your CLōD API key.

If you do not have an API key yet, create one in the CLōD dashboard.

https://app.clod.io

Step 3  Select a Model

Once the API key is entered, Kilo Code will automatically fetch the models available in your CLōD account.

You can then select a model directly from the Kilo Code interface.

Examples of available models include:

• DeepSeek V3
• Llama 3.1 8B
• Minimax M2.5

The available models depend on what is enabled in your CLōD account.

Model Requirements

Kilo Code performs agentic actions such as:

• reading files
• running commands
• editing code

These capabilities rely on tool calling (function calling).

For best results, choose a model that supports tool usage.

You can view available models in the CLōD model catalog:

https://app.clod.io/user/models

Try It

Once configured, you can start using Kilo Code with CLōD.

Examples of useful prompts:

Scan this repository and explain the architecture in 10 bullets.

Find the entry point for feature X and show the call chain.

Run tests and fix the first failing test.

Refactor module X and update all related imports.

Monitoring Usage

You can monitor inference usage from the CLōD dashboard.

https://app.clod.io

From the dashboard you can view:

• Request activity
• Token usage
• Model usage
• Overall consumption

Next Steps

Once connected to CLōD, you can:

• Switch between available models
• Use larger-context models when needed
• Monitor inference usage through the CLōD dashboard
• Integrate CLōD into additional developer tools

Using CLōD with the OpenAI SDK

Frameworks and Integrations

CLōD provides an OpenAI-compatible API, which means most tools and frameworks that support the OpenAI API can connect to CLōD with minimal configuration.

This includes:

• OpenAI SDK
• LangChain
• LiteLLM
• AI coding assistants
• agent frameworks
• custom applications

To connect to CLōD, configure the API endpoint and your API key.

Quick API Example

You can verify your CLōD connection by sending a simple request to the API.

cURL Example

curl https://api.clod.io/v1/chat/completions \
 -H "Content-Type: application/json" \
 -H "Authorization: Bearer YOUR_CLOD_API_KEY" \
 -d '{
   "model": "DeepSeek V3",
   "messages": [
     {
       "role": "user",
       "content": "What is the meaning of life?"
     }
   ]
 }'

If successful, the API will return a response containing the model’s output.

Install the OpenAI SDK

You can use the official OpenAI SDK with CLōD.

Python

pip install openai

Node.js

npm install openai

Python Example

from openai import OpenAI

client = OpenAI(
   base_url="https://api.clod.io/v1",
   api_key="YOUR_CLOD_API_KEY",
)

completion = client.chat.completions.create(
   model="DeepSeek V3",
   messages=[
       {
           "role": "user",
           "content": "Explain how electricity markets work in 3 sentences."
       }
   ]
)

print(completion.choices[0].message.content)

Node.js Example

import OpenAI from "openai";

const client = new OpenAI({
 baseURL: "https://api.clod.io/v1",
 apiKey: process.env.CLOD_API_KEY,
});

const completion = await client.chat.completions.create({
 model: "DeepSeek V3",
 messages: [
   {
     role: "user",
     content: "Explain how electricity markets work in 3 sentences."
   }
 ],
});

console.log(completion.choices[0].message.content);

Roo Code Integration with CLōD

Use the Roo Code VS Code extension with CLōD by connecting it to CLōD’s OpenAI-compatible API endpoint.

This allows Roo Code to route inference requests through CLōD and access any model available in your CLōD account.

What is Roo Code?

Roo Code is a VS Code extension for agentic coding, allowing AI models to analyze projects, generate code, refactor files, and assist with development workflows inside your editor.

By connecting Roo Code to CLōD, you can use CLōD-hosted models directly within VS Code.

Setup

Follow these steps to connect Roo Code to CLōD.

Step 1  Install Roo Code

  1. Open VS Code
  2. Open the Extensions panel

Ctrl + Shift + X

  1. Search for Roo Code
  2. Click Install

Step 2  Configure CLōD as an OpenAI-Compatible Provider

Open the Roo Code settings and configure the provider.

Set the following values:

Provider
OpenAI Compatible

Base URL

https://api.clod.io/v1

Note:
The /v1 suffix is required because CLōD uses an OpenAI-compatible API format.

API Key
Enter your CLōD API key.

If you do not have an API key yet, generate one from the CLōD dashboard.

https://app.clod.io

Step 3 Select a Model

After entering your API key, Roo Code will automatically fetch the models available in your CLōD account.

You can then select a model directly from the Roo Code interface.

Examples of available models include:

• DeepSeek V3
• Llama 3.1 8B
• Minimax M2.5

The models shown depend on what is enabled in your CLōD account.

Model Requirements

Roo Code performs agentic actions, including:

• reading project files
• running commands
• modifying code
• refactoring modules

These capabilities rely on tool calling (function calling).

For best results, choose a model that supports tool usage.

You can view available models in the CLōD model catalog:

https://app.clod.io/user/models

Try It

Once configured, you can start using Roo Code with CLōD inside VS Code.

Example prompts:

Map the main modules in this repository and explain their purpose.

Find where request X is handled and describe the execution flow.

Refactor this logic into a helper function and update all call sites.

Run lint or tests and fix issues until the build passes.

Monitoring Usage

You can monitor inference usage from the CLōD dashboard.

https://app.clod.io

From the dashboard you can view:

• request activity
• token usage
• model usage
• overall consumption

Next Steps

Once Roo Code is connected to CLōD, you can:

• switch between models available on CLōD
• use higher-context models when working with large repositories
• monitor inference usage through the CLōD dashboard
• integrate CLōD with additional development tools