Skip to main content

Quick Start

Get your first LLM request through ModelHive in under 2 minutes.

Prerequisites​

  • A ModelHive account (sign up here)
  • An API key (created from the dashboard)

Step 1: Get Your API Key​

After signing up and completing onboarding:

  1. Go to Dashboard → API Keys
  2. Click Create New Key
  3. Set a name, budget, and optionally restrict to specific models
  4. Copy your API key (starts with sk-)
warning

Store your API key securely. It will only be shown once at creation time.

Step 2: Make Your First Request​

ModelHive is fully OpenAI-compatible. Use any OpenAI SDK or HTTP client.

from openai import OpenAI

client = OpenAI(
api_key="sk-your-modelhive-key",
base_url="https://api.modelhive.ai/v1"
)

response = client.chat.completions.create(
model="gpt-4o",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is semantic caching?"}
]
)

print(response.choices[0].message.content)

Step 3: Verify It Worked​

Check your response. You'll notice ModelHive enriches the response with metadata:

{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"model": "gpt-4o",
"choices": [...],
"usage": {
"prompt_tokens": 25,
"completion_tokens": 150,
"total_tokens": 175
},
"_modelhive": {
"cache_status": "MISS",
"cost_estimate": 0.0032,
"guardrails_passed": true
}
}

Step 4: Try a Cached Request​

Make the same request again — this time HiveCache will detect the semantic similarity:

# Same request → HiveCache DIRECT hit
curl -X POST https://api.modelhive.ai/v1/chat/completions \
-H "Authorization: Bearer sk-your-modelhive-key" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is semantic caching?"}
]
}'

The response will include "cache_status": "DIRECT" — served instantly from cache at a fraction of the cost.

What's Next?​

  • Authentication — Learn about JWT tokens and API key authentication
  • HiveCache — Deep dive into the semantic cache engine
  • HiveState — Adaptive state compression for long conversations
  • HiveRoute — Intelligent model routing based on task complexity
  • Guardrails — Configure security protections for your LLM calls
  • API Reference — Browse the complete API endpoint documentation