API Documentation
CloudAI is OpenAI-compatible. If you already use OpenAI, you only need to change the base URL and API key.
Base URL
https://api.cloudai.dev/v1
All requests must include the header: Authorization: Bearer YOUR_API_KEY
Available Models
cloudai-turbo
Fastest model. Best for simple tasks, chatbots, and real-time apps.
8K ctx
$0.0002/1K tokens
cloudai-pro
Most capable model. Best for complex reasoning, code, and analysis.
32K ctx
$0.002/1K tokens
cloudai-embed
Text embeddings for semantic search and RAG applications.
512 dims
$0.00001/1K tokens
Endpoints
POST
/v1/completionsGenerate text completions
| Parameter | Type | Required | Description |
|---|---|---|---|
| prompt | string | required | The prompt to complete |
| model | string | required | Model to use (cloudai-turbo, cloudai-pro) |
| max_tokens | number | optional | Max tokens to generate (default: 256) |
| temperature | number | optional | Sampling temperature 0-2 (default: 1.0) |
POST
/v1/chat/completionsChat-style completions with conversation history
| Parameter | Type | Required | Description |
|---|---|---|---|
| messages | array | required | Array of {role, content} message objects |
| model | string | required | Model to use |
| stream | boolean | optional | Stream tokens as they are generated |
POST
/v1/embeddingsGenerate vector embeddings for text
| Parameter | Type | Required | Description |
|---|---|---|---|
| input | string | string[] | required | Text or array of texts to embed |
| model | string | optional | Embedding model (default: cloudai-embed) |