
LangChain + TokenRex — setup in 3 lines
How to point LangChain's ChatOpenAI class at TokenRex.
LangChain's ChatOpenAI takes a base_url. That's the whole setup.
python
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(
model="gpt-5.4-mini",
api_key="YOUR_TOKENREX_API_KEY",
base_url="https://tokenrex.ai/api/public/v1",
)All LangChain chains, tools, and agents work unchanged — LangChain doesn't know or care about the endpoint.
Models in this article
Review current prices, specifications and source-linked benchmarks.
Build this with TokenRex
TokenRex is an LLM marketplace by Asirex Labs. Choose an enabled model, create a private API key and use the supported endpoint shown in Docs. Check live prices before your first request.