Skip to content
Docs/Integrations/OpenAI Agents SDK

OpenAI Agents SDK

OpenAI's Python framework for agents, tools and hand-offs. It takes your own OpenAI client, so a custom base URL needs one call.

Settings

base_url
https://uncensoredllm.xyz/v1
api_key
your vk-... key
Agent model
uncensoredllm-1

Steps

  1. Install the SDK: pip install openai-agents.
  2. Create an AsyncOpenAI client with the base URL and key.
  3. Make it the default with set_default_openai_client().
  4. Turn tracing off with set_tracing_disabled(True). The SDK's docs say traces upload to OpenAI by default and fail with a 401 without an OpenAI key.
  5. Give the agent the model id as written.
script.pyPython
import osfrom openai import AsyncOpenAIfrom agents import Agent, Runner, set_default_openai_client, set_tracing_disabled set_default_openai_client(AsyncOpenAI(base_url="https://uncensoredllm.xyz/v1", api_key=os.environ["UNCENSOREDLLM_API_KEY"]))set_tracing_disabled(True) agent = Agent(name="Assistant", instructions="Be concise.", model="uncensoredllm-1")print(Runner.run_sync(agent, "Say hello in five words.").final_output)

The SDK uses the Responses API by default, which this service serves; see responses. The SDK's docs also show a Chat Completions route for providers without Responses: call set_default_openai_api("chat_completions") after setting the client, or give one agent an OpenAIChatCompletionsModel built on the same client.

Check that it works

Run the example. A printed answer means the client, the key and the model id are accepted.

When something does not work

  • 401 from the SDK with no OpenAI key Tracing is still on and is trying to upload to OpenAI. Call set_tracing_disabled(True).
  • 404 model_not_found The model id is not exactly the one above. See errors.
  • 400 unsupported_tool An OpenAI-hosted tool such as file search was declared. Use a function tool and run it yourself.