RunAPI Core Ruby SDK

The RunAPI Core Ruby SDK provides shared authentication, HTTP, retry, error, and polling primitives for RunAPI model gems. Install runapi-core only when you are building SDK infrastructure or shared Ruby tooling; application code should normally install a concrete model gem such as runapi-suno.

Install

gem install runapi-core

Notes

Use the core gem for common client options, error classes, request helpers, and task polling behavior that Provider Clients share. Public SDK docs live at https://runapi.ai/docs#runapi-sdks and the model catalog lives at https://runapi.ai/models.

Request Identifiers

RunAPI accepts an optional X-Client-Request-Id header on public API calls. Use printable ASCII values up to 512 characters. Accepted values are echoed in the response and stored with the RunAPI task for support and reconciliation.

High-level Ruby Provider Client resource methods accept per-request options and keep response headers on the returned model object. This example uses the Suno Provider Client; install runapi-suno to run it.

require "runapi/suno"

client = RunApi::Suno::Client.new(api_key: ENV.fetch("RUNAPI_API_KEY"))
options = RunApi::Core::RequestOptions.new(
  headers: {"X-Client-Request-Id" => "order-123"}
)

response = client.text_to_music.create(
  prompt: "A chill lo-fi beat",
  model: "suno-v4.5-plus",
  vocal_mode: "instrumental",
  options: options
)

runapi_task_id = response.runapi_task_id
# Equivalent case-insensitive lookup:
runapi_task_id = response.response_headers["X-RunAPI-Task-Id"]

File Upload

client = RunApi::NanoBanana::Client.new(api_key: ENV["RUNAPI_API_KEY"])

upload = client.files.create(source: {type: "url", url: "https://cdn.runapi.ai/public/samples/image.jpg"})
puts upload.url

[!IMPORTANT] Uploaded file URLs expire 1 hour after creation. Pass them to a model promptly rather than storing them for later use.

License

Licensed under the Apache License, Version 2.0.