Agno on a custom OpenAI base URL (Phidata)
Run Agno agents on UplinkSwitch through the OpenAILike model class: the base-URL block, an agent with a tool, and a note for anyone coming from Phidata.
Agno (formerly Phidata) takes an OpenAI-compatible model through its OpenAILike model class with a base URL and key, so an Agno agent runs on the catalog by setting the base URL to https://api.uplinkswitch.com/v1 and naming a catalog id. OpenAILike exists precisely for providers that serve the OpenAI shape without being OpenAI, which is what the gateway is, so you give it three things, the model id, the key and that base URL, and the rest of your agent code is untouched.
The model block
Import the class from agno.models.openai.like and build it with an id, an api_key and a base_url. Those are the three fields that matter here; id is the catalog model string, base_url is the gateway, and api_key carries the sk-uplink-live- key.
import os
from agno.models.openai.like import OpenAILike
model = OpenAILike(
id="claude-sonnet-5-5",
api_key=os.environ["UPLINKSWITCH_API_KEY"],
base_url="https://api.uplinkswitch.com/v1",
)The id is the plain catalog id, so a Claude model is claude-sonnet-5-5 with no provider namespace in front of it, and a GPT model is gpt-6.1-sol. Swapping between them is a one-string change; the base_url and key never move.
An agent with a tool
Drop that model into an Agent, give the agent a Python function as a tool, and ask it something that invites the tool to fire. Agno hands the function schema to the model, the model decides to call it, and Agno runs your function and feeds the result back for the final answer.
from agno.agent import Agent
def order_status(order_id: str) -> str:
"""Look up the delivery state of an order by its id."""
return f"Order {order_id} shipped and arrives Thursday."
agent = Agent(
model=OpenAILike(
id="claude-sonnet-5-5",
api_key=os.environ["UPLINKSWITCH_API_KEY"],
base_url="https://api.uplinkswitch.com/v1",
),
tools=[order_status],
)
agent.print_response("Where is order A-4471?")Tool calls travel in the OpenAI tools schema and come back on the response (or as deltas when you pass stream=True), so native function use works the way it does on OpenAI itself. Choose an id whose catalog entry lists tool support before you depend on it, and check Agno's own model-compatibility page if a particular model refuses a tool.
Coming from Phidata
The project was renamed from Phidata to Agno, and old code that imported from phi has moved under the agno namespace. If you are porting a Phidata agent, the model block is the same: Phidata's OpenAILike from phi.model.openai.like becomes OpenAILike from agno.models.openai.like, with the same id, api_key and base_url values pointed at the gateway. Single-agent and tool code mostly carries over; team code moved from Agent(team=[...]) to Agno's own Team class, so port that part separately.
Cheap and strong on one key
Agno lets each agent in a team hold its own model, so a research or summarise step can run a lighter id while the agent that writes or decides runs a stronger one, all billed to the same key at the same base URL. Give the busy, low-stakes agents the fast id and reserve the capable id for the step whose output ships.
| Role in a team | Model id | Price per 1M (in / out) |
|---|---|---|
| Gather, summarise | gpt-6.1-sol | $0.582 / $2.91 |
| Decide, final write | claude-sonnet-5-5 | $1.164 / $2.91 |
Every table row is its own OpenAILike(...), differing only by the id string. The gateway also retries a model across its internal routes when one route is down, so an agent that would have failed on a single busy provider keeps going without any retry logic in your code; a whole-model fallback, when you want one, lives in your agent logic as a second OpenAILike. For cross-model strategies see /openai-api-alternative, and for other frameworks the sibling guides at /guides/crewai and /guides/pydantic-ai.
Streaming and what a run costs
The gateway streams OpenAI-compatible chat chunks whichever developer's model answers, so Agno's streaming output behaves no differently than it would against OpenAI directly. When you want to know what a turn actually cost rather than estimate it, the settled figure lands as usage.cost in the response body, which is the exact charge for that one model request after the gateway reconciles the opening hold. A tool turn makes at least two requests, so summing the charges per run, especially on a team where each agent carries a different id, tells you which step is spending the money before you schedule the team to run on a loop. The id of the model that answered is reported in the body's model field, so a team that escalates from the fast id to the strong one leaves a trail you can audit without guessing which agent triggered the jump.