Beginner~2 min
Migrate from OpenAI to Cloudach in 2 minutes
Cloudach implements the OpenAI REST API. You keep the same SDK, the same request shapes, and the same response shapes. The only changes are your base URL and API key.
TL;DR — 2 changes
The entire migration
Before (OpenAI)
from openai import OpenAI
client = OpenAI(
api_key=os.environ["OPENAI_API_KEY"],
)After (Cloudach)
from openai import OpenAI
client = OpenAI(
base_url="https://api.cloudach.com/v1",
api_key=os.environ["CLOUDACH_API_KEY"],
)Everything else — request bodies, response shapes, streaming, error types — stays identical.
Python — full before/after
A complete example showing the only two lines that change:
# BEFORE — OpenAI
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["OPENAI_API_KEY"], # ← remove
)
response = client.chat.completions.create(
model="gpt-4o-mini", # ← update model name (see mapping below)
messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content)# AFTER — Cloudach (2 changes: base_url + api_key env var name, model name)
import os
from openai import OpenAI
client = OpenAI(
base_url="https://api.cloudach.com/v1", # ← add this
api_key=os.environ["CLOUDACH_API_KEY"], # ← update env var name
)
response = client.chat.completions.create(
model="llama3-70b", # ← use a Cloudach model ID
messages=[{"role": "user", "content": "Hello!"}],
)
print(response.choices[0].message.content) # identical output formatNode.js — full before/after
// BEFORE — OpenAI
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.OPENAI_API_KEY, // ← remove
});
const response = await client.chat.completions.create({
model: "gpt-4o-mini", // ← update model name
messages: [{ role: "user", content: "Hello!" }],
});
console.log(response.choices[0].message.content);// AFTER — Cloudach (2 changes: baseURL + apiKey env var name, model name)
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.cloudach.com/v1", // ← add this
apiKey: process.env.CLOUDACH_API_KEY, // ← update env var name
});
const response = await client.chat.completions.create({
model: "llama3-70b", // ← use a Cloudach model ID
messages: [{ role: "user", content: "Hello!" }],
});
console.log(response.choices[0].message.content); // identical output formatEnvironment variables
Update your .env file:
# BEFORE OPENAI_API_KEY=sk-... # AFTER CLOUDACH_API_KEY=sk-cloudach-...
And wherever you set environment variables in production (Vercel, Railway, Fly.io, AWS Secrets Manager, etc.).
Get your Cloudach API key from the Dashboard → API Keys page. It will look like
sk-cloudach-xxxxxxxxxxxxxxxx....Model mapping
Replace OpenAI model IDs with the closest Cloudach equivalent:
| OpenAI model | Cloudach equivalent | Notes |
|---|---|---|
gpt-4o | llama3-70b | High quality, complex reasoning |
gpt-4o-mini | llama3-8b | Fast, cost-efficient, everyday tasks |
gpt-3.5-turbo | llama3-8b | Drop-in for basic chat and completions |
gpt-4-turbo | mixtral-8x7b | Best accuracy with mixture-of-experts |
gpt-4 | llama3-70b | High-quality reasoning tasks |
See the full model list for all available models and their context window sizes.
What works identically
These features work with zero code changes beyond base URL and API key:
- ✓chat.completions.create — all parameters (temperature, max_tokens, top_p, stream, etc.)
- ✓Streaming via Server-Sent Events — same chunk format and delta structure
- ✓System, user, and assistant message roles
- ✓Multi-turn conversation history
- ✓completions.create (legacy text completions)
- ✓models.list and models.retrieve
- ✓Error response shape — same JSON schema, same HTTP status codes
- ✓OpenAI SDK error classes (APIStatusError, APIConnectionError, etc.)
- ✓Retry-After header on 429 responses
- ✓LangChain ChatOpenAI, LlamaIndex OpenAILike, LiteLLM — all work unchanged
What differs
A small number of OpenAI features are not available on Cloudach:
- ✗Function calling / tool use — Not yet supported — on the roadmap
- ✗vision / image inputs — Text-only models for now
- ✗Embeddings API (/v1/embeddings) — Not available — use a dedicated embedding service
- ✗Audio / TTS / Whisper — Not available
- ✗Assistants API, Files API — Not available
- ✗Fine-tuning API — Not available — contact sales for custom model hosting
Need a feature that's missing? Email support or watch the changelog for updates.