Get started with Nuntius in minutes.
- Ruby 3.3 or higher
- Google AI API key from Google AI Studio
Install the gem:
gem install nuntius-rb --preOr add to Gemfile:
gem 'nuntius-rb', require: 'nuntius'Create an API key in Google AI Studio, then keep it outside source control.
Create .env file:
echo "GEMINI_API_KEY=your_api_key_here" > .envReplace with your actual key.
Create a Ruby file:
require 'nuntius'
client = Nuntius::Client.new
response = client.generate_text("Hello, world!")
puts responseRun it:
ruby your_file.rbTest with the repo CLI:
./bin/gemini testIt should print a short success response when the API key is valid.
Creative content:
response = client.generate_text(
"Write a story",
temperature: 0.8
)Conversation:
messages = [
{ role: 'user', content: 'What is Ruby?' }
]
response = client.chat(messages)Interactive chat:
./bin/gemini chat- API key required: Check
.envfile - Invalid key: Ensure starts with
AIza - CLI permission: Run
chmod +x bin/gemini