Frameworks & Platforms
CrewAI
Use TokenLab models in CrewAI agents through OpenAI-compatible LLM settings
Overview
CrewAI supports OpenAI-compatible LLMs by setting the model, API key, and base URL on environment variables or on the LLM class.
Environment Variables
import os
os.environ["OPENAI_API_KEY"] = "sk-your-tokenlab-key"
os.environ["OPENAI_API_BASE"] = "https://api.tokenlab.sh/v1"
os.environ["OPENAI_MODEL_NAME"] = "openai/claude-sonnet-5"LLM Class
from crewai import Agent, LLM
llm = LLM(
model="claude-sonnet-5",
custom_openai=True,
base_url="https://api.tokenlab.sh/v1",
api_key="sk-your-tokenlab-key",
)
agent = Agent(
role="Research analyst",
goal="Summarize technical tradeoffs clearly",
backstory="You produce concise implementation notes.",
llm=llm,
)Model IDs change over time. Choose a current model on the Models page, then compare quality, speed, and cost on your own CrewAI tasks.
Endpoint Notes
This setup uses Chat Completions. To use Responses, Anthropic Messages, or Gemini, confirm that your CrewAI component supports that API format.