You already have a Ruby or Rails app built on the official OpenAI gem. Wren R1 speaks the same OpenAI-compatible protocol, so you change where the client points and which model it asks for. Nothing else in your request code changes.

Add the gem to your Gemfile:

gem "openai", "~> 0.103.0"

Build the client with WebWright as its base URL, and set the model to wren-r1:

require "openai"

client = OpenAI::Client.new(
  api_key: ENV.fetch("WEBWRIGHT_API_KEY"),
  base_url: "https://webwright.ai/v1"
)

completion = client.chat.completions.create(
  model: "wren-r1",
  messages: [{ role: "user", content: "Say this is a test." }]
)

puts completion.choices.first.message.content

The two changes that matter are base_url: "https://webwright.ai/v1" and model: "wren-r1". Your existing message building and response handling stay as they are.

If you would rather keep the client configuration out of code, the gem reads the standard environment variables:

export OPENAI_BASE_URL=https://webwright.ai/v1
export OPENAI_API_KEY=your-webwright-key

Then construct the client with OpenAI::Client.new, and it picks both up.

Stream a response

Streaming uses the same client and the same parameters. The gem returns a stream you can read chunk by chunk:

stream = client.chat.completions.stream(
  model: "wren-r1",
  messages: [{ role: "user", content: "Write a haiku about APIs." }]
)

stream.text.each { |chunk| print chunk }

Transcribe audio

The same base URL and key cover audio transcription. Wrap the file in OpenAI::FilePart so the gem sends a filename and content type:

transcription = client.audio.transcriptions.create(
  model: "whisper-large-v3-turbo",
  file: OpenAI::FilePart.new(
    File.binread("audio.mp3"),
    filename: "audio.mp3",
    content_type: "audio/mpeg"
  )
)

puts transcription.text

What Wren R1 serves

  • One base URL, https://webwright.ai/v1, covers chat completions and audio transcription.
  • Chat model: wren-r1, with a 200K token context window.
  • Transcription model: whisper-large-v3-turbo. Transcription is billed by audio duration, not text tokens, and is included free on the Premium pay-as-you-go tier.
  • Published Standard rates: cache $0.10, input $0.40, output $1.60 per 1M tokens.

If you are weighing a second provider or planning a migration, a short call is the fastest way to get a prioritized first use case.

The WebWright Team