AI21 Labs
Jamba, the hybrid Mamba-Transformer that stays cheap on very long documents.
AI21 Labs is the Israeli lab behind Jamba, a hybrid Mamba-Transformer that stays cheap on long documents because it does not pay full Transformer cost on every token. 256K of context. New accounts get $10 of credits for three months.
Two models we track, OpenAI-compatible, no card to start. The old /studio/v1/models listing now returns 410 — pick the current Jamba id from the console. Use it when the document is the point, not when you want a general chat model.
- Free models
- 2
- Max context
- 256K
- Free tier
- $10 of credits for 3 months
- Requirement
- Email account, no card
Endpoint
Base URL
https://api.ai21.com/studio/v1Env var
AI21_API_KEYRate limit
$10 of credits for 3 months- OpenAI-compatible
- Native SDK: AI21 SDK
- text
Code examples
npm install openaiimport OpenAI from 'openai'
const client = new OpenAI({
baseURL: 'https://api.ai21.com/studio/v1',
apiKey: process.env.AI21_API_KEY
})
const response = await client.chat.completions.create({
model: 'jamba-mini-2',
messages: [{ role: 'user', content: 'Explain closures in one paragraph.' }]
})
console.log(response.choices[0].message.content)pip install openaiimport os
from openai import OpenAI
client = OpenAI(
base_url="https://api.ai21.com/studio/v1",
api_key=os.environ["AI21_API_KEY"],
)
response = client.chat.completions.create(
model="jamba-mini-2",
messages=[{"role": "user", "content": "Explain closures in one paragraph."}],
)
print(response.choices[0].message.content)curl https://api.ai21.com/studio/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $AI21_API_KEY" \
-d '{
"model": "jamba-mini-2",
"messages": [{"role": "user", "content": "Explain closures in one paragraph."}]
}'pip install ai21import os
from ai21 import AI21Client
from ai21.models.chat import ChatMessage
client = AI21Client(api_key=os.environ["AI21_API_KEY"])
response = client.chat.completions.create(
model="jamba-mini-2",
messages=[ChatMessage(role="user", content="Explain closures in one paragraph.")],
)
print(response.choices[0].message.content)Worth knowing
- The /studio/v1/models listing now returns 410. Use the current Jamba ids from the console.
Models you get for free2
- Jamba Mini 2
jamba-mini-2 - Jamba Large 1.6
jamba-large-1.6