LangChain
LangChain's ChatOpenAI takes a base URL and a key directly, so a chain that already runs on an OpenAI model runs on Kiln with three values changed and nothing else rewritten.
Install
bash
pip install langchain-openaiConnect
python
import os
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(
model="qwen3-32b",
base_url="https://api.bricksum.com/v1",
api_key=os.environ["KILN_API_KEY"], # sk-bk-...
max_tokens=800,
)
print(llm.invoke("Write a haiku about kilns.").content)
for chunk in llm.stream("And one about pottery."):
print(chunk.content, end="")What differs on Kiln
- ChatOpenAI, pointed at Kiln Keep the langchain-openai integration and change model, base_url and api_key. There is no Kiln-specific LangChain package to install, and none is planned.
- content is the answer only The model's reasoning is not part of the message content, so .content holds the answer text and nothing else. Those reasoning tokens are still billed and still counted inside max_tokens, so leave room — the example sends 800, a starting value not measured on this model — if content comes back empty with finish_reason "length", raise it.
The base URL, authentication, the request parameters every endpoint shares, the response envelope, streaming and the error codes are the same whichever SDK you use. They are documented once on the API Reference. The calls above land on Chat completions. The model ID has to be one the API is serving right now; how to list those, and what to do when an ID is not among them, is on Models. What this model does not support, whatever SDK sends it, is listed under Migrating from OpenAI.
Note
Snippets on this page were run against the Kiln API on 2026-09-21 with langchain-openai 1.6.2, langchain-core 1.6.3. Not verified: That run was on gpt-oss-120b; the page now names qwen3-32b, which it has not yet been re-run against. Chat calls and streaming were run. Agents, tool binding and with_structured_output were not exercised against Kiln.