Module: RubyCoded::Auth::Providers::OpenAI
- Defined in:
- lib/ruby_coded/auth/providers/openai.rb
Overview
OpenAI provider’s configuration. OAuth authenticates via ChatGPT Plus/Pro subscription (Codex backend). API key authenticates via OpenAI Platform API credits.
Class Method Summary collapse
- .auth_methods ⇒ Object
- .auth_url ⇒ Object
- .client_id ⇒ Object
- .codex_auth_params ⇒ Object
- .codex_base_url ⇒ Object
- .console_url ⇒ Object
- .display_name ⇒ Object
- .key_pattern ⇒ Object
- .redirect_uri ⇒ Object
- .ruby_llm_key ⇒ Object
- .scopes ⇒ Object
- .token_url ⇒ Object
Class Method Details
.auth_methods ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/ruby_coded/auth/providers/openai.rb', line 18 def self.auth_methods [ { key: :oauth, label: "With your ChatGPT Plus/Pro subscription (no API credits needed)" }, { key: :api_key, label: "With an OpenAI API key (requires API credits at platform.openai.com)" } ] end |
.auth_url ⇒ Object
27 28 29 |
# File 'lib/ruby_coded/auth/providers/openai.rb', line 27 def self.auth_url "https://auth.openai.com/oauth/authorize" end |
.client_id ⇒ Object
14 15 16 |
# File 'lib/ruby_coded/auth/providers/openai.rb', line 14 def self.client_id "app_EMoamEEZ73f0CkXaXp7hrann" end |
.codex_auth_params ⇒ Object
55 56 57 58 59 60 61 |
# File 'lib/ruby_coded/auth/providers/openai.rb', line 55 def self.codex_auth_params { id_token_add_organizations: "true", codex_cli_simplified_flow: "true", originator: "codex_cli_rs" } end |
.codex_base_url ⇒ Object
63 64 65 |
# File 'lib/ruby_coded/auth/providers/openai.rb', line 63 def self.codex_base_url "https://chatgpt.com/backend-api" end |
.console_url ⇒ Object
35 36 37 |
# File 'lib/ruby_coded/auth/providers/openai.rb', line 35 def self.console_url "https://platform.openai.com/account/api-keys" end |
.display_name ⇒ Object
10 11 12 |
# File 'lib/ruby_coded/auth/providers/openai.rb', line 10 def self.display_name "OpenAI" end |
.key_pattern ⇒ Object
39 40 41 |
# File 'lib/ruby_coded/auth/providers/openai.rb', line 39 def self.key_pattern /\Ask-/ end |
.redirect_uri ⇒ Object
43 44 45 |
# File 'lib/ruby_coded/auth/providers/openai.rb', line 43 def self.redirect_uri "http://localhost:1455/auth/callback" end |
.ruby_llm_key ⇒ Object
51 52 53 |
# File 'lib/ruby_coded/auth/providers/openai.rb', line 51 def self.ruby_llm_key :openai_api_key end |
.scopes ⇒ Object
47 48 49 |
# File 'lib/ruby_coded/auth/providers/openai.rb', line 47 def self.scopes "openid profile email offline_access" end |
.token_url ⇒ Object
31 32 33 |
# File 'lib/ruby_coded/auth/providers/openai.rb', line 31 def self.token_url "https://auth.openai.com/oauth/token" end |