Celedog + LangChain Integration Guide

LangChain's OpenAI provider accepts a custom base URL. Point it at Celedog and your existing chains gain instant access to 200+ models.

LangChain already speaks OpenAI, so pointing it at Celedog is a configuration change, not a rewrite. You get every Celedog model — GPT, Claude, Gemini, DeepSeek — inside chains, agents and tools, with one key.

Configure ChatOpenAI for Celedog

Use the ChatOpenAI class and set base_url and api_key to Celedog. The rest of LangChain — prompts, chains, output parsers, agents — works unchanged.

from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    model="gpt-5.5",
    api_key="YOUR_CELEDOG_KEY",
    base_url="https://celedog.io/v1",
)

print(llm.invoke("Explain a gateway in one sentence.").content)

Swap models per chain

Because the model is a constructor argument, you can use different models for different steps of a pipeline — a cheap model to draft, a strong model to refine — all behind one account.

drafter = ChatOpenAI(model="deepseek-v4-flash", base_url="https://celedog.io/v1", api_key="YOUR_CELEDOG_KEY")
refiner = ChatOpenAI(model="claude-opus-4-7", base_url="https://celedog.io/v1", api_key="YOUR_CELEDOG_KEY")

draft = drafter.invoke("Draft a product blurb for an AI gateway.").content
final = refiner.invoke("Polish this blurb: " + draft).content
print(final)

Agents and tools

LangChain agents call tools and loop over an LLM. Point the agent's LLM at Celedog and the whole agent runs through the gateway — including tool-calling models like the GPT and Claude families that support function calling.

Tips

  • One env var. Set OPENAI_API_KEY and OPENAI_BASE_URL in the environment and LangChain picks them up without per-object config.
  • Mind token cost in loops. Agents can iterate many times; route reasoning steps through auto-cheapest where quality allows.
  • Use the served-model field. When you route via a meta-model, log which concrete model answered so you can tune your chain.
LangChain plus Celedog gives you a model-agnostic pipeline: write the chain once, swap any model in with a string, and bill it all to one wallet.

Written by · Last updated May 28, 2026

Where to go next