HFAI Cloud · integration

LangChain
on HFAI Cloud.

base_url and api_key on ChatOpenAI.

01 / THE TOOL

A chat model with two overrides.

Its own class,
its own two arguments.

LangChain documents its OpenAI integration around a chat-model class called ChatOpenAI, and that class takes base_url and api_key as arguments of its own. The same page notes that an older openai_api_base spelling is still accepted for the first of the two, and that the environment can supply them when the constructor does not. Checked against python.langchain.com/docs/integrations/chat/openai.

from langchain_openai import ChatOpenAI

model = ChatOpenAI(
    model="gpt-oss:120b",
    base_url="https://api.heartflowai.net/v1",
    api_key="hfai_live_…",
)

print(model.invoke("Hello HFAI").content)

The instance above is the object a chain or an agent is handed, which means the endpoint decision is made once and everything built on the model inherits it. Model identifiers stay plain strings, so a different row of the catalogue is a different string and nothing else.

LangChain is an independent framework project with its own maintainers and its own release process. HeartFlowAI is not affiliated with it, is not a partner of it, and this page is not approved or endorsed by its maintainers. The two argument names and the import above were checked at python.langchain.com/docs/integrations/chat/openai.

02 / THE ENDPOINT

The class a chain is built on.

Point it once,
build on top of it.

A chain, a tool-calling agent and a retriever all sit on top of the same chat-model object, so one construction decides the endpoint for the whole graph.

The chat-completions shape is in the API reference, the balance model on HFAI Cloud, and GPT-OSS 120B is the row the free tier covers.

ONE KEY · EVERY CLIENT

Framework, not lock-in.

Because the class takes the endpoint as an argument, a LangChain application can keep its provider layer replaceable with one construction.