Quick Start
Get up and running with the HiveForge SDK in under 5 minutes.
1. Install the SDK
npm install @producthacker/hiveforge-sdk2. Get your credentials
You need two values from the HiveForge dashboard:
- Deployment ID -- Found in your deployment settings
- Deployment Secret -- Generated when your deployment is created
⚠️
Keep your deployment secret safe. Never commit it to source control or expose it in client-side code.
3. Initialize the client
import { HiveForgeClient } from '@producthacker/hiveforge-sdk'
const client = new HiveForgeClient({
deploymentId: process.env.HIVEFORGE_DEPLOYMENT_ID!,
deploymentSecret: process.env.HIVEFORGE_DEPLOYMENT_SECRET!,
baseUrl: 'https://api.hiveforge.dev',
})4. Check entitlements
Before making feature calls, verify what your deployment tier allows:
const entitlements = await client.getEntitlements()
console.log(entitlements)
// {
// tier: "launch",
// ai_enabled: true,
// ai_monthly_limit: 10000,
// billing_enabled: true
// }5. Make an AI completion request
Use the AI proxy to make completion requests that are automatically metered against your tier limits:
const response = await client.ai.complete({
model: 'gpt-4o-mini',
messages: [
{ role: 'system', content: 'You are a helpful assistant.' },
{ role: 'user', content: 'Explain what HiveForge does in one sentence.' },
],
max_tokens: 256,
})
console.log(response.choices[0].message.content)6. Stream responses
For real-time streaming:
const stream = await client.ai.stream({
model: 'gpt-4o-mini',
messages: [
{ role: 'user', content: 'Write a haiku about SaaS.' },
],
})
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content ?? '')
}Full example
Here is a complete working example:
import { HiveForgeClient } from '@producthacker/hiveforge-sdk'
async function main() {
const client = new HiveForgeClient({
deploymentId: process.env.HIVEFORGE_DEPLOYMENT_ID!,
deploymentSecret: process.env.HIVEFORGE_DEPLOYMENT_SECRET!,
baseUrl: 'https://api.hiveforge.dev',
})
// Check what your tier allows
const entitlements = await client.getEntitlements()
console.log('Tier:', entitlements.tier)
if (!entitlements.ai_enabled) {
console.log('AI is not enabled on this tier. Upgrade to use AI features.')
return
}
// Make an AI request
const response = await client.ai.complete({
model: 'gpt-4o-mini',
messages: [
{ role: 'user', content: 'Hello from HiveForge!' },
],
})
console.log('Response:', response.choices[0].message.content)
}
main()Next steps
- Authentication -- Learn about JWT, API keys, and deployment credentials
- API Reference -- Full API endpoint documentation
- Entitlements & Tiers -- Understand feature gating by tier
- MCP Integration -- Connect AI tools via Model Context Protocol