Skip to main content
Use LangChain against the Modellix LLM gateway through the OpenAI-compatible Chat Completions API. Configure ChatOpenAI from langchain-openai with base_url set to https://llm.modellix.ai/v1 — the same pattern as the OpenAI SDK.
This page covers LLM chat only (https://llm.modellix.ai). Modellix model IDs are provider/name (for example openai/gpt-5.5). Pass that full string as model. See Models & Pricing.The LLM gateway does not document an embeddings API. For RAG, use Modellix for generation and a separate embeddings provider, or keep embeddings on another OpenAI-compatible host.

Set Up LangChain

1

Install Packages

Python (recommended imports from langchain-openai):
TypeScript:
2

Set Credentials

Create a Modellix API key in the console, then export:
Missing /v1 on the base URL commonly causes 404s. Do not point LangChain at the media host (https://api.modellix.ai).
3

Create ChatOpenAI

Prefer constructor args so the base URL is explicit in code. Environment variables work as a fallback when you omit api_key / base_url.
You can use the same base_url with other Modellix catalog IDs (for example anthropic/claude-sonnet-5 or google/gemini-3.6-flash); traffic still goes through Chat Completions on https://llm.modellix.ai/v1.
4

Optional: Streaming and Fallbacks

Streaming:
Multi-model fallback on the same gateway:
5

Optional: ChatAnthropic (Messages)

For native Anthropic Messages instead of Chat Completions, use langchain-anthropic with the same host shape as the Anthropic SDK (no /v1 on the base URL):
Most LangChain apps should stay on ChatOpenAI + /v1 unless you specifically need the Messages protocol.

Troubleshooting