Ruby quickstart — 5 lines to ship

Ruby developers can use the ruby-openai gem against VerticalAPI by overriding the URI base. Works in Rails, Sinatra, or plain scripts.

From zero to first call

  1. Sign up at verticalapi.com/dashboard

    Free tier — no card required. Generates your vapi_ key automatically.

  2. Add a provider key

    Paste your OpenAI sk-..., Anthropic sk-ant-..., or Google AIza... into the dashboard. Encrypted at rest.

  3. Install the Ruby SDK

    gem install ruby-openai

  4. Run the example below

    Drop-in OpenAI SDK pattern — base_url + api_key + provider key header. That's it.

  5. Inspect the trace

    Every call gets a unique request ID. Find it in the dashboard with full latency, tokens, and cost breakdown.

Ruby — first call

quickstart.rubyRuby
require 'openai'

client = OpenAI::Client.new(
  access_token: 'vapi_...',
  uri_base: 'https://api.verticalapi.com',
  request_timeout: 240,
  extra_headers: { 'X-Provider-Key' => 'sk-...' }
)

response = client.chat(
  parameters: {
    model: 'gpt-4o',
    messages: [{ role: 'user', content: 'Hello, world' }]
  }
)
puts response.dig('choices', 0, 'message', 'content')

Swap model for claude-sonnet-4-5, gemini-2.5-pro, or any of 25+ supported providers. Update X-Provider-Key to match.

Common errors and fixes

Faraday::TimeoutError
Increase request_timeout in OpenAI::Client.new. For streaming long responses, use the stream: lambda do |chunk|... pattern with a long timeout.
wrong number of arguments (given 2, expected 1)
ruby-openai changed its signature in v6. Pass parameters: keyword. Upgrade with gem update ruby-openai.
JSON::ParserError on streaming
Streaming returns SSE chunks — each starts with 'data: '. Strip the prefix before JSON.parse. The gem's streaming helper does this automatically — use the official lambda interface.

Where to go from here

Pick a model: browse all 25+ providers. Compare two: read head-to-head comparisons. Or jump to a use case: chatbot, RAG, autonomous agents.