> ## Documentation Index
> Fetch the complete documentation index at: https://docs.auriko.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# CrewAI

> Use CrewAI with Auriko's routing and cost optimization

Use Auriko as your LLM provider in CrewAI for cost-effective multi-agent workflows.

This integration is Python-only. For TypeScript, use the [Vercel AI SDK](/frameworks/vercel-ai-sdk) integration.

## Prerequisites

* An [Auriko API key](https://auriko.ai/signup?redirectTo=%2Fdashboard%3Ftab%3Dapi-keys)

## Install

```bash theme={null}
pip install "auriko[crewai]"
```

## Use SDK adapter

Use the `AurikoCrewAILLM` adapter:

```python theme={null}
from auriko.frameworks.crewai import AurikoCrewAILLM

auriko_llm = AurikoCrewAILLM(model="gpt-5.4")
```

`AurikoCrewAILLM` routes models through Auriko's OpenAI-compatible endpoint. It passes `provider="openai"` to CrewAI, which prevents CrewAI from routing to native provider SDKs.

```python theme={null}
from crewai import Agent, Task, Crew

researcher = Agent(
    role="Researcher",
    goal="Find accurate and comprehensive information",
    backstory="You are an expert researcher with attention to detail.",
    llm=auriko_llm.llm,
    verbose=True,
)

writer = Agent(
    role="Writer",
    goal="Write clear, engaging content based on research",
    backstory="You are a skilled technical writer.",
    llm=auriko_llm.llm,
    verbose=True,
)

research_task = Task(
    description="Research the latest trends in AI agents",
    agent=researcher,
    expected_output="A detailed summary of AI agent trends with sources",
)

writing_task = Task(
    description="Write a blog post based on the research findings",
    agent=writer,
    expected_output="A 500-word blog post about AI agent trends",
    context=[research_task],
)

crew = Crew(
    agents=[researcher, writer],
    tasks=[research_task, writing_task],
    verbose=True,
)

result = crew.kickoff()
print(result)
```

<Note>
  Pass `auriko_llm.llm` to `Agent`, not the `AurikoCrewAILLM` instance.
</Note>

## Configure options

| Parameter          | Type                       | Default                      | Description                                                                  |
| ------------------ | -------------------------- | ---------------------------- | ---------------------------------------------------------------------------- |
| `model`            | `str`                      | (required)                   | Model ID (e.g., `"gpt-5.4"`, `"claude-sonnet-4-20250514"`)                   |
| `api_key`          | `str \| None`              | `AURIKO_API_KEY` env         | API key                                                                      |
| `routing`          | `RoutingOptions \| None`   | `None`                       | Routing configuration                                                        |
| `base_url`         | `str`                      | `"https://api.auriko.ai/v1"` | API base URL                                                                 |
| `reasoning_effort` | `str \| None`              | `None`                       | Reasoning effort: `"low"`, `"medium"`, `"high"`, `"xhigh"`, `"max"`, `"off"` |
| `stop`             | `str \| list[str] \| None` | `None`                       | Stop sequences                                                               |
| `**kwargs`         |                            |                              | Passed through to `crewai.LLM`                                               |

## Configure routing

Pass a `RoutingOptions` instance to control routing:

```python theme={null}
from auriko.frameworks.crewai import AurikoCrewAILLM
from auriko.route_types import RoutingOptions

auriko_llm = AurikoCrewAILLM(
    model="gpt-5.4",
    routing=RoutingOptions(optimize="cost"),
)

metadata = auriko_llm.last_routing_metadata
if metadata:
    print(f"Provider: {metadata.provider}")
```

`last_routing_metadata` returns metadata from the most recent non-streaming response.

Different agents can use different models and routing strategies:

```python theme={null}
fast_llm = AurikoCrewAILLM(model="gpt-4o", routing=RoutingOptions(optimize="ttft-focus"))
smart_llm = AurikoCrewAILLM(model="gpt-5.4", routing=RoutingOptions(optimize="balanced"))

researcher = Agent(role="Researcher", goal="Find information", backstory="Expert", llm=smart_llm.llm)
writer = Agent(role="Writer", goal="Write content", backstory="Skilled writer", llm=fast_llm.llm)
```

## Configure manually

<Accordion title="Alternative: configure CrewAI manually">
  If you prefer to use CrewAI's `LLM` class directly, pass `provider="openai"` to route models through Auriko:

  ```python theme={null}
  import os
  from crewai import LLM

  llm = LLM(
      model="gpt-5.4",
      provider="openai",  # routes models through Auriko
      base_url="https://api.auriko.ai/v1",
      api_key=os.environ["AURIKO_API_KEY"],
  )
  ```

  For routing options and metadata access, use `AurikoCrewAILLM`.
</Accordion>
