One OpenAI-compatible key for our own models and the market. Base URL https://api.llm-broker.net/api/v1,
model: "taylor" for the strongest measured model, or any id from
/api/v1/broker/models. Criteria per request go into routing;
every non-streaming answer carries broker (region, cost, routing applied).
No key yet? POST /api/v1/broker/accounts — card at Stripe, key exactly once.
curl -s https://api.llm-broker.net/api/v1/chat/completions \
-H "Authorization: Bearer $BROKER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "taylor",
"messages": [{"role": "user", "content": "Say OK"}],
"routing": {"category": "coding", "level": "best"}}'
pip install openai
import os
from openai import OpenAI
client = OpenAI(base_url="https://api.llm-broker.net/api/v1", api_key=os.environ["BROKER_API_KEY"])
r = client.chat.completions.create(
model="taylor",
messages=[{"role": "user", "content": "Say OK"}],
# criteria per request; the broker picks the cheapest offer that meets them
extra_body={"routing": {"category": "coding", "level": "best"}},
)
print(r.choices[0].message.content)
print(getattr(r, "broker", None)) # region, cost, routing applied
pip install langchain langchain-openai
import os
from langchain_openai import ChatOpenAI
from langchain.agents import create_agent # LangGraph 1.0 agent runtime
llm = ChatOpenAI(
model="taylor",
base_url="https://api.llm-broker.net/api/v1",
api_key=os.environ["BROKER_API_KEY"],
extra_body={"routing": {"category": "reasoning", "level": "strong"}},
)
agent = create_agent(llm, tools=[])
out = agent.invoke({"messages": [("user", "Say OK")]})
print(out["messages"][-1].content)
pip install crewai
import os
from crewai import LLM
# "openai/" tells CrewAI to speak the OpenAI protocol to our base_url
llm = LLM(model="openai/taylor", base_url="https://api.llm-broker.net/api/v1", api_key=os.environ["BROKER_API_KEY"])
print(llm.call("Say OK"))
# use it in an agent: Agent(role=..., goal=..., backstory=..., llm=llm)
pip install autogen-agentchat "autogen-ext[openai]"
import asyncio, os
from autogen_agentchat.agents import AssistantAgent
from autogen_ext.models.openai import OpenAIChatCompletionClient
client = OpenAIChatCompletionClient(
model="taylor",
base_url="https://api.llm-broker.net/api/v1",
api_key=os.environ["BROKER_API_KEY"],
model_info={"vision": False, "function_calling": True, "json_output": True,
"family": "unknown", "structured_output": True},
)
async def main():
agent = AssistantAgent("assistant", model_client=client)
result = await agent.run(task="Say OK")
print(result.messages[-1].content)
asyncio.run(main())
pip install llama-index-llms-openai-like
import os
from llama_index.llms.openai_like import OpenAILike
llm = OpenAILike(model="taylor", api_base="https://api.llm-broker.net/api/v1", api_key=os.environ["BROKER_API_KEY"],
is_chat_model=True, context_window=128000)
print(llm.complete("Say OK"))
Registry: net.llm-broker/broker
{
"mcpServers": {
"llm-broker": {
"command": "npx",
"args": ["-y", "mcp-remote", "https://api.llm-broker.net/api/v1/broker/mcp",
"--header", "Authorization: Bearer ${BROKER_API_KEY}"],
"env": {"BROKER_API_KEY": "ast_sk_…"}
}
}
}
Credential / provider type: OpenAI (or "OpenAI-compatible")
Base URL: https://api.llm-broker.net/api/v1
API key: ast_sk_…
Model: taylor (or any id from GET /api/v1/broker/models)