Overview
Integration details
| Class | Package | Local | Serializable | JS support | Downloads | Version |
|---|---|---|---|---|---|---|
| ChatCloudflareWorkersAI | langchain-cloudflare | ✅ | ❌ | ❌ |
Model features
| Tool calling | Structured output | JSON mode | Image input | Audio input | Video input | Token-level streaming | Native async | Token usage | Logprobs |
|---|---|---|---|---|---|---|---|---|---|
| ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | ❌ | ❌ | ✅ | ❌ |
Setup
To access CloudflareWorkersAI models you’ll need to create a/an CloudflareWorkersAI account, get an API key, and install thelangchain-cloudflare integration package.
Credentials
Head to www.cloudflare.com/developer-platform/products/workers-ai/ to sign up to CloudflareWorkersAI and generate an API key. Once you’ve done this set the CF_AI_API_KEY environment variable and the CF_ACCOUNT_ID environment variable:Installation
The LangChain CloudflareWorkersAI integration lives in thelangchain-cloudflare package:
Instantiation
Now we can instantiate our model object and generate chat completions:- Update model instantiation with relevant params.
Invocation
Structured Outputs
Bind tools
API reference
developers.cloudflare.com/workers-ai/ developers.cloudflare.com/agents/Connect these docs programmatically to Claude, VSCode, and more via MCP for real-time answers.