venice_client

VeniceClient - the Ruby gem for the Venice.ai API

The Venice.ai API.

This SDK is automatically generated by the Swagger Codegen project:

  • API version: 20250521.233203
  • Package version: 1.0.0
  • Build package: io.swagger.codegen.v3.generators.ruby.RubyClientCodegen

Installation

Build a gem

To build the Ruby code into a gem:

gem build venice_client.gemspec

Then either install the gem locally:

gem install ./venice_client-1.0.0.gem

(for development, run gem install --dev ./venice_client-1.0.0.gem to install the development dependencies)

or publish the gem to a gem hosting service, e.g. RubyGems.

Finally add this to the Gemfile:

gem 'venice_client', '~> 1.0.0'

Install from Git

If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile:

gem 'venice_client', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git'

Include the Ruby code directly

Include the Ruby code directly using -I as follows:

ruby -Ilib script.rb

Getting Started

Please follow the installation procedure and then run the following code:

# Load the gem
require 'venice_client'
# Setup authorization
VeniceClient.configure do |config|
end

api_instance = VeniceClient::APIKeysApi.new
opts = { 
  body: VeniceClient::ApiKeysBody.new # ApiKeysBody | 
}

begin
  #/api/v1/api_keys
  result = api_instance.create_api_key(opts)
  p result
rescue VeniceClient::ApiError => e
  puts "Exception when calling APIKeysApi->create_api_key: #{e}"
end
# Setup authorization
VeniceClient.configure do |config|
end

api_instance = VeniceClient::APIKeysApi.new
opts = { 
  id: 'id_example' # String | The ID of the API key to delete
}

begin
  #/api/v1/api_keys
  result = api_instance.delete_api_key(opts)
  p result
rescue VeniceClient::ApiError => e
  puts "Exception when calling APIKeysApi->delete_api_key: #{e}"
end

api_instance = VeniceClient::APIKeysApi.new

begin
  #/api/v1/api_keys/generate_web3_key
  result = api_instance.get_api_key_generate_web3_key
  p result
rescue VeniceClient::ApiError => e
  puts "Exception when calling APIKeysApi->get_api_key_generate_web3_key: #{e}"
end
# Setup authorization
VeniceClient.configure do |config|
end

api_instance = VeniceClient::APIKeysApi.new

begin
  #/api/v1/api_keys/rate_limits/log
  result = api_instance.get_api_key_rate_limit_logs
  p result
rescue VeniceClient::ApiError => e
  puts "Exception when calling APIKeysApi->get_api_key_rate_limit_logs: #{e}"
end
# Setup authorization
VeniceClient.configure do |config|
end

api_instance = VeniceClient::APIKeysApi.new

begin
  #/api/v1/api_keys/rate_limits
  result = api_instance.get_api_key_rate_limits
  p result
rescue VeniceClient::ApiError => e
  puts "Exception when calling APIKeysApi->get_api_key_rate_limits: #{e}"
end
# Setup authorization
VeniceClient.configure do |config|
end

api_instance = VeniceClient::APIKeysApi.new

begin
  #/api/v1/api_keys
  result = api_instance.get_api_keys
  p result
rescue VeniceClient::ApiError => e
  puts "Exception when calling APIKeysApi->get_api_keys: #{e}"
end

api_instance = VeniceClient::APIKeysApi.new
opts = { 
  body: VeniceClient::ApiKeysGenerateWeb3KeyBody.new # ApiKeysGenerateWeb3KeyBody | 
}

begin
  #/api/v1/api_keys/generate_web3_key
  result = api_instance.post_api_key_generate_web3_key(opts)
  p result
rescue VeniceClient::ApiError => e
  puts "Exception when calling APIKeysApi->post_api_key_generate_web3_key: #{e}"
end
# Setup authorization
VeniceClient.configure do |config|
end

api_instance = VeniceClient::AudioApi.new
opts = { 
  body: VeniceClient::CreateSpeechRequestSchema.new # CreateSpeechRequestSchema | 
}

begin
  #/api/v1/audio/speech
  result = api_instance.create_speech(opts)
  p result
rescue VeniceClient::ApiError => e
  puts "Exception when calling AudioApi->create_speech: #{e}"
end
# Setup authorization
VeniceClient.configure do |config|
end

api_instance = VeniceClient::BillingApi.new
opts = { 
  accept: 'accept_example', # String | Accept header to specify the response format
  currency: 'currency_example', # String | 
  end_date: DateTime.parse('2013-10-20T19:20:30+01:00'), # DateTime | 
  limit: 200, # Integer | 
  page: 1, # Integer | 
  sort_order: 'desc', # String | 
  start_date: DateTime.parse('2013-10-20T19:20:30+01:00') # DateTime | 
}

begin
  #/api/v1/billing/usage
  result = api_instance.get_billing_usage(opts)
  p result
rescue VeniceClient::ApiError => e
  puts "Exception when calling BillingApi->get_billing_usage: #{e}"
end
# Setup authorization
VeniceClient.configure do |config|
end

api_instance = VeniceClient::CharactersApi.new

begin
  #/api/v1/characters
  result = api_instance.list_characters
  p result
rescue VeniceClient::ApiError => e
  puts "Exception when calling CharactersApi->list_characters: #{e}"
end
# Setup authorization
VeniceClient.configure do |config|
end

api_instance = VeniceClient::ChatApi.new
opts = { 
  body: VeniceClient::ChatCompletionRequest.new, # ChatCompletionRequest | 
  accept_encoding: 'accept_encoding_example' # String | Supported compression encodings (gzip, br). Only applied when stream is false.
}

begin
  #/api/v1/chat/completions
  result = api_instance.create_chat_completion(opts)
  p result
rescue VeniceClient::ApiError => e
  puts "Exception when calling ChatApi->create_chat_completion: #{e}"
end
# Setup authorization
VeniceClient.configure do |config|
end

api_instance = VeniceClient::EmbeddingsApi.new
body = VeniceClient::CreateEmbeddingRequestSchema.new # CreateEmbeddingRequestSchema | 
opts = { 
  accept_encoding: 'accept_encoding_example' # String | Supported compression encodings (gzip, br)
}

begin
  #/api/v1/embeddings
  result = api_instance.create_embedding(body, opts)
  p result
rescue VeniceClient::ApiError => e
  puts "Exception when calling EmbeddingsApi->create_embedding: #{e}"
end
# Setup authorization
VeniceClient.configure do |config|
end

api_instance = VeniceClient::ImageApi.new
opts = { 
  body: VeniceClient::GenerateImageRequest.new, # GenerateImageRequest | 
  accept_encoding: 'accept_encoding_example' # String | Supported compression encodings (gzip, br). Only applied when return_binary is false.
}

begin
  #/api/v1/image/generate
  result = api_instance.generate_image(opts)
  p result
rescue VeniceClient::ApiError => e
  puts "Exception when calling ImageApi->generate_image: #{e}"
end
# Setup authorization
VeniceClient.configure do |config|
end

api_instance = VeniceClient::ImageApi.new

begin
  #/api/v1/image/styles
  result = api_instance.image_styles_get
  p result
rescue VeniceClient::ApiError => e
  puts "Exception when calling ImageApi->image_styles_get: #{e}"
end
# Setup authorization
VeniceClient.configure do |config|
end

api_instance = VeniceClient::ImageApi.new
opts = { 
  body: VeniceClient::SimpleGenerateImageRequest.new, # SimpleGenerateImageRequest | 
  accept_encoding: 'accept_encoding_example' # String | Supported compression encodings (gzip, br).
}

begin
  #/api/v1/image/generations
  result = api_instance.simple_generate_image(opts)
  p result
rescue VeniceClient::ApiError => e
  puts "Exception when calling ImageApi->simple_generate_image: #{e}"
end
# Setup authorization
VeniceClient.configure do |config|
end

api_instance = VeniceClient::ImageApi.new
opts = { 
  body: VeniceClient::UpscaleImageRequest.new, # UpscaleImageRequest | 
  enhance: VeniceClient::null.new, #  | 
  enhance_creativity: VeniceClient::BigDecimal.new, # BigDecimal | 
  enhance_prompt: 'enhance_prompt_example', # String | 
  image: VeniceClient::null.new, #  | 
  replication: VeniceClient::BigDecimal.new, # BigDecimal | 
  scale: VeniceClient::BigDecimal.new # BigDecimal | 
}

begin
  #/api/v1/image/upscale
  result = api_instance.upscale_image(opts)
  p result
rescue VeniceClient::ApiError => e
  puts "Exception when calling ImageApi->upscale_image: #{e}"
end
# Setup authorization
VeniceClient.configure do |config|
end

api_instance = VeniceClient::ModelsApi.new
opts = { 
  type: 'text' # String | 
}

begin
  #/api/v1/models/compatibility_mapping
  result = api_instance.list_model_compatibility_mapping(opts)
  p result
rescue VeniceClient::ApiError => e
  puts "Exception when calling ModelsApi->list_model_compatibility_mapping: #{e}"
end
# Setup authorization
VeniceClient.configure do |config|
end

api_instance = VeniceClient::ModelsApi.new
opts = { 
  type: 'text' # String | 
}

begin
  #/api/v1/models/traits
  result = api_instance.list_model_traits(opts)
  p result
rescue VeniceClient::ApiError => e
  puts "Exception when calling ModelsApi->list_model_traits: #{e}"
end
# Setup authorization
VeniceClient.configure do |config|
end

api_instance = VeniceClient::ModelsApi.new
opts = { 
  type: VeniceClient::Type.new # Type | 
}

begin
  #/api/v1/models
  result = api_instance.list_models(opts)
  p result
rescue VeniceClient::ApiError => e
  puts "Exception when calling ModelsApi->list_models: #{e}"
end
# Setup authorization
VeniceClient.configure do |config|
end

api_instance = VeniceClient::PreviewApi.new

begin
  #/api/v1/characters
  result = api_instance.list_characters
  p result
rescue VeniceClient::ApiError => e
  puts "Exception when calling PreviewApi->list_characters: #{e}"
end
# Setup authorization
VeniceClient.configure do |config|
end

api_instance = VeniceClient::SpeechApi.new
opts = { 
  body: VeniceClient::CreateSpeechRequestSchema.new # CreateSpeechRequestSchema | 
}

begin
  #/api/v1/audio/speech
  result = api_instance.create_speech(opts)
  p result
rescue VeniceClient::ApiError => e
  puts "Exception when calling SpeechApi->create_speech: #{e}"
end

Documentation for API Endpoints

All URIs are relative to https://api.venice.ai/api/v1

Class Method HTTP request Description
VeniceClient::APIKeysApi create_api_key POST /api_keys /api/v1/api_keys
VeniceClient::APIKeysApi delete_api_key DELETE /api_keys /api/v1/api_keys
VeniceClient::APIKeysApi get_api_key_generate_web3_key GET /api_keys/generate_web3_key /api/v1/api_keys/generate_web3_key
VeniceClient::APIKeysApi get_api_key_rate_limit_logs GET /api_keys/rate_limits/log /api/v1/api_keys/rate_limits/log
VeniceClient::APIKeysApi get_api_key_rate_limits GET /api_keys/rate_limits /api/v1/api_keys/rate_limits
VeniceClient::APIKeysApi get_api_keys GET /api_keys /api/v1/api_keys
VeniceClient::APIKeysApi post_api_key_generate_web3_key POST /api_keys/generate_web3_key /api/v1/api_keys/generate_web3_key
VeniceClient::AudioApi create_speech POST /audio/speech /api/v1/audio/speech
VeniceClient::BillingApi get_billing_usage GET /billing/usage /api/v1/billing/usage
VeniceClient::CharactersApi list_characters GET /characters /api/v1/characters
VeniceClient::ChatApi create_chat_completion POST /chat/completions /api/v1/chat/completions
VeniceClient::EmbeddingsApi create_embedding POST /embeddings /api/v1/embeddings
VeniceClient::ImageApi generate_image POST /image/generate /api/v1/image/generate
VeniceClient::ImageApi image_styles_get GET /image/styles /api/v1/image/styles
VeniceClient::ImageApi simple_generate_image POST /images/generations /api/v1/image/generations
VeniceClient::ImageApi upscale_image POST /image/upscale /api/v1/image/upscale
VeniceClient::ModelsApi list_model_compatibility_mapping GET /models/compatibility_mapping /api/v1/models/compatibility_mapping
VeniceClient::ModelsApi list_model_traits GET /models/traits /api/v1/models/traits
VeniceClient::ModelsApi list_models GET /models /api/v1/models
VeniceClient::PreviewApi list_characters GET /characters /api/v1/characters
VeniceClient::SpeechApi create_speech POST /audio/speech /api/v1/audio/speech

Documentation for Models

Documentation for Authorization

BearerAuth