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

# LangChain.js

> Use LangChain.js with the Halesis API.

```bash npm theme={null}
npm install @langchain/openai @langchain/core
```

```bash yarn theme={null}
yarn add @langchain/openai @langchain/core
```

```bash pnpm theme={null}
pnpm add @langchain/openai @langchain/core
```

```bash bun theme={null}
bun add @langchain/openai @langchain/core
```

```typescript theme={null}
import { ChatOpenAI } from "@langchain/openai";

const model = new ChatOpenAI({
  model: "b1-fast",
  apiKey: process.env.HALESIS_API_KEY,
  configuration: {
    baseURL: "https://api.halesis.com/v1",
  },
});

const response = await model.invoke("Hello!");

console.log(response.content);
```

See the [Chat Completions API reference](https://docs.halesis.com/api-reference/chat/create-a-chat-completion.md) for supported parameters.

Set up using a coding agent

Configure this project's LangChain.js OpenAI-compatible chat model to call the Halesis API.

Inspect the codebase and follow its existing LangChain version and configuration patterns. Set `ChatOpenAI` to use base URL `https://api.halesis.com/v1`, read the API key from the server-side `HALESIS_API_KEY` environment variable, and use the Halesis model `b1-fast`.

Keep the API key out of browser code, use Chat Completions-compatible features, and do not invent a Halesis-specific SDK. Make the smallest necessary changes and run relevant checks.


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