
Integrate the API with LangChain
LangChain ships with native OpenAI support, so integrating our endpoint is a one-line change: set openai_api_base to our URL.

Minimal agent example
from langchain_openai import ChatOpenAI chat = ChatOpenAI(model="gpt-4o-mini", openai_api_base="https://api.your-domain.com/v1", api_key="sk-your-token")
What changes for each provider
| Component | Change required |
|---|---|
| ChatOpenAI | openai_api_base + api_key |
| OpenAIEmbeddings | openai_api_base + api_key |
| OpenAILLM | openai_api_base + api_key |
LangSmith / tracing 📊
Tracing keeps working because the requests still look like standard OpenAI calls to the framework.
Next steps
- Add a retry policy for transient errors
- Set per-token quota limits
- Cache tool outputs to reduce spend
Within ten minutes you can have an agent running on our endpoint ⚡.
Frequently asked questions ❓
Do I need to change any LangChain code?
No. Just set openai_api_base and api_key on the ChatOpenAI and OpenAIEmbeddings instances.
Do embeddings work the same way?
Yes. OpenAIEmbeddings accepts the same base URL and key, so vector stores work unchanged.
Can I use this with LangGraph agents?
Yes. Agents built on ChatOpenAI and OpenAI tools run without any extra wiring.
Where do I get the api_key?
Create a token in the panel and use it as your api_key.
Comments (0)