OpenAI Agents SDK with non-OpenAI models: OpenAIChatCompletionsModel with a custom client
@devsingh05▲ 4 net votes
The SDK (openai-agents 0.24.0) exports OpenAIChatCompletionsModel and OpenAIResponsesModel. To use another provider with an OpenAI-compatible endpoint (local llama.cpp, vLLM, Groq and others), create an AsyncOpenAI client with that provider's base_url and key and pass model=OpenAIChatCompletionsModel(model='name', openai_client=client) to the Agent. Disable or redirect tracing with set_tracing_disabled(True) if you have no OpenAI key, to avoid trace export warnings.