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/completions

Generate text completions

ParameterTypeRequiredDescription
promptstringrequiredThe prompt to complete
modelstringrequiredModel to use (cloudai-turbo, cloudai-pro)
max_tokensnumberoptionalMax tokens to generate (default: 256)
temperaturenumberoptionalSampling temperature 0-2 (default: 1.0)
POST/v1/chat/completions

Chat-style completions with conversation history

ParameterTypeRequiredDescription
messagesarrayrequiredArray of {role, content} message objects
modelstringrequiredModel to use
streambooleanoptionalStream tokens as they are generated
POST/v1/embeddings

Generate vector embeddings for text

ParameterTypeRequiredDescription
inputstring | string[]requiredText or array of texts to embed
modelstringoptionalEmbedding model (default: cloudai-embed)