Skip to main content

CrewAI

CrewAI is a Python library for building teams of AI "agents" that work together, such as a researcher and a writer.

You need no extra package or plugin to use NuRoute with it. CrewAI's built-in LLM class can talk straight to your NuRoute gateway. CrewAI is not a platform with a plugin shop like n8n or Dify. It is a Python library, and its LLM class already accepts any OpenAI-compatible address.

Your tool uses the NuRoute connector, which talks to your NuRoute gateway

Before you start​

  • Python with CrewAI installed.
  • Your NuRoute gateway address, ending in /v1.
  • An API key that starts with aicp-.

Step 1: Create the LLM​

from crewai import LLM

llm = LLM(
model="auto", # NuRoute's routing engine picks the best model
custom_openai=True,
base_url="https://your-nuroute-gateway/v1",
api_key="aicp-...",
)
SettingPlain meaning
model="auto""Let NuRoute pick the best model."
custom_openai=True"Talk to an OpenAI-compatible address that is not OpenAI." This also requires a base_url.
base_urlYour gateway address, with /v1 at the end.
api_keyYour aicp-... key.

With model="auto", Artemis picks the model for each request.

Step 2: Give it to an agent​

Use it on an agent the same way as any other CrewAI model:

from crewai import Agent

researcher = Agent(
role="Researcher",
goal="Find accurate, up-to-date information",
backstory="An experienced research analyst.",
llm=llm,
)

Forcing a specific model​

Use a real model ID instead of "auto". CrewAI does not need a provider prefix here, because custom_openai=True already points the request at your gateway:

llm = LLM(
model="claude-sonnet-4-6",
custom_openai=True,
base_url="https://your-nuroute-gateway/v1",
api_key="aicp-...",
temperature=0.2,
max_tokens=1024,
)

Tool calling​

Tool calling lets an agent use tools, such as searching or calculating. CrewAI's OpenAI-compatible path supports standard OpenAI-style function calling, and the NuRoute gateway accepts tools and tool_choice in the same shape. So agent tool use works with no extra setup.

Which models can I use?​

  • Send auto, or an Artemis option (artemis-cost, artemis-balanced, artemis-quality), and Artemis picks the model.
  • Or name any model in the model catalogue.
  • Named models can run on your own provider keys (BYOK).

How it works inside​

CrewAI has its own built-in provider code based on the OpenAI SDK, instead of sending everything through LiteLLM. Setting custom_openai=True makes it use the OpenAI-compatible code and requires a base_url. It does not check the model text against a list of known names. So NuRoute's "auto" passes straight through, just like a real model ID would.

Advanced: a fully custom LLM class​

Most people never need this. custom_openai already covers routing, model choice and tool calling.

But suppose you want something the OpenAI-compatible format cannot say. For example, calling NuRoute through the nuroute Python SDK directly instead of plain HTTP. CrewAI gives you a BaseLLM abstract class (from crewai import BaseLLM). You subclass it and write one method, call(...).