BroadRouter

Use CrewAI with BroadNet Inference as a custom OpenAI endpoint

Updated

Create the model with crewai's LLM class, passing model set to a BroadNet ID such as broadnet/glm-5.3, custom_openai=True, base_url set to https://inference.broadnet.ai/v1 and api_key set to your BroadNet key. Then give that LLM to each Agent. CrewAI uses its native OpenAI client and chat completions, so no LiteLLM install is needed.

CrewAI is a Python framework for teams of agents. Its docs show a custom OpenAI-compatible endpoint pattern: an LLM with custom_openai=True and a base_url. BroadNet Inference serves standard chat completions at https://inference.broadnet.ai/v1, so it plugs in there. BroadRouter is BroadNet’s own site; this follows CrewAI’s docs and source as of version 1.15.41.

Install

pip install crewai
export BROADNET_API_KEY='your-broadnet-key'

Connect

import os
from crewai import LLM, Agent

llm = LLM(
    model="broadnet/glm-5.3",
    custom_openai=True,
    base_url="https://inference.broadnet.ai/v1",
    api_key=os.environ["BROADNET_API_KEY"],
    max_tokens=4000,  # reasoning counts toward this limit
)

# Quick test: one call straight to the model
print(llm.call("Say hello in five words."))

analyst = Agent(
    role="Analyst",
    goal="Summarize incidents",
    backstory="You write short incident summaries.",
    llm=llm,
)
print(analyst.kickoff("Summarize: the API returned 503 for four minutes after a deploy."))

If llm.call prints an answer, the key, URL and model ID are right.

How CrewAI routes the request

CrewAI’s source sets an order: custom_openai=True comes first and forces the native OpenAI provider, overriding anything the model name suggests. It also raises an error unless a custom endpoint is set through base_url, api_base, OPENAI_BASE_URL or OPENAI_API_BASE. The model string is sent as written, so broadnet/glm-5.3 reaches BroadNet unchanged.

Without custom_openai, a name such as broadnet/glm-5.3 would be read as provider broadnet, which CrewAI doesn’t know, and would fall back to LiteLLM. The documented alternative is model="openai/broadnet/glm-5.3" with a base_url: CrewAI strips the openai/ prefix and sends the rest.

Two more things from CrewAI’s code and docs:

  • Token limit field. When you pass max_tokens, the native client sends max_tokens on chat completions, the field BroadNet’s API reference describes. If you pass max_completion_tokens, that is sent instead.
  • Stay on chat completions. CrewAI’s docs show api="responses" to switch to the Responses API. Don’t set it; BroadNet doesn’t list that API.

Which model for which agent

Agent Model Why
Agents with tools broadnet/glm-5.3 BroadNet lists tools and structured output; 1M context
Image or Arabic input, with tools broadnet/qwen3.8-27b Tools plus images; 262K context
Long reading tasks, flat-rate plan broadnet/deepseek-v4.1-flash Unlimited plans; tools not listed by BroadNet

A crew can mix them: give each Agent its own LLM.

Troubleshooting

  • 401. The key is wrong, expired or out of allowance. If you left out api_key, CrewAI read OPENAI_API_KEY, which may hold an OpenAI key.
  • “custom_openai=True requires base_url”. Pass base_url, or set OPENAI_BASE_URL.
  • Model not found. Check the ID matches BroadNet’s exactly. Paid models need a top-up; the $5 credit covers only broadnet/gemma-4-26b-a4b and the two Transcribe models.
  • EmptyLLMResponseError. CrewAI retries an empty answer once, then raises this. Raise max_tokens. Why answers come back empty.
  • 429 with several agents. A pay-as-you-go key allows 30 requests a minute and 4 in flight, and a plan session runs one request at a time. See errors and retries.

Questions

What does custom_openai=True do in CrewAI?

CrewAI's source says it forces the native OpenAI provider whatever the model name looks like, and it requires base_url, api_base, OPENAI_BASE_URL or OPENAI_API_BASE. The model string is sent as written, so broadnet/glm-5.3 reaches BroadNet unchanged.

Can I write model="openai/broadnet/glm-5.3" instead?

Yes. With a custom base_url, CrewAI routes an openai/ prefix to its native OpenAI client and strips the prefix, so BroadNet receives broadnet/glm-5.3. custom_openai=True is the clearer form.

Why does my crew fail with EmptyLLMResponseError?

CrewAI retries an empty answer, one with no content and no tool calls, once, and raises this error if the retry is empty too. On BroadNet's reasoning models that usually means the reasoning used the output budget. Raise max_tokens.

Which BroadNet model should CrewAI agents use?

GLM 5.3 for agents with tools, since BroadNet lists tools and structured output for it. Qwen3.8 27B also has tools and takes images.

Read as MarkdownAsk ChatGPTAsk ClaudeAsk Perplexity