AI21 offers Python and TypeScript libraries that simplify the process of using our LLMs’ API.
AsyncAI21Client
to make asynchronous requests.
There is no difference between the sync and the async client in terms of usage.
count_tokens
method, you can estimate the billing for a given request.
jamba-tokenizer
j2-tokenizer
logging
module.
To enable logging, set the AI21_LOG_LEVEL
environment variable.
AI21_API_KEY
- Your API key. If not set, you must pass it to the client constructor.AI21_API_VERSION
- The API version. Defaults to v1
.AI21_API_HOST
- The API host. Defaults to https://api.ai21.com/studio/v1/
.AI21_TIMEOUT_SEC
- The timeout for API requests.AI21_NUM_RETRIES
- The maximum number of retries for API requests. Defaults to 3
retries.AI21_AWS_REGION
- The AWS region to use for AWS clients. Defaults to us-east-1
.boto3 >= 1.28.82
.
AI21AzureClient
and AsyncAI21AzureClient
clients.
The following models are supported on Azure:
jamba-large
AI21VertexClient
and AsyncAI21VertexClient
clients.
The following models are supported on Vertex:
jamba-1.5-mini
jamba-1.5-large