Module: RubyCoded::Chat::CodexModels

Defined in:
lib/ruby_coded/chat/codex_models.rb

Overview

Local catalog of models available through the ChatGPT Codex backend. These models are not listed in RubyLLM.models because they use a different API (Responses API via chatgpt.com/backend-api).

Defined Under Namespace

Classes: CodexModel

Constant Summary collapse

PROVIDER =
:openai
MODELS =
[
  CodexModel.new(id: "gpt-5.4", display_name: "GPT 5.4 (Recommended)",
                 context_window: 272_000, max_output: 128_000, pro_only: false),
  CodexModel.new(id: "gpt-5.4-mini", display_name: "GPT 5.4 Mini",
                 context_window: 272_000, max_output: 128_000, pro_only: false),
  CodexModel.new(id: "gpt-5.3-codex-spark", display_name: "GPT 5.3 Codex Spark",
                 context_window: 272_000, max_output: 128_000, pro_only: true),
  CodexModel.new(id: "gpt-5.2-codex", display_name: "GPT 5.2 Codex",
                 context_window: 272_000, max_output: 128_000, pro_only: true),
  CodexModel.new(id: "gpt-5.2", display_name: "GPT 5.2",
                 context_window: 272_000, max_output: 128_000, pro_only: false)
].freeze
PRO_TIER_PLANS =
%w[pro team enterprise business edu].freeze

Class Method Summary collapse

Class Method Details

.allObject



39
40
41
# File 'lib/ruby_coded/chat/codex_models.rb', line 39

def self.all
  MODELS
end

.available_for_plan(plan) ⇒ Object



58
59
60
61
62
63
64
65
66
67
# File 'lib/ruby_coded/chat/codex_models.rb', line 58

def self.available_for_plan(plan)
  normalized = plan.to_s.downcase
  return MODELS if normalized.empty? || PRO_TIER_PLANS.any? { |p| normalized.include?(p) }

  if normalized.include?("plus") || normalized.include?("free")
    MODELS.reject(&:pro_only?)
  else
    MODELS
  end
end

.codex_model?(id) ⇒ Boolean

Returns:

  • (Boolean)


47
48
49
# File 'lib/ruby_coded/chat/codex_models.rb', line 47

def self.codex_model?(id)
  MODELS.any? { |m| m.id == id }
end

.find(id) ⇒ Object



43
44
45
# File 'lib/ruby_coded/chat/codex_models.rb', line 43

def self.find(id)
  MODELS.find { |m| m.id == id }
end

.pro_only?(id) ⇒ Boolean

Returns:

  • (Boolean)


51
52
53
54
# File 'lib/ruby_coded/chat/codex_models.rb', line 51

def self.pro_only?(id)
  model = find(id)
  model ? model.pro_only? : false
end