Skip to main content

AI21

LiteLLM supports j2-light, j2-mid and j2-ultra from AI21.

They're available to use without a waitlist.

API KEYS

import os 
os.environ["AI21_API_KEY"] = "your-api-key"

Sample Usage

from litellm import completion 

# set env variable
os.environ["AI21_API_KEY"] = "your-api-key"

messages = [{"role": "user", "content": "Write me a poem about the blue sky"}]

completion(model="j2-light", messages=messages)

AI21 Models

Model NameFunction CallRequired OS Variables
j2-lightcompletion('j2-light', messages)os.environ['AI21_API_KEY']
j2-midcompletion('j2-mid', messages)os.environ['AI21_API_KEY']
j2-ultracompletion('j2-ultra', messages)os.environ['AI21_API_KEY']