Documentation

🔑OpenRouter Setup Guide

Connect to 400+ AI models from 60+ providers through OpenRouter's unified API

← Back to Documentation

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:

  • Unified Access: One API for 400+ models from 60+ providers
  • Transparent Pricing: Pay only for what you use with clear, upfront costs
  • High Availability: Distributed infrastructure with automatic failover
  • No Vendor Lock-in: Freedom to use any model from any provider
  • OpenAI Compatibility: Drop-in replacement for existing OpenAI integrations
  • 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

          Step 2: Generate Your API Key

          • 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 sk-or- - Copy it immediately - it won't be shown again - Store it securely - this key provides access to your account

                • Set Usage Limits (Optional)
                • - Configure spending limits for safety - Set up alerts for usage thresholds - Monitor your usage in real-time

                  Step 3: Add Credits to Your Account

                  • 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

                        Step 4: Configure HiveTechs

                        $3

                        • Install HiveTechs
                        • ``bash npm install -g @hivetechs/hive-ai `

                          • Run Quickstart
                          • `bash hive 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

                              $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

                              • Test the Connection
                              • `bash hive test `

                                • Check Available Models
                                • `bash hive models `

                                  • Run Your First Query
                                  • `bash hive "What is the meaning of life?" `

                                    Security Best Practices

                                    $3

                                  • 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

                                  $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

                                • • Verify your key starts with sk-or-
                                • • Check for extra spaces or characters
                                • • Ensure the key hasn't been revoked

                                "Insufficient Credits" Error

                              • • Check your credit balance at OpenRouter.ai
                              • • Add more credits through the billing page
                              • • Consider setting up auto-recharge

                              "Model Not Found" Error

                            • • Some models require special access
                            • • Check model availability at OpenRouter.ai/models
                            • • Try using a different model

                            $3

                            • HiveTechs Support: support@hivetechs.io
                            • OpenRouter Docs: openrouter.ai/docs
                            • Community Discord: Join our Discord for real-time help

                            Advanced Configuration

                            $3

                            `bash

                            Use a specific model

                            hive --model="anthropic/claude-3-opus" "Your question here"

                            List all available models

                            hive models --all

                            Search for models

                            hive models --search "gpt"
                            `

                            $3

                            `bash

                            Enable automatic cost optimization

                            hive config set optimization.enabled true

                            Set maximum cost per query

                            hive config set optimization.maxCost 0.10

                            Prefer faster models

                            hive config set optimization.preferSpeed true
                            `

                            $3

                            `bash

                            Check current usage

                            hive usage

                            View usage history

                            hive usage --history

                            Export usage data

                            hive usage --export usage-report.csv
                            `

                            Integration Examples

                            $3

                            `python from hive import HiveClient

                            client = 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:

                            • 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

                            ---

                            Need Help? Contact us at support@hivetechs.io or visit our Support Center

    Ready to Get Started?

    Set up your OpenRouter account and start accessing 400+ AI models with HiveTechs

    Start free trial