Clarifai
Anthropic, OpenAI, Qwen, xAI, Gemini and most of Open soured LLMs are Supported on Clarifai.
| Property | Details |
|---|---|
| Description | Clarifai is a powerful AI platform that provides access to a wide range of LLMs through a unified API. LiteLLM enables seamless integration with Clarifai's models using an OpenAI-compatible interface. |
| Provider Doc | Clarifai ↗ |
| OpenAI compatible Endpoint for Provider | https://api.clarifai.com/v2/ext/openai/v1 |
| Supported Endpoints | /chat/completions |
Pre-Requisites
pip install litellm
Required Environment Variables
To obtain your Clarifai Personal access token follow this link.
os.environ["CLARIFAI_PAT"] = "CLARIFAI_API_KEY" # CLARIFAI_PAT
Usage
import os
from litellm import completion
os.environ["CLARIFAI_API_KEY"] = ""
response = completion(
model="clarifai/openai.chat-completion.gpt-oss-20b",
messages=[{ "content": "Tell me a joke about physics?","role": "user"}]
)
Streaming Support
LiteLLM supports streaming responses with Clarifai models:
import litellm
for chunk in litellm.completion(
model="clarifai/openai.chat-completion.gpt-oss-20b",
api_key="CLARIFAI_API_KEY",
messages=[
{"role": "user", "content": "Tell me a fun fact about space."}
],
stream=True,
):
print(chunk.choices[0].delta)
Tool Calling (Function Calling)
Clarifai models accessed via LiteLLM support function calling:
import litellm
tools = [{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get current temperature for a given location.",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "City and country e.g. Tokyo, Japan"
}
},
"required": ["location"],
"additionalProperties": False
},
}
}
}]
response = litellm.completion(
model="clarifai/openai.chat-completion.gpt-oss-20b",
api_key="CLARIFAI_API_KEY",
messages=[{"role": "user", "content": "What is the weather in Paris today?"}],
tools=tools,
)
print(response.choices[0].message.tool_calls)
Clarifai models
liteLLM supports all models on Clarifai community
🧠 OpenAI Models
- gpt-oss-20b
- gpt-oss-120b
- gpt-5-nano
- gpt-5-mini
- gpt-5
- gpt-4o
- o3
- Many more...
🤖 Anthropic Models
- claude-sonnet-4
- claude-opus-4
- claude-3_5-haiku
- claude-3_7-sonnet
- Many more...
🪄 xAI Models
- grok-3
- grok-2-vision-1212
- grok-2-1212
- grok-code-fast-1
- grok-2-image-1212
- Many more...
🔷 Google Gemini Models
🧩 Qwen Models
- Qwen3-30B-A3B-Instruct-2507
- Qwen3-30B-A3B-Thinking-2507
- Qwen3-14B
- QwQ-32B-AWQ
- Qwen2_5-VL-7B-Instruct
- Qwen3-Coder-30B-A3B-Instruct
- Many more...
💡 MiniCPM (OpenBMB) Models
- MiniCPM-o-2_6-language
- MiniCPM3-4B
- MiniCPM4-8B
- Many more...
🧬 Microsoft Phi Models
- Phi-4-reasoning-plus
- phi-4
- Many more...