Downsizing logodownsizing
Documentation

Using Downsizing with CrewAI

Point CrewAI's LLMclient at Downsizing to route your crews' its model calls through Downsizing.


Prerequisites

Find your Inference ID and API key on the Inference API page. You'll use them in the CrewAI configuration below.

Manual Setup

CrewAI's LLM class is built on LiteLLM. Use the anthropic/ model prefix together with base_url to route requests through Downsizing over the native Anthropic Messages API:

python
from crewai import LLM

llm = LLM(
    model="anthropic/claude-opus-4-8",
    base_url="http://localhost:3001/YOUR_INFERENCE_ID/anthropic",
    api_key="dws_YOUR_API_KEY",
    max_tokens=4096,  # required by Anthropic models
)

Find your Inference ID and API key in the Inference API page. Replace YOUR_INFERENCE_ID with the workspace UUID and dws_YOUR_API_KEY with your Downsizing API key. Pass the resulting llm instance to any Agent in your crew.

Verify

Run a simple crew to confirm traffic is routing through Downsizing:

python
from crewai import Agent, Task, Crew

agent = Agent(
    role="Assistant",
    goal="Say hello",
    backstory="A helpful assistant.",
    llm=llm,
)
task = Task(description="Say hello", expected_output="A greeting", agent=agent)
Crew(agents=[agent], tasks=[task]).kickoff()

If the crew completes and returns a response, Downsizing is set up correctly. You can also check your savings dashboard to see the request appear in your usage metrics.


Spot an error or something not working? Tell us on Discord or email docs@downsizing.dev.