skillfed

ai21

ai21 v4.3.0 192.1K downloads/30d#9,871 on PyPI
License unclear AGING released

What it is and what it does

The ai21 package is a Python client library for AI21 Labs' language models, primarily Jamba. It abstracts the REST API calls needed to interact with these models, offering both synchronous and asynchronous interfaces. The package handles authentication, request formatting, and response parsing, so you can focus on building applications rather than managing HTTP details.

It supports multiple use patterns: chat completions (conversation-style interactions), text completion (prompt-based generation), streaming responses (for real-time output), and higher-level orchestration via Maestro (planning and requirements management) and Agents (beta, for autonomous task execution). The library also includes experimental Conversational RAG for retrieval-augmented generation over your own documents. Dependencies are minimal and well-established (httpx for HTTP, pydantic for validation, tenacity for retry logic), keeping the install lightweight.

Use it for:

  • Build a chatbot or conversational AI application using Jamba models with the chat completions API.
  • Stream long-form text generation responses in real time to a user interface.
  • Orchestrate multi-step AI workflows with requirements and quality checks using Maestro.
  • Create autonomous agents that can plan and execute tasks with the Agents API (beta).
  • Implement retrieval-augmented generation over custom documents with Conversational RAG (beta).

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Python SDK for accessing AI21 Labs' language models (including Jamba) via REST API, with support for chat completions, text completion, streaming, and agent orchestration.

Yes, if you are actively using AI21 Labs' models and need a Python interface. The package has low install friction and covers the main API patterns (chat, completion, streaming, agents). However, verify the license terms first, and be aware that the package is aging (last release 281 days ago) with no visible recent maintenance activity—suitable for stable use but not for projects requiring active development or frequent updates.

Install

ai21 on PyPI

pip

pip install ai21

uv

uv add ai21

poetry

poetry add ai21

Installing ai21

Before you install

Low install friction with four lightweight runtime dependencies (httpx, pydantic, tenacity, typing-extensions). Package is aging—last release was 281 days ago—so maintenance activity is limited; no recent commits or repository details available to assess active development.

License in practice

License status is unclear; no SPDX identifier or raw license text is available in the package metadata. Verify the actual license terms before adopting in a commercial or restricted-license project.

Quickstart

pip install ai21

from ai21 import AI21Client
from ai21.models.chat import ChatMessage

client = AI21Client(api_key='my_api_key')
messages = [ChatMessage(content="Hello", role="user")]
response = client.chat.completions.create(
    messages=messages,
    model="jamba-mini"
)

Requires a valid AI21 Labs API key, typically provided via the AI21_API_KEY environment variable or passed explicitly to the client.

Verify before relying

  • Whether the package is actively maintained or in maintenance-only mode (no recent commit history available).
  • Exact license terms and any restrictions on commercial use or redistribution.
  • Current status and stability of beta features (Agents, Conversational RAG, Maestro).

Package facts

License not declared (unclear)
Python support supports the current Python release (<4.0,>=3.8)
Install friction low — pure-Python wheel
Runtime dependencies 4 — httpx, pydantic, tenacity, typing-extensions
Maintenance aging — 281 days since the last release
First released
Downloads 192,059/month — #9,871 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: ai21-4.3.0-py3-none-any.whl

Programming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9

Tags

AI21 Labs API clientJamba language model SDKchat completions PythonLLM API wrapperAI orchestration frameworkstreaming language modelagent management SDK
llm-clientapi-wrapperasync-support

More Artificial Intelligence packages