Integrate Celedog with the OpenAI Python SDK in 5 Minutes
Celedog speaks the OpenAI API. If your code already uses the openai Python package, you change one line and you're done. Here's the 5-minute walk-through.
Celedog speaks the OpenAI API. If your code already uses the openai Python package, switching to Celedog — and unlocking 200+ models behind one key — is a two-line change. Here is the full five-minute walkthrough.
1. Get a key
Sign up at celedog.io (new accounts get free credits), open the API Keys page, and create a key. Keep it secret — treat it like a password and never commit it to source control.
2. Point the SDK at Celedog
You change exactly two things: the base URL and the key. Everything else in your code stays identical.
from openai import OpenAI
client = OpenAI(
api_key="YOUR_CELEDOG_KEY",
base_url="https://celedog.io/v1",
)
resp = client.chat.completions.create(
model="gpt-5.5",
messages=[{"role": "user", "content": "Hello from Celedog"}],
)
print(resp.choices[0].message.content)
3. Switch models with a string
The whole point of a gateway is that the model is just a parameter. Swap "gpt-5.5" for "claude-opus-4-7", "gemini-2.5-pro" or "deepseek-v4-pro" — same code, different model, one bill.
for model in ["gpt-5.5", "claude-opus-4-7", "deepseek-v4-pro"]:
r = client.chat.completions.create(
model=model,
messages=[{"role": "user", "content": "Say hi in five words."}],
)
print(model, "=>", r.choices[0].message.content)
4. Stream responses
Streaming works exactly as it does against OpenAI — set stream=True and iterate the chunks.
stream = client.chat.completions.create(
model="gpt-5.5",
messages=[{"role": "user", "content": "Write a haiku about gateways."}],
stream=True,
)
for chunk in stream:
delta = chunk.choices[0].delta.content or ""
print(delta, end="")
5. Use it from anywhere the OpenAI SDK runs
Node, Go, Java, Ruby — every official OpenAI SDK accepts a custom base URL the same way. The Node version is identical in spirit: pass baseURL and apiKey to the client constructor and call chat.completions.create.
Common pitfalls
- Trailing slash. Use https://celedog.io/v1 (no trailing slash). The SDK appends the path.
- Model names. Use the exact model id from the Models page; unknown ids return a clear error.
- Key scope. Create separate keys per environment so you can rotate one without breaking the others.
Two lines changed, 200+ models unlocked, one wallet to top up. That is the whole pitch of an OpenAI-compatible gateway — and why migration is measured in minutes, not sprints.
Written by Celedog Team · Last updated May 28, 2026
Where to go next
- Try Celedog — free credits on signup, no card required.
- API documentation
- Per-model pricing
- More Celedog Tutorials