OpenAI Agents SDK

The Agents SDK runs a model through any OpenAI client you hand it. Give OpenAIChatCompletionsModel a client pointed at OpenCheap.

What you need

  • Base URLhttps://api.opencheap.si/v1
  • API keyA kl_live_… key from the console, kept in OPENCHEAP_API_KEY.
  • ModelAn id from Models, for example claude-sonnet-5.
pip install openai-agents

An agent with a tool

import os
from openai import AsyncOpenAI
from agents import Agent, OpenAIChatCompletionsModel, Runner, function_tool, set_tracing_disabled

client = AsyncOpenAI(base_url="https://api.opencheap.si/v1", api_key=os.environ["OPENCHEAP_API_KEY"])
set_tracing_disabled(True)


@function_tool
def get_weather(city: str) -> str:
    """Get the weather for a city."""
    return f"Sunny in {city}"


agent = Agent(
    name="Assistant",
    instructions="Answer in one sentence.",
    model=OpenAIChatCompletionsModel(model="claude-sonnet-5", openai_client=client),
    tools=[get_weather],
)
result = Runner.run_sync(agent, "What's the weather in Paris?")
print(result.final_output)

set_tracing_disabled(True) turns off the SDK's trace upload, which goes to OpenAI's own service and has no use for an OpenCheap key. Without a client of your own the SDK would call OpenAI's API; with OpenAIChatCompletionsModel every model call, tool rounds included, goes to the base URL above.

What was checked

Run on October 28, 2026 with openai-agents 0.20.0 on claude-sonnet-5: the agent called get_weather and answered from its result.