LangChain with Heabsy: ChatHeabsy from langchain-heabsy
Install langchain-heabsy and use ChatHeabsy: it is LangChain's ChatOpenAI with the Heabsy base URL built in, the key read from HEABSY_API_KEY, token usage on streams switched on, and the model's reasoning text kept in additional_kwargs["reasoning_content"] on non-streaming calls. ChatHeabsy is listed among LangChain's chat model integrations; plain ChatOpenAI with a base_url works as well and is shown below.
# pip install langchain-heabsy
# export HEABSY_API_KEY="<your key>"
from langchain_heabsy import ChatHeabsy
llm = ChatHeabsy(model="qwen38")
reply = llm.invoke("Say hello from Heabsy in five words.")
print(reply.content, reply.usage_metadata)LangChain chat model integrations · langchain-heabsy on PyPI
https://api.heabsy.com/v1 · Anthropic base URL https://api.heabsy.comWhat ChatHeabsy sets for you
- Base URL
https://api.heabsy.com/v1— nothing to configure. - The key from the
HEABSY_API_KEYenvironment variable, or passheabsy_api_key="…". stream_usage=True: streamed responses end with token counts inusage_metadata.- Reasoning text from models that think before answering is kept in
reply.additional_kwargs["reasoning_content"]on non-streaming calls;ChatOpenAIdrops it. - Everything else is
ChatOpenAI:temperature,max_tokens,bind_tools,with_structured_output, async and batch calls work unchanged. The only dependency islangchain-openai.
Tools, agents and LangGraph
llm.bind_tools([...]) and agents built on ChatHeabsy work with models that support tool calling — every model in the table does. LangGraph nodes use the same chat model object, so configure it once.
Alternative: ChatOpenAI with a base_url
Without the package, point ChatOpenAI from langchain-openai at Heabsy. Set stream_usage=True yourself — LangChain leaves it off for custom base URLs — and note that reasoning fields are not extracted. Setting OPENAI_BASE_URL=https://api.heabsy.com/v1 and OPENAI_API_KEY also moves existing code over, but affects every OpenAI client in the process.
# pip install langchain-openai
import os
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(
model="qwen38",
base_url="https://api.heabsy.com/v1",
api_key=os.environ["HEABSY_API_KEY"],
stream_usage=True,
)Which model should I pick?
Our own models run in the EEA, all except DeepSeek V4.1 Flash Uncensored, and store no prompts, which matters when a chain feeds customer documents to the model. For extraction and classification steps the cheapest model in the table is often enough; for agents, pick qwen38 or mimo-v26-flash.
| Model | ID | Context | Max output | Runs | Input / 1M | Output / 1M |
|---|---|---|---|---|---|---|
| Qwen3.8 27B Fable | qwen38-fable | 512K | 32K | EEA | $0.10 | $0.61 |
| Qwen3.8 27B Queen | qwen38-queen | 512K | 32K | EEA | $0.10 | $0.61 |
| GLM 5.3 Flash Uncensored | glm53-flash-unc | 1M | 128K | EEA | $0.20 | $0.8001 |
| Qwen3.8 27B Obliterated | qwen38-obl | 512K | 32K | EEA | $0.21 | $1.47 |
| DeepSeek V4.1 Flash 1017 Uncensored | deepseek-v4.1-flash-1017-unc | 1M | 64K | outside EEA | $0.40 | $1.40 |
| DeepSeek V4.1 Flash Uncensored | deepseek-v4.1-flash-unc | 1M | 64K | outside EEA | $0.40 | $1.40 |
| MiMo V2.6 Flash Uncensored | mimo-v26-flash-unc | 1M | 64K | EEA | $0.4624 | $1.4999 |
| Qwen3.8 27B Uncensored | qwen38-unc | 512K | 230K | EEA | $0.4887 | $2.17 |
| MiMo V2.6 Flash | mimo-v26-flash | 1M | 64K | EEA | $0.50 | $1.50 |
| MiMo V2.6 Flash Abliterated | mimo-v26-flash-abl | 1M | 64K | EEA | $0.50 | $1.50 |
| Qwen3.8 27B Uncensored Fast by Heabsy | qwen38-unc-fast | 512K | 230K | EEA | $0.8299 | $2.62 |
| Qwen3.8 27B | qwen38 | 512K | 32K | EEA | $1.05 | $3.15 |
| CyberHeabsy | cyberheabsy | 1M | 64K | EEA | $1.50 | $4.50 |
All models above run on Heabsy hardware in the EEA, except DeepSeek V4.1 Flash Uncensored; prompts and completions are not stored. Thecatalog also lists 24 partner-hosted models — Claude, GPT-6, Kimi K3, DeepSeek V4 and others — with the same key and invoice, but without zero data retention and without an EEA guarantee.
Verify it works
Run the snippet: it prints the reply and usage_metadata with input and output token counts. With ChatOpenAI, empty usage while streaming means stream_usage is still off.
If the tool shows an error you cannot read, test the key on its own first — one short request outside the tool:
curl https://api.heabsy.com/v1/chat/completions \
-H "Authorization: Bearer $HEABSY_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"qwen38","max_tokens":16,"messages":[{"role":"user","content":"Say hi"}]}'Troubleshooting
| What you see | What to change |
|---|---|
ModuleNotFoundError: No module named 'langchain_heabsy' | Install the package into the same environment that runs your code: pip install langchain-heabsy. |
usage_metadata is empty when streaming | ChatHeabsy turns it on; with ChatOpenAI, set stream_usage=True. |
No reasoning_content in additional_kwargs | It is kept on non-streaming calls with ChatHeabsy, for models that reason. Streamed calls and ChatOpenAI do not carry it. |
| 404 on every call | With ChatOpenAI, base_url must be https://api.heabsy.com/v1. Do not turn on use_responses_api — Heabsy serves Chat Completions, not the Responses API. |
| Model not found | Use the exact catalog ID; GET /v1/models lists the IDs your key may call. |
| 403 with an HTML page ("Sorry, you have been blocked") | No key was sent at all: the key variable is empty or not set where the tool runs. Requests without a key are stopped before they reach the API; a wrong key gets a JSON 401 instead. |
Where do my prompts go?
From LangChain straight to api.heabsy.com. On our own models the request is processed in the European Economic Area, except DeepSeek V4.1 Flash Uncensored and the text is not stored — we keep what billing needs: the model, the token counts and the time. Partner-hosted models are processed by third-party inference providers; each is marked in the catalog, and none of them carries the no-retention promise. The terms are in the data processing agreement, the invoice comes from an EU company.
FAQ
Is langchain-heabsy an official LangChain integration?+
ChatHeabsy is listed in LangChain's table of chat model integrations and is maintained by Heabsy, not by LangChain. It is a thin wrapper around ChatOpenAI, so LangChain's own documentation for ChatOpenAI applies to it.
Does LangGraph work with Heabsy?+
Yes. LangGraph nodes call the same ChatHeabsy or ChatOpenAI object; configure it once as above.
Can I use embeddings from Heabsy?+
No. Heabsy serves chat and reasoning models; keep your current embedding model for retrieval and use Heabsy for generation.
Is customer data processed in the EU?+
With our own models, yes — all except DeepSeek V4.1 Flash Uncensored: processing in the EEA, no stored prompts, invoice from an EU company. Partner-hosted models are marked in the catalog and carry no such promise.
Also set up:Vercel AI SDK · n8n · Open WebUI
LangChain is a trademark of LangChain, Inc.; Heabsy is not affiliated with or endorsed by LangChain. langchain-heabsy is maintained by Heabsy.