Skip to content

Invalid API key for custom base URL #130

@vanloc1808

Description

@vanloc1808

Please read this first

  • Have you read the docs?Agents SDK docs yes
  • Have you searched for related issues? Others may have faced similar issues. yes

Describe the bug

I am about to create an AsyncOpenAI client, with base_url to point to my endpoint, and my endpoint does not require authentication. However, the error of invalid API key shows.

Debug information

  • Agents SDK version: (e.g. v0.0.3)
  • Python version (e.g. Python 3.12.0)

Repro steps

from openai import AsyncOpenAI
from agents import set_default_openai_client

set_default_openai_client(
    AsyncOpenAI(
        base_url=<my-base-url>, 
        api_key="sk-bjkacbsajkcbajcakbcsjaascbkjsabcajkcbakjascbkjsc",
    ),
)

My endpoint does not require API key. In other implementation, I can still use a dummy API key for interacting with this.
However, when I call Runner.run(), it shows the error of invalid API key.
Image

Expected behavior

The client should work without checking the API key in this case.

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