CLPAI API Documentation
Welcome to the CLPAI Enterprise Platform. We provide a unified gateway for two core services:
1. CLPAI API (OpenAI Compatible)
Drop-in replacement for OpenAI. Access GPT-4o, Claude 3.5, and Gemini 1.5 via a single standard interface.
Chat Image2. Agent Services
Invoke specialized Agents (App ID) to process specific tasks. Input your data, and the Agent returns the processed result.
Workflow Data ProcessingAPI Basics
| Base URL | https://agent.clpai.com/v1 |
| Auth Header | Authorization: Bearer sk-... |
Authentication
All API requests require an API Key. This key links usage to your account balance.
How to get a Key
- Log in to CLPAI Console.
- Navigate to "Tokens".
- Create a new token and copy the
sk-string.
Header Usage
Authorization: Bearer sk-YourApiKeyHere
/v1/chat/completions
Standard chat interface. Compatible with all OpenAI libraries.
Example Request
curl https://agent.clpai.com/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-YourApiKey" \
-d '{
"model": "gpt-4o",
"messages": [
{"role": "user", "content": "Hello!"}
]
}'
/v1/images/generations
Generate images from text prompts using models like DALL-E 3 or Midjourney (via proxy).
Parameters
| Param | Type | Description |
|---|---|---|
| prompt | string | A text description of the desired image. |
| model | string | e.g., dall-e-3, midjourney. |
| size | string | e.g., 1024x1024. |
Example Request
curl https://agent.clpai.com/v1/images/generations \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-YourApiKey" \
-d '{
"model": "dall-e-3",
"prompt": "A futuristic city with flying cars",
"n": 1,
"size": "1024x1024"
}'
/v1/models
List all currently available models on the platform.
curl https://agent.clpai.com/v1/models -H "Authorization: Bearer sk-YourApiKey"
Agent Service Workflow
CLPAI Agent Services allow you to submit raw data to a specialized AI worker and receive structured results.
How it Works
Find an Agent
Visit the Console, browse the "Agent Services" section, and choose an Agent (e.g., "Financial Report Analyzer").
Get Credentials
Copy the App ID (e.g., app-finance-01) of that Agent. You will also need your standard API Key.
Submit Data
Call the Agent API endpoint, passing the app_id and your input data (text, file URL, or JSON).
Receive Result
The Agent processes the data using its internal logic (Tools/RAG) and returns the final output to you.
/v1/agent/run
Execute a specific Agent Service.
Request Body
| Param | Type | Description |
|---|---|---|
| app_id | string | Required. The unique ID of the Agent. |
| input | string/json | The data you want the Agent to process. |
| stream | boolean | Whether to stream the output. |
Code Example
curl https://agent.clpai.com/v1/agent/run \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-YourApiKey" \
-d '{
"app_id": "app-data-analyzer-v2",
"input": "Here is the sales data: [JSON Data...]. Please summarize trends.",
"stream": false
}'
Pricing & Billing
💎 Exchange Rate: 1 USD(Top-up Ratio)
1. CLPAI API Pricing (Pay-per-Token)
Charged based on input/output tokens used by the underlying model.
- GPT-4o-mini: $0.15 / 1M Tokens
- GPT-4o: $2.50 / 1M Tokens
- Claude 3.5 Sonnet: $3.00 / 1M Tokens
2. Agent Service Pricing
Agent services are billed in two ways, depending on the Agent type:
Mode A: Pay-per-Token
For Agents that primarily process text/chat. You are billed based on the tokens consumed by the Agent's internal reasoning.
Mode B: Pay-per-Request
For specialized tasks (e.g., "Generate 1 Report", "Search 1 Topic"). You are billed a fixed price per successful API call.
Client Integration
Configuration
Error Codes
| Code | Description |
|---|---|
| 401 | Invalid API Key. |
| 402 | Insufficient Balance. |
| 404 | Model or Agent App ID not found. |