---
title: "Use Augure with LangChain (Python)"
description: "Run LangChain chains and agents on Augure's Canadian, OpenAI-compatible API with ChatOpenAI and a custom base_url."
tool: "LangChain (Python)"
category: "framework"
canonical: "https://augureai.ca/docs/integrations/langchain-python"
updated: "2026-10-26"
verified: false
---
# Use Augure with LangChain (Python)

You get Augure as the chat model behind LangChain's `ChatOpenAI` class, so chains, agents, tool binding and streaming run with inference on Canadian infrastructure.

## Prerequisites

- Python 3.9+ and `pip install langchain-openai`.
- An Augure API key (`aug_sk_live_…`) from the [developer dashboard](https://chat.augureai.ca/developers/dashboard). Plans and pricing: [augureai.ca/developers](https://augureai.ca/developers).
- The key exported as `AUGURE_API_KEY`.

## Configure

Use `ChatOpenAI` from `langchain_openai` with `base_url` set to Augure. Set `use_responses_api=False` so LangChain always sends Chat Completions requests; Augure does not expose a Responses endpoint.

```python test
import os
from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    model="tofino-3",
    api_key=os.environ["AUGURE_API_KEY"],
    base_url="https://api.augureai.ca/v1",
    max_tokens=64,
    use_responses_api=False,
)

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

`ChatOpenAI` also reads `OPENAI_API_KEY` and `OPENAI_BASE_URL` from the environment if you leave the arguments out.

Streaming, with usage reported in the last chunk (LangChain sets `stream_options.include_usage` when `stream_usage=True`):

```python
llm = ChatOpenAI(model="rosedale-1", base_url="https://api.augureai.ca/v1",
                 api_key=os.environ["AUGURE_API_KEY"], stream_usage=True)
for chunk in llm.stream("Hello"):
    print(chunk.content, end="", flush=True)
```

Tool calling uses the standard `bind_tools` path, and structured output works with `with_structured_output(Schema, method="function_calling")`, since both go through the `tools` field of the request:

```python
llm_with_tools = llm.bind_tools([search_grant_programs])
```

## Pick a model

| Model | When to use |
| --- | --- |
| `ossington-5` | Flagship reasoning. 256K context, 32,768 max output. Default for hard tasks. |
| `rosedale-1` | Premium reasoning, up to 1M context on paid plans, Canadian inference. Long documents, agent loops. |
| `tofino-3` | Fast everyday model, 256K context, 16,384 max output, no thinking. Chat, extraction, classification. |

`model="auto"` lets the gateway pick. On `ossington-5`, `reasoning_effort="none"` turns thinking off and is the fastest setting for mechanical tasks; `low`, `medium` and `high` are accepted on reasoning models; `tofino-3` ignores it. `ChatOpenAI` has a `reasoning_effort` argument; on older `langchain-openai` releases pass `extra_body={"reasoning_effort": "none"}` instead. Full list: [/docs/models](https://augureai.ca/docs/models).

## Verify it works

LangChain's `response_metadata` keeps token usage and the model name but not Augure's extra top-level fields, so check residency with one direct call:

```bash test
curl -s https://api.augureai.ca/v1/chat/completions \
  -H "Authorization: Bearer $AUGURE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"tofino-3","max_tokens":64,"messages":[{"role":"user","content":"Reply with the single word OK."}]}'
```

The JSON ends with an `_augure` block, for example `"_augure": {"gateway_region": "ca-montreal-1", "inference_region": "ca-on-toronto", "request_id": "..."}`. `inference_region` tells you where the model ran. Inference is on Canadian infrastructure first, with disclosed failover to vetted EU partners under zero data retention, never the US.

## Notes

- `message.content` holds the final answer only. When a reasoning model thinks, the reasoning text is returned by the API in `reasoning_content` and is not merged into `content`.
- For LangGraph agents, pass the same `ChatOpenAI` instance; nothing else changes.
- OpenAI model aliases are accepted: `gpt-4o` maps to `ossington-4`, `gpt-4o-mini` to `tofino-3`.
- Use `ChatOpenAI`, not `OpenAI` (the legacy completions class); Augure serves `/v1/chat/completions`.

## See also

- [API reference](https://augureai.ca/docs/api)
- [Models](https://augureai.ca/docs/models)
- [MCP server](https://augureai.ca/docs/mcp)
- [IDE setup](https://augureai.ca/docs/ide)
- [Pricing](https://augureai.ca/pricing)
