Integration details
| Class | Package | Serializable | JS support | Downloads | Version |
|---|---|---|---|---|---|
ChatAI21 | langchain-ai21 | beta | ✅ |
Model features
| Tool calling | Structured output | Image input | Audio input | Video input | Token-level streaming | Native async | Token usage | Logprobs |
|---|---|---|---|---|---|---|---|---|
| ✅ | ✅ | ❌ | ❌ | ❌ | ✅ | ✅ | ✅ | ❌ |
Setup
Credentials
We’ll need to get an AI21 API key and set theAI21_API_KEY environment variable:
Installation
!pip install -qU langchain-ai21Instantiation
Now we can instantiate our model object and generate chat completions:Invocation
Tool calls / function calling
This example shows how to use tool calling with AI21 models:Connect these docs to Claude, VSCode, and more via MCP for real-time answers.

