Skip to content

feat: Add Credentials struct for simplified client initialization #25

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

echozyr2001
Copy link

This PR introduces a new Credentials struct that consolidates API key and base URL
configuration, enabling simpler client initialization. The main benefits are:

  • Single container for auth and URL settings
  • Environment-based configuration in one step via OpenAI::from_env()
  • Cleaner credential management with OpenAI::from_credentials()
  • Full backward compatibility with existing code

Environment variables:

  • OPENAI_API_KEY (required): Your API key
  • OPENAI_API_URL (optional): API base URL, defaults to "https://api.openai.com/v1/"
  • OPENAI_ORGANIZATION (optional): Organization ID

This change improves the developer experience while maintaining all existing functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant