Skip to content

OpenAIException – "Your request was blocked" with custom API base #2879

@mranonymous011000001

Description

@mranonymous011000001

Confirm this is an issue with the Python library and not an underlying OpenAI API

  • This is an issue with the Python library

Describe the bug

I’m trying to use a custom API base URL, but every request returns:

OpenAIException - Your request was blocked.

What I tested

  • Using latest version of the library
  • API works correctly with requests
  • API key is valid
  • Also tested with litellm — same error

Notes

The same request works fine with direct HTTP requests, but fails only with this library.

Is there any special requirement for custom base URLs or headers that could cause this?

To Reproduce

To Reproduce

Steps to reproduce the behavior:

  1. Set a custom API base URL
  2. Initialize the OpenAI client with the custom base URL and API key
  3. Send a simple completion/chat request
  4. Observe the error:
OpenAIException - Your request was blocked.

The same request works correctly when using requests library directly, but fails with this library.

Code snippets

OS

Windows

Python version

Python 13

Library version

OpenAI v2.x.x

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions