Docs
Get started with Cloudsome's OpenAI-compatible endpoints.
Quick Start
1. Create an account and generate an API key from the dashboard.
2. Make sure the current workspace has sufficient balance; top up if needed.
3. Install the OpenAI SDK for your language.
4. Get an available model ID from the Models page or GET /v1/models, then point the base URL to Cloudsome and make requests with that model ID.
Python
from openai import OpenAI client = OpenAI( base_url="https://api.cloudsome.ai/v1", api_key="sk_live_...", ) response = client.chat.completions.create( model="YOUR_MODEL_ID", messages=[{"role": "user", "content": "Hello!"}], stream=True, ) for chunk in response: print(chunk.choices[0].delta.content, end="")
Node.js
import OpenAI from "openai"; const client = new OpenAI({ baseURL: "https://api.cloudsome.ai/v1", apiKey: "sk_live_...", }); const response = await client.chat.completions.create({ model: "YOUR_MODEL_ID", messages: [{ role: "user", content: "Hello!" }], }); console.log(response.choices[0].message.content);
cURL
curl https://api.cloudsome.ai/v1/chat/completions \ -H "Authorization: Bearer sk_live_..." \ -H "Content-Type: application/json" \ -d '{ "model": "YOUR_MODEL_ID", "messages": [{"role": "user", "content": "Hello!"}] }'
Image Generation
Use your API key to call POST /v1/images/generations. Replace model with the image model ID shown on the Models page.
curl https://api.cloudsome.ai/v1/images/generations \ -H "Authorization: Bearer sk_live_your_key_here" \ -H "Content-Type: application/json" \ -d '{ "model": "YOUR_IMAGE_MODEL_ID", "prompt": "A futuristic city floating above a sea of clouds", "n": 1, "resolution": "1080P", "ratio": "1:1", "response_format": "url" }'
Common parameters: model and prompt are required; n controls the number of images; resolution and ratio control the output dimensions; response_format selects url or b64_json output.
You may also send additional parameters supported by the selected model's upstream API. Parameter names, values, and limits vary by model; refer to the original documentation from that model's upstream provider.
IDE & Tool Integration
Cloudsome is compatible with popular AI coding tools. Here's how to configure Claude Code, Codex, OpenCode, and CC Switch.
Claude Code
Install Claude CodeSet environment variables in your terminal to use Cloudsome as the Claude Code backend. You can also persist settings in ~/.claude/settings.json.
export ANTHROPIC_BASE_URL="https://api.cloudsome.ai" export ANTHROPIC_AUTH_TOKEN="sk_live_your_key_here" export CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1
{
"env": {
"ANTHROPIC_BASE_URL": "https://api.cloudsome.ai",
"ANTHROPIC_AUTH_TOKEN": "sk_live_your_key_here",
"ANTHROPIC_DEFAULT_HAIKU_MODEL": "claude-haiku-4-5-20251001",
"ANTHROPIC_DEFAULT_OPUS_MODEL": "claude-opus-4-6",
"ANTHROPIC_DEFAULT_SONNET_MODEL": "claude-sonnet-4-6",
"ANTHROPIC_MODEL": "claude-opus-4-6",
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC": "1",
"CLAUDE_CODE_ATTRIBUTION_HEADER": "0"
}
}Codex
Install CodexAfter setting CLOUDSOME_API_KEY, configure Cloudsome as a custom provider in ~/.codex/config.toml. The default model is GPT-5.6 Sol with high reasoning effort, and requests use the Responses API.
export CLOUDSOME_API_KEY="sk_live_your_key_here"model = "gpt-5.6-sol" model_reasoning_effort = "high" model_provider = "cloudsome" [model_providers.cloudsome] name = "Cloudsome Production" base_url = "https://api.cloudsome.ai/v1" env_key = "CLOUDSOME_API_KEY" wire_api = "responses"
OpenCode
Install OpenCodeCreate an opencode.json config file in your project root to use Cloudsome as the provider.
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"cloudsome": {
"models": {
"claude-haiku-4-5-20251001": {
"name": "Claude Haiku 4.5"
},
"claude-opus-4-6": {
"name": "Claude Opus 4.6"
},
"claude-sonnet-4-6": {
"name": "Claude Sonnet 4.6"
}
},
"npm": "@ai-sdk/openai-compatible",
"options": {
"apiKey": "sk_live_your_key_here",
"baseURL": "https://api.cloudsome.ai/v1",
"setCacheKey": true
}
}
}
}CC Switch
CC Switch is a multi-provider switcher for Claude Code. After installation, import Cloudsome config with a single click via deep link.
Install CC SwitchEndpoints
/v1/chat/completions
Chat completions (streaming supported)/v1/embeddings
Text embeddings/v1/rerank
Document reranking/v1/images/generations
Image generation/v1/responses
Responses API/v1/models
List available modelsAuthentication
All API requests require a Bearer token in the Authorization header. Generate API keys from your dashboard. Keys start with sk_live_.
curl https://api.cloudsome.ai/v1/chat/completions \ -H "Authorization: Bearer sk_live_your_key_here"
API Key Guardrails
Guardrails define reusable usage and access policies for API keys and organization members. Use them to keep spend limits, model access, and provider access consistent without editing every key one by one.
Budget limits
Set a spend limit with a daily, weekly, or monthly reset period.Model and provider access
Choose which models and providers covered requests can use.Flexible binding
Bind to API keys in a personal workspace, or to API keys or members in an organization. You can also save an unbound policy.Configure a Guardrail
Open Dashboard > API Key Guardrails.
Create a Guardrail, name it, and choose whether it is active.
Configure the optional budget, allowed models, and allowed providers.
Select API keys or organization members to bind, or leave it unbound for later use.
How budgets are counted
Request behavior
Streaming
All chat completion endpoints support streaming via stream: true. Tokens are delivered as server-sent events (SSE) in real time.
response = client.chat.completions.create(
model="YOUR_MODEL_ID",
messages=[{"role": "user", "content": "Hello!"}],
stream=True,
)
for chunk in response:
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="")Streaming Billing Rules
If the upstream errors before any data is streamed, you are fully refunded.
If you disconnect after streaming begins, billing uses the actual usage generated when available. If exact usage is unavailable, it is estimated from the generated content.
If the upstream fails mid-stream, billing uses the actual usage generated when available. If exact usage is unavailable, it is estimated from the partial response received.
Usage Protection
Cloudsome applies platform stability safeguards by default. User-configured spend limits are managed through API Key Guardrails or direct API key budgets. When a request exceeds a safeguard or budget, the API returns HTTP 429.
Platform stability
Default traffic safeguardsBurst protection
Automatic overload protectionBudget guardrails
Spend caps by day, week, or monthError Codes
Common platform error codes for OpenAI-compatible endpoints are listed below. Upstream providers may return additional codes, so clients should also handle unknown codes. The Anthropic Messages endpoint returns errors in Anthropic-compatible format.
{
"error": {
"message": "Insufficient balance",
"type": "invalid_request_error",
"code": "personal_balance_insufficient"
}
}invalid_api_key
RequestThe API key is missing or invalid
invalid_json
RequestRequest body is not valid JSON
invalid_request
RequestRequest parameter or field validation failed
personal_balance_insufficient
BillingPersonal account balance is insufficient; top up before retrying
guardrail_model_not_allowed
GuardrailThe requested model is not allowed by the current policy
guardrail_budget_exceeded
GuardrailThe Guardrail budget limit has been exceeded
rate_limit_exceeded
Rate limitRate or concurrency limit exceeded
route_unavailable
RoutingNo routing target is currently available
no_channel
RoutingNo available channel matches the current request
upstream_error
UpstreamThe upstream request failed; retry later