# CrewAI

> Use Inferit as the model of CrewAI agents: an LLM with Inferit’s base URL and API key, with model auto or a named model. Testnet: test ITC, no monetary value.

CrewAI's LLM class takes a base URL and a key, so each agent in a crew can run on Inferit.

## 1. Get an API key

Create a key in the [Buy workspace](https://inferit.app/buy) ([Quickstart](https://inferit.cc/docs/quickstart.md), steps 1 to 6) and export it. The key spends your prepaid balance: test ITC on the testnet, a test token with no monetary value.

```bash
export INFERIT_API_KEY='ik_...'
```

The base URL is `https://api-production-c74b9.up.railway.app/v1`. Any OpenAI-compatible client works with it (chat completions, streaming included).

## 2. Give your agents an Inferit LLM

Prefix the Inferit model id with `openai/`, so CrewAI uses its OpenAI-compatible client, and pass Inferit's base URL and your key. Agents that share one `LLM` share its model; give an agent its own `LLM` to send it to another model.

_crew.py_

```python
# pip install crewai
import os
from crewai import LLM, Agent, Crew, Task

llm = LLM(
    model="openai/qwen/qwen-2.5-14b-instruct",  # "auto": Inferit picks the model
    base_url="https://api-production-c74b9.up.railway.app/v1",
    api_key=os.environ["INFERIT_API_KEY"],
)

greeter = Agent(
    role="Greeter",
    goal="Greet people in as few words as possible",
    backstory="You write very short greetings.",
    llm=llm,
)
task = Task(description="Say hello in five words.", expected_output="A five-word greeting.", agent=greeter)
print(Crew(agents=[greeter], tasks=[task]).kickoff())
```

## Model auto, or a named model

With `"auto"` as the model, Inferit picks the model: the best value on a published quality ranking for this request, at that model's cheapest healthy seller ([Automatic routing](https://inferit.cc/docs/routing.md)). The response names the model that answered, in its `model` field and the `x-inferit-model` header.

Auto needs a ranked model with a live seller. `GET /v1/routing` lists the models it can choose from now in `candidates_now`; while that list is empty, a request with auto answers `503 no_eligible_model`. Then name a catalog model with a live seller instead, such as `qwen/qwen-2.5-14b-instruct`, and Inferit picks the seller. The samples on this page send auto while it has a candidate, and that model otherwise.

## Notes

-   A crew sends several requests per task (the agent's reasoning steps, tool calls, retries). Each is priced and charged on its own; your usage log in the [Buy workspace](https://inferit.app/buy) lists every one.
-   Tools need a model and a seller that serve tool calls; what a model supports depends on how its seller serves it.
-   This guide pays with an API key. To pay per request with x402 and no key, see [Agents](https://inferit.cc/agents).

## Checked

The crew above ran against the hosted testnet API on 2026-10-13, with a named model (auto had no candidate that day).

---

Canonical page: https://inferit.cc/docs/guides/crewai
All pages as markdown: https://inferit.cc/llms.txt
Testnet demo: test tokens, no monetary value.
