Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Are there some other way to set up the api token besides setting it as an environment variable? #154

Open
splotchysnow opened this issue Mar 13, 2025 · 2 comments
Labels
question Question about using the SDK

Comments

@splotchysnow
Copy link

The doc only mentioned to set OPENAI_API_KEY and it seems that .env wasn't working as expected. The only I can use the API key is if I set it up as a environment variable. Are there other more elegant and safer ways to do this?

@splotchysnow splotchysnow added the question Question about using the SDK label Mar 13, 2025
@moseshu
Copy link

moseshu commented Mar 14, 2025

read the doc https://openai.github.io/openai-agents-python/config/

from openai import AsyncOpenAI
external_client = AsyncOpenAI(
    api_key="sk-prrr",
    base_url="https://ip/v1",
)
from agents import set_default_openai_client
set_default_openai_client(external_client)

@rm-openai
Copy link
Collaborator

Yup, https://openai.github.io/openai-agents-python/config/ has some other suggestions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question about using the SDK
Projects
None yet
Development

No branches or pull requests

3 participants