Source: https://ailoot.ai/docs/en/integrations/langchain/
Canonical: https://ailoot.ai/docs/en/integrations/langchain/
Language: en

[SDKs and frameworks](https://ailoot.ai/docs/en/integrations/#sdk) 

# LangChain

[Markdown](https://ailoot.ai/docs/en/integrations/langchain/index.md)

Framework · OpenAI Chat, OpenAI Responses, Anthropic Messages

| Format | Where to set it up |
| --- | --- |
| OpenAI Chat, OpenAI Responses, Anthropic Messages | ChatOpenAI(base\_url=...) or the OPENAI\_API\_BASE / OPENAI\_BASE\_URL environment variables; ChatAnthropic(base\_url=...) or ANTHROPIC\_API\_URL / ANTHROPIC\_BASE\_URL |

## [](https://ailoot.ai/docs/en/integrations/langchain/#setup)Setup

Copy the configuration and replace `sk-...` with your key from the Ailoot Dashboard. Prefer storing the key in the environment variable `AILOOT_API_KEY`, if the application supports it.

Before starting, request GET /v1/models with your Ailoot key. Choose an exact model ID whose methods include POST /v1/chat/completions, POST /v1/responses, POST /v1/messages, then use that ID in the configuration. For agents, also check tool support and the features required by your client version.

```python
import os
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(model="gpt-6.1-sol", base_url="https://api.ailoot.ai/v1", api_key=os.environ["AILOOT_API_KEY"])
print(llm.invoke("Hello").content)

from langchain_anthropic import ChatAnthropic
claude = ChatAnthropic(model="claude-sonnet-5-5", base_url="https://api.ailoot.ai", api_key=os.environ["AILOOT_API_KEY"])
```

Example model: `gpt-6.1-sol, qwen3.8-max (ChatOpenAI); claude-sonnet-5-5 (ChatAnthropic)`. Choose any other model from the [catalog](https://ailoot.ai/models/en/) — check that it supports the format you need.

## [](https://ailoot.ai/docs/en/integrations/langchain/#notes)Good to know

ChatOpenAI: use a URL with /v1. According to the documentation, ChatOpenAI supports only the official OpenAI specification: nonstandard fields such as reasoning\_content from third-party models are not retained. For Claude, prefer ChatAnthropic: use a URL without /v1, as the SDK adds /v1/messages automatically. ChatAnthropic's base\_url parameter and ANTHROPIC\_API\_URL/ANTHROPIC\_BASE\_URL environment variables are documented in the class documentation in the source code (langchain\_anthropic/chat\_models.py), but not on the integration page. The use\_responses\_api flag enables Responses mode in ChatOpenAI.

## [](https://ailoot.ai/docs/en/integrations/langchain/#check)Test

- For the OpenAI format, the URL is `https://api.ailoot.ai/v1` (or the full path if the application asks for a full URL).
- For the Anthropic format, the URL is `https://api.ailoot.ai` without `/v1`.
- Ask a short question. If you get an error, check the code and Request ID, then consult [Errors and limits](https://ailoot.ai/docs/en/errors/).
- 404 immediately after setup almost always means the URL is wrong: an extra or missing `/v1`.
- 402 — insufficient balance for the reserve. Agents reserve more than chat: [why](https://ailoot.ai/docs/en/billing/reserve/).

Application documentation: [https://docs.langchain.com/oss/python/integrations/chat/openai](https://docs.langchain.com/oss/python/integrations/chat/openai)

Still have questions? Send your Request ID and a description — we'll help you troubleshoot.[Contact support](mailto:support@ailoot.ai)

## Ailoot · The company and its project portfolio





Ailoot combines established operating experience, a large client base, stable service and ongoing KPI control.





The company and its project portfolio: millions of customers; monthly sales in the billions.





Ailoot brings that operating experience to API access for AI features in customer products, agents, applications and automations.
