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

# LangChain and LangGraph

> The OpenAI chat model, pointed at Nito.

```python lines wrap theme={"theme":{"light":"github-light","dark":"github-dark"}}
from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    model="moonshotai/kimi-k3",                          # a Nito catalog ID, fetch from GET /v1/models
    api_key="z_sk_your_key_here",              # your Nito API key
    base_url="https://app.trynito.ai/v1",  # Nito's OpenAI-compatible base URL
)

result = llm.invoke("Say hello in one short sentence.")
print(result.content)
```

The same `llm` binds tools (`llm.bind_tools([...])`) and drives an agent unchanged:

```python wrap theme={"theme":{"light":"github-light","dark":"github-dark"}}
from langchain.agents import create_agent
agent = create_agent(model=llm, tools=[...])
```

`create_agent` returns a compiled LangGraph graph. `langgraph.prebuilt.create_react_agent` is deprecated since LangGraph 1.0 and points at the same function.

Pass `stream_usage=True` to get token usage in streamed chunks (`full.usage_metadata` after summing the chunks).

```python theme={"theme":{"light":"github-light","dark":"github-dark"}}
model="z-ai/glm-5.2:confidential"
```

## Privacy

Use a catalog ID, not an OpenAI name. For attested hardware use a `:confidential` variant; `GET /v1/models` lists their `:confidential` IDs. Encrypted needs client-side encryption and extra headers, which these frameworks do not add. See [Privacy Levels](/privacy/levels).

## Related

<CardGroup cols={3}>
  <Card title="Framework Integrations" icon="link" href="/api/sdks/framework-integrations">
    The shared pattern.
  </Card>

  <Card title="OpenAI Compatibility" icon="arrows-left-right" href="/api/sdks/openai-drop-in/compatibility-notes">
    What differs.
  </Card>

  <Card title="Privacy Levels" icon="file-shield" href="/privacy/levels">
    The four levels.
  </Card>
</CardGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.