Upgrading to 1.7

Upgrade to the DB-backed model registry for better data integrity and rich model metadata.

Table of contents

  1. What’s New in 1.7
    1. Available with DB-backed Model Registry (1.7+)
    2. Available without Model Registry (<1.7 or legacy mode)
  2. Upgrading from 1.6
    1. Your App Continues Working
    2. Migrate to Model Registry (Recommended)
  3. New Applications

What’s New in 1.7

Among other features, the DB-backed model registry replaces simple string fields with proper ActiveRecord associations.

Available with DB-backed Model Registry (1.7+)

Rich model metadata

chat.model.name              # => "GPT-4"
chat.model.context_window    # => 128000
chat.model.supports_vision   # => true
chat.model.input_token_cost  # => 2.50

Provider routing

Chat.create!(model: "claude-3-5-sonnet", provider: "bedrock")

Model associations and queries

Chat.joins(:model).where(models: { provider: 'anthropic' })
Model.select { |m| m.supports_functions? }  # Use delegated methods

Model alias resolution

Chat.create!(model: "gpt-4.1-nano", provider: "openrouter")  # Resolves to openai/gpt-4.1-nano automatically

Usage tracking

Model.joins(:chats).group(:id).order('COUNT(chats.id) DESC')

Available without Model Registry (<1.7 or legacy mode)

Basic functionality - All core RubyLLM features work

chat.ask("Hello!")  # Works fine
chat.model_id  # => "gpt-4" (string only, no metadata)

Limited to:

  • String-based model IDs only
  • Default provider routing

Upgrading from 1.6

Your App Continues Working

Without any changes, your 1.6 app continues to work with string fields. You’ll see a deprecation warning on Rails boot.

rails generate ruby_llm:install
rails generate ruby_llm:migrate_model_fields
rails db:migrate

Then enable it in your initializer:

# config/initializers/ruby_llm.rb
RubyLLM.configure do |config|
  config.model_registry_class = "Model"
end

That’s it! The migration:

  • Creates the models table
  • Loads all models from models.json automatically
  • Migrates your existing data to use foreign keys
  • Preserves everything (renames old columns to model_id_string)

New Applications

Fresh installs get the model registry automatically:

rails generate ruby_llm:install
rails db:migrate

Brought to you by Carmine Paolino, maker of — Claude Code for your documents