SDKs and frameworks
CrewAI
Run CrewAI agents in Python on this API with a custom OpenAI-compatible LLM.
CrewAI reaches this API through its LLM class with custom_openai=True, which sends calls through the OpenAI SDK to your base_url. Give the LLM to each agent with llm=.
Install
pip install "crewai[openai]"uv add "crewai[openai]"Configure API keys
API_KEY=sk-...Load it into the environment before you run the code (for example with python-dotenv). Keep the key out of your code.
Run
Text
import os
from crewai import LLM
llm = LLM(
model="openai/gpt-6-luna",
custom_openai=True,
base_url="https://test-demo.pinerouter.ai/v1",
api_key=os.environ["API_KEY"],
)
print(llm.call("Name three rivers in Europe."))Agents and tools
from crewai import Agent, Crew, Task
from crewai.tools import tool
@tool("get_weather")
def get_weather(city: str) -> str:
"""Current weather for a city."""
return f"Sunny, 21 C in {city}"
forecaster = Agent(
role="Forecaster",
goal="Answer weather questions",
backstory="You check the weather tool before you answer.",
tools=[get_weather],
llm=llm,
)
task = Task(description="What is the weather in {city}?", expected_output="One sentence.", agent=forecaster)
print(Crew(agents=[forecaster], tasks=[task]).kickoff(inputs={"city": "Paris"}))Stream
Add stream=True to the LLM(...) call to stream the model's answers.
Specifics
custom_openai=Trueneeds abase_url(orOPENAI_BASE_URLin the environment). With it, CrewAI drops theopenai/prefix and sendsgpt-6-lunato us.- Without
custom_openai=True, CrewAI checksopenai/...names against OpenAI's own model list and sends unknown ids through LiteLLM instead. - For images, video and other media call Jobs with the HTTP helper inside a tool.
- Tool calling depends on the model. Test with the model you plan to use.