CrewAI

Run CrewAI agents and crews on Morse's private, OpenAI-compatible API: set the base URL, pick a model, and check it works.

Make a CrewAI LLM with openai/ before the Morse model id, Morse's base URL, and your key.

Terminal
pip install crewai
Python
import os
from crewai import LLM

llm = LLM(
    model="openai/moonshotai/kimi-k3.1-pro",
    base_url="https://inference.trymorse.ai/v1",
    api_key=os.environ["MORSE_API_KEY"],
    context_window_size=1048576,
)
print(llm.call("Hello"))

The openai/ prefix and the base URL send the request through CrewAI's OpenAI client, as moonshotai/kimi-k3.1-pro. Set context_window_size to the model's context. Without it, CrewAI assumes the model takes 8,192 tokens.

Give it to a crew

Pass the same LLM to each agent.

Python
from crewai import Agent, Crew, Task

writer = Agent(
    role="Writer",
    goal="Explain technical terms in one sentence",
    backstory="You write short, plain explanations.",
    llm=llm,
)
task = Task(
    description="Explain what a TEE is.",
    expected_output="One sentence.",
    agent=writer,
)
print(Crew(agents=[writer], tasks=[task]).kickoff())

Give every agent the llm. An agent without one calls CrewAI's default, an OpenAI model on OpenAI's API.

Send Morse's own parameters

Pass them as extra_body.

Python
llm = LLM(
    model="openai/z-ai/glm-5.3",
    base_url="https://inference.trymorse.ai/v1",
    api_key=os.environ["MORSE_API_KEY"],
    context_window_size=1048576,
    extra_body={"provider": {"min_privacy": "tee"}},
)