Project

hinow-ai

0.0
The project is in a healthy, maintained state
Ruby client library for HINOW AI - Access LLMs, image generation, TTS, STT, video generation, and embeddings.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Runtime

 Project Readme

HINOW Ruby SDK

Official Ruby SDK for the HINOW AI Inference API.

Installation

gem install hinow-ai

Or add to your Gemfile:

gem 'hinow-ai'

Quick Start

require 'hinow'

client = Hinow::Client.new(api_key: 'hi_your_api_key')

# Chat completion
response = client.chat.completions.create(
  model: 'deepseek-ai/deepseek-v3.2',
  messages: [{ role: 'user', content: 'Hello!' }],
  temperature: 0.7
)

puts response['choices'][0]['message']['content']

Configuration

Global Configuration

Hinow.configure do |config|
  config.api_key = 'hi_your_api_key'
  config.base_url = 'https://api.hinow.ai'
  config.timeout = 120
end

# Then use the global client
response = Hinow.client.chat.completions.create(...)

Environment Variable

export HINOW_API_KEY=hi_your_api_key
client = Hinow::Client.new  # Uses HINOW_API_KEY

Features

Chat Completions

response = client.chat.completions.create(
  model: 'deepseek-ai/deepseek-v3.2',
  messages: [
    { role: 'system', content: 'You are a helpful assistant.' },
    { role: 'user', content: 'What is the capital of France?' }
  ],
  temperature: 0.7,
  max_tokens: 1000
)

Function Calling

response = client.chat.completions.create(
  model: 'deepseek-ai/deepseek-v3.2',
  messages: [{ role: 'user', content: "What's the weather in Paris?" }],
  tools: [{
    type: 'function',
    function: {
      name: 'get_weather',
      description: 'Get the current weather in a city',
      parameters: {
        type: 'object',
        properties: {
          location: { type: 'string', description: 'City name' }
        },
        required: ['location']
      }
    }
  }]
)

if response['choices'][0]['message']['tool_calls']
  response['choices'][0]['message']['tool_calls'].each do |tool_call|
    puts "Function: #{tool_call['function']['name']}"
    puts "Arguments: #{tool_call['function']['arguments']}"
  end
end

Image Generation

response = client.images.generate(
  model: 'dall-e-3',
  prompt: 'A beautiful sunset over mountains',
  size: '1024x1024',
  quality: 'hd'
)

response['data']['urls'].each { |url| puts "Image URL: #{url}" }

Text to Speech

response = client.audio.speech(
  model: 'tts-1',
  input: 'Hello, how are you today?',
  voice: 'alloy',
  speed: 1.0
)

response['data']['urls'].each { |url| puts "Audio URL: #{url}" }

Speech to Text

response = client.audio.transcribe(
  model: 'whisper-1',
  file: '/path/to/audio.mp3',
  language: 'en'
)

puts "Transcription: #{response['data']['text']}"

Video Generation

response = client.video.generate(
  model: 'video-model',
  prompt: 'A cat playing piano',
  duration: 5,
  resolution: '1080p'
)

response['data']['urls'].each { |url| puts "Video URL: #{url}" }

Embeddings

response = client.embeddings.create(
  model: 'text-embedding-ada-002',
  input: 'Hello world'
)

embedding = response['data'][0]['embedding']
puts "Embedding dimensions: #{embedding.length}"

List Models

response = client.models.list
response['data'].each { |model| puts "Model: #{model['id']}" }

Check Balance

balance = client.get_balance
puts "Balance: #{balance['data']['balance']} #{balance['data']['currency']}"

Error Handling

begin
  response = client.chat.completions.create(...)
rescue Hinow::Error => e
  puts "Error: #{e.message}"
  puts "Status code: #{e.status_code}"
end

Links

License

MIT License