Skip to main content
Workers AI allows you to run machine learning models, on the Cloudflare network, from your own code. This will help you getting started with ChatCloudflareWorkersAI chat models. For detailed documentation of all ChatCloudflareWorkersAI features and configurations head to the API reference.

Overview

Integration details

ClassPackageSerializablePY supportDownloadsVersion
ChatCloudflareWorkersAI@langchain/cloudflareNPM - DownloadsNPM - Version

Model features

See the links in the table headers below for guides on how to use specific features.

Setup

To access Cloudflare Workers AI models you’ll need to create a Cloudflare account, get an API key, and install the @langchain/cloudflare integration package.

Credentials

Head to Cloudflare Workers AI to sign up to Cloudflare and generate an API key. Once you’ve done this, set your credentials in the environment:
Passing a binding within a Cloudflare Worker is not yet supported.

Installation

The LangChain ChatCloudflareWorkersAI integration lives in the @langchain/cloudflare package:

Instantiation

Now we can instantiate our model object and generate chat completions:

Invocation


API reference

For detailed documentation of all ChatCloudflareWorkersAI features and configurations head to the API reference.