> ## Documentation Index
> Fetch the complete documentation index at: https://docs.scitix.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# LangChain

> Learn how to use LangChain with ScitiX Model Inference by configuring ChatOpenAI with a custom base URL and model ID.

[LangChain](https://github.com/langchain-ai/langchain) is the most widely used LLM application framework. Its `langchain-openai` integration accepts a custom `base_url`, so `ChatOpenAI` can run on the ScitiX Model Inference API.

Default model here is `glm-5.2`; see the [Models](https://console.scitix.ai/model-inference/models) page for the full list and pricing.

## Configure

Create an API key on the ScitiX [API Keys](https://console.scitix.ai/model-inference/api_keys) page and export it:

```bash theme={null}
export SCITIX_API_KEY="<Your API Key>"
```

Point `ChatOpenAI` from `langchain-openai` at the ScitiX endpoint:

```python theme={null}
import os
from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    model="glm-5.2",
    base_url="https://api.scitix.ai/model-api/v1",
    api_key=os.environ["SCITIX_API_KEY"],
)
```

| Field      | Description                                                                                                     |
| ---------- | --------------------------------------------------------------------------------------------------------------- |
| `model`    | ScitiX model ID, e.g. `glm-5.2`                                                                                 |
| `base_url` | ScitiX OpenAI-compatible endpoint: `https://api.scitix.ai/model-api/v1`. LangChain appends `/chat/completions`. |
| `api_key`  | Your ScitiX API key, read from the environment                                                                  |

Use `ChatOpenAI` from `langchain-openai`, not the legacy `OpenAI` completion class.

Choose a model with native tool calling for LangChain tool/agent features, such as `bind_tools`.

## Verify

Invoke the model — a normal reply confirms the connection (verified on **langchain-openai 1.4.3**):

```python theme={null}
print(llm.invoke("In one short sentence, which model are you?").content)
# → I am a GLM large language model developed by Z.ai.
```
