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

Class Method Details

.auth_methodsObject



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_urlObject



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_idObject



14
15
16
# File 'lib/ruby_coded/auth/providers/openai.rb', line 14

def self.client_id
  "app_EMoamEEZ73f0CkXaXp7hrann"
end

.codex_auth_paramsObject



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_urlObject



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_urlObject



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_nameObject



10
11
12
# File 'lib/ruby_coded/auth/providers/openai.rb', line 10

def self.display_name
  "OpenAI"
end

.key_patternObject



39
40
41
# File 'lib/ruby_coded/auth/providers/openai.rb', line 39

def self.key_pattern
  /\Ask-/
end

.redirect_uriObject



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_keyObject



51
52
53
# File 'lib/ruby_coded/auth/providers/openai.rb', line 51

def self.ruby_llm_key
  :openai_api_key
end

.scopesObject



47
48
49
# File 'lib/ruby_coded/auth/providers/openai.rb', line 47

def self.scopes
  "openid profile email offline_access"
end

.token_urlObject



31
32
33
# File 'lib/ruby_coded/auth/providers/openai.rb', line 31

def self.token_url
  "https://auth.openai.com/oauth/token"
end