Ruby
Generate production-ready Ruby SDKs from your OpenAPI specification
The Stainless Ruby SDK generator creates idiomatic, type-safe Ruby client libraries from your OpenAPI specification. Generated Ruby SDKs include modern type system support (Sorbet, RBS, YARD) and a minimal-dependency design.
Example repositories:
- anthropics/anthropic-sdk-ruby
- Increase/increase-ruby
- imagekit-developer/imagekit-ruby
- team-telnyx/telnyx-ruby
Configuration
Section titled “Configuration”To generate a Ruby SDK, add the ruby target to your Stainless configuration file:
targets: ruby: gem_name: my_company_client edition: ruby.2025-10-08Common configuration options
Section titled “Common configuration options”targets: ruby: gem_name: my_company_client
# Specify the edition edition: ruby.2025-10-08
# Configure publishing publish: rubygems: trueFor a complete list of configuration options, see the Ruby target reference.
Editions
Section titled “Editions”Editions allow Stainless to make improvements to SDKs that aren’t backwards-compatible. You can explicitly opt in to new editions when you’re ready. See the SDK and config editions reference for more information.
ruby.2025-10-08
- Initial edition for Ruby (used by default if no edition is specified)
Publishing to RubyGems
Section titled “Publishing to RubyGems”Publish your Ruby SDK to RubyGems for distribution.
Get an API token
- Log in or sign up at RubyGems.
- Select your profile picture on the top right to open a dropdown.
- Navigate to Settings.
- If you have MFA enabled, set the level to “UI and gem signin”.
- Navigate to API keys.
- Create a new API key with the “Push rubygems” privilege. If you have MFA enabled, make sure “Enable MFA” is unchecked.
Add the token to your production repo
- In your production repo, navigate to Secrets and variables > Actions > New repository secret.
The URL should look like
https://github.com/<org>/<repo>/settings/secrets/actions/new. - Add a new secret named
GEM_HOST_API_KEYwith your API token.
Choose a package name and update your Stainless config
-
Choose an available package name. Suggested names are:
<company-name><company-name>-client
You can check whether the name is available by testing the link at
https://rubygems.org/gems/<package-name>. -
Update the Stainless config with your package name and save.
targets:ruby:gem_name: <package-name>publish:rubygems: true