ClaudeOpenAISetup guide
Claude openai compatible api: quickstart guide
Use any OpenAI SDK to send text to our uncensored LLM via a single endpoint. This guide shows how to connect your code in under a minute.
- Base URL
- https://api.claudeopenaicompatibleapi.com/v1
- Model
- uncensored
Supported endpoints: chat and models
We provide two standard endpoints. Use POST /v1/chat/completions for text generation. Use GET /v1/models to verify the model ID.
Our service does not support embeddings, image generation, or fine-tuning. We focus strictly on chat completions. This keeps the infrastructure simple and cost-effective.
You can send text prompts and receive text responses. The system supports streaming via Server-Sent Events. You can also use function calling and JSON mode.
Authentication and base URL setup
Point your client at our base URL and provide your API key. The base URL is https://api.claudeopenaicompatibleapi.com/v1.
You get one key per account. If you need a new key, generate one and the old one stops working. No phone number is required for signup.
Set your API key in the environment variable or SDK config. The key grants access to your prepaid credit.
cURL
curl https://api.claudeopenaicompatibleapi.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "Convert this Python function to Rust"}]
}'Python
from openai import OpenAI
client = OpenAI(base_url="https://api.claudeopenaicompatibleapi.com/v1", api_key="YOUR_KEY")
resp = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "Summarise this thread without softening it."}],
)
print(resp.choices[0].message.content)Node.js
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.claudeopenaicompatibleapi.com/v1", apiKey: process.env.API_KEY });
const resp = await client.chat.completions.create({
model: "uncensored",
messages: [{ role: "user", content: "Draft a villain monologue for my game." }],
});
console.log(resp.choices[0].message.content);Streaming
stream = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "Tell the story in second person."}],
stream=True,
)
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)Get your API key now
Sign up, copy the key, update the base URL. Setup is complete.