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
- Install the SDK:
pip install openai-agents. - Create an
AsyncOpenAIclient with the base URL and key. - Make it the default with
set_default_openai_client(). - 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. - 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 keyTracing is still on and is trying to upload to OpenAI. Callset_tracing_disabled(True).404 model_not_foundThe model id is not exactly the one above. See errors.400 unsupported_toolAn OpenAI-hosted tool such as file search was declared. Use a function tool and run it yourself.