Skip to main content

Prerequisite

To start using the Autogen SDK with the AI Router, you need an API Key ready within your account.
To setup your API key, see API keys & Endpoints.
To use libraries with private models, see Onboarding Private Models.

Using the AI Router

Using the AI Router, you benefit from the Platform Traces, and Observability, keeping full compatibility and a unified API with all models available.
from os import getenv
from agno.agent import Agent
from agno.tools.yfinance import YFinanceTools
from agno.models.openai.like import OpenAILike

agent = Agent(
    model=OpenAILike(
        id="openai/gpt-4o",
        api_key=getenv("ORQ_API_KEY"),
        base_url="https://api.orq.ai/v2/proxy",
    ),
    tools=[YFinanceTools(stock_price=True)],
    instructions="Use tables to display data. Don't include any other text.",
    markdown=True,
)

# Print the response in the terminal
agent.print_response("What is the stock price of Apple?", stream=True)