LangChain's ChatOpenAI accepts a custom base URL, so chains, agents and tool calling run on Qai with one setting.
Python needs langchain-openai; JavaScript needs @langchain/openai and @langchain/core.
pip install -U langchain-openai # or npm install @langchain/openai @langchain/core
Pass base_url and api_key to ChatOpenAI.
import os
from langchain_openai import ChatOpenAI
model = ChatOpenAI(
model="qai-pro",
base_url="https://llm.quickcasa.ai/v1",
api_key=os.environ["QAI_API_KEY"],
)
print(model.invoke("Explain vector databases in two sentences.").content)In JavaScript the base URL goes inside configuration.
import { ChatOpenAI } from '@langchain/openai';
const model = new ChatOpenAI({
model: 'qai-pro',
apiKey: process.env.QAI_API_KEY,
configuration: { baseURL: 'https://llm.quickcasa.ai/v1' },
});
const message = await model.invoke('Explain vector databases in two sentences.');
console.log(message.content);bind_tools (Python) and bindTools (JavaScript) work as usual. Pick qai-flash or a higher tier for tool calling.
Tested against Qai on November 25, 2026 with langchain-openai 1.8.5 (Python) and @langchain/openai 1.8.5 (JavaScript): invoke, streaming and tool calling.
use_responses_api (Python) and useResponsesApi (JavaScript) off. Qai serves chat completions.ChatOpenAI from langchain-openai or @langchain/openai, with the base URL set to Qai.qai-flash or a higher tier.