Skip to main content

CrewAI

1.1 Usage

from crewai import Agent, LLM

llm = LLM(
model="minimax/minimax-m2.5",
api_key="your-hpc-ai-api-key",
base_url="https://api.hpc-ai.com/inference/v1",
temperature=0.7,
max_tokens=4000
)

agent = Agent(
role='AI Expert',
goal='Provide assistance',
backstory="An AI assistant using custom LLM.",
llm=llm
)

Method 2: Environment Variables

import os

os.environ["OPENAI_API_KEY"] = "your-hpc-ai-api-key"
os.environ["OPENAI_API_BASE"] = "https://api.hpc-ai.com/inference/v1"
os.environ["OPENAI_MODEL_NAME"] = "minimax/minimax-m2.5"

from crewai import Agent

# Use default LLM configuration
agent = Agent(
role='AI Expert',
goal='Provide assistance',
backstory="An AI assistant."
)

Method 3: Portkey Integration

See official documentation

1.2 Multiple Agents with Different LLMs

from crewai import Agent, LLM, Task, Crew

# First LLM
llm1 = LLM(
model="minimax/minimax-m2.5",
api_key="key-1",
base_url="https://api.hpc-ai.com/inference/v1"
)

# Second LLM
llm2 = LLM(
model="minimax/minimax-m2.5",
api_key="key-2",
base_url="https://api.hpc-ai.com/inference/v1"
)

# Create agents with different LLMs
agent1 = Agent(role='Expert 1', goal='Task 1', llm=llm1)
agent2 = Agent(role='Expert 2', goal='Task 2', llm=llm2)

1.3 References