OpenRouter Setup Guide
Overview
HiveTechs is powered by OpenRouter's unified infrastructure, providing access to 400+ AI models from 60+ providers. This guide will walk you through setting up your OpenRouter account and configuring HiveTechs to use your API key.
Why OpenRouter?
OpenRouter provides:
Step 1: Create Your OpenRouter Account
- Visit OpenRouter - Go to OpenRouter.ai - Click "Sign Up" in the top right corner
- Choose Your Sign-Up Method - Google (recommended for quick setup) - GitHub - Email/Password
- Complete Registration - No credit card required to start - You'll receive $1 in free credits for testing - Verify your email if you signed up with email/password
- Access Your Dashboard - After signing in, click on your profile icon - Select "Dashboard" from the dropdown
- Create a New API Key - Navigate to the "API Keys" section - Click "Create Key" - Give your key a descriptive name (e.g., "HiveTechs Production")
- Copy Your API Key - Your key will start with
- Set Usage Limits (Optional) - Configure spending limits for safety - Set up alerts for usage thresholds - Monitor your usage in real-time
- Navigate to Billing - Click "Credits" in your dashboard - View your current balance
- Add Credits - Click "Add Credits" - Choose your amount ($5, $10, $25, $50, or custom) - Complete payment via Stripe
- Understanding Costs - Each model has different pricing - View detailed pricing at OpenRouter.ai/models - HiveTechs automatically optimizes for cost/performance
- Install HiveTechs ``
- Run Quickstart
- Enter Your Credentials - Paste your OpenRouter API key when prompted - Enter your HiveTechs license key - Follow prompts to complete setup - Configuration is saved securely
- Test the Connection
- Check Available Models
- Run Your First Query
- • Never commit API keys to version control
- • Use environment variables for production deployments
- • Rotate keys regularly through the OpenRouter dashboard
- • Monitor usage for any unusual activity
- • Verify your key starts with
- • Check for extra spaces or characters
- • Ensure the key hasn't been revoked
- • Check your credit balance at OpenRouter.ai
- • Add more credits through the billing page
- • Consider setting up auto-recharge
- • Some models require special access
- • Check model availability at OpenRouter.ai/models
- • Try using a different model
- • HiveTechs Support: support@hivetechs.io
- • OpenRouter Docs: openrouter.ai/docs
- • Community Discord: Join our Discord for real-time help
- Explore the Models: Browse available models at openrouter.ai/models
- Read the Docs: Deep dive into our Consensus Pipeline
- Join the Community: Connect with other users in our Discord
- Build Something Amazing: Start integrating HiveTechs into your projects
Step 2: Generate Your API Key
sk-or-
- Copy it immediately - it won't be shown again
- Store it securely - this key provides access to your accountStep 3: Add Credits to Your Account
Step 4: Configure HiveTechs
$3
bash
npm install -g @hivetechs/hive-ai
`
`bash
hive quickstart
`$3
If you prefer manual setup, create a
.hive/config.json file:
`json
{
"openrouter": {
"apiKey": "sk-or-your-api-key-here"
},
"license": "HIVE-XXXX-XXXX-XXXX-XXXX"
}
`Step 5: Verify Your Setup
`bash
hive test
`
`bash
hive models
`
`bash
hive "What is the meaning of life?"
`Security Best Practices
$3
$3
`bash
export OPENROUTER_API_KEY="sk-or-your-api-key-here"
export HIVE_LICENSE_KEY="HIVE-XXXX-XXXX-XXXX-XXXX"
`$3
`
.hive/
.env
*.key
config.local.json
`Troubleshooting
$3
"Invalid API Key" Error
sk-or-
"Insufficient Credits" Error
"Model Not Found" Error
$3
Advanced Configuration
$3
`bash
Use a specific model
hive --model="anthropic/claude-3-opus" "Your question here"List all available models
hive models --allSearch for models
hive models --search "gpt"
`$3
`bash
Enable automatic cost optimization
hive config set optimization.enabled trueSet maximum cost per query
hive config set optimization.maxCost 0.10Prefer faster models
hive config set optimization.preferSpeed true
`$3
`bash
Check current usage
hive usageView usage history
hive usage --historyExport usage data
hive usage --export usage-report.csv
`Integration Examples
$3
`python
from hive import HiveClientclient = HiveClient(
openrouter_key="sk-or-your-key",
license_key="HIVE-XXXX"
)
response = client.consensus("What is quantum computing?")
print(response.answer)
`$3
`javascript
const { HiveClient } = require('@hivetechs/hive-ai');const client = new HiveClient({
openrouterKey: process.env.OPENROUTER_API_KEY,
licenseKey: process.env.HIVE_LICENSE_KEY
});
const response = await client.consensus('Explain machine learning');
console.log(response.answer);
``Next Steps
Now that you're set up with OpenRouter and HiveTechs:
---
Need Help? Contact us at support@hivetechs.io or visit our Support Center