Overview

Bluma provides separate test and production environments to help you develop and test your integration safely before going live.

Test Environment

Free unlimited testing
  • Watermarked videos
  • Lower quality rendering
  • No credit charges
  • Same API functionality

Production Environment

Production-ready videos
  • Full-quality rendering
  • No watermarks
  • Credits charged
  • Priority processing

Key Differences

FeatureTest ModeProduction Mode
API Keysbluma_test_*bluma_live_*
Video QualityLower (720p max)Full (up to 4K)
Watermark”TEST MODE” overlayNone
CreditsFree (unlimited)Charged per video
Rate LimitsSame as your tierSame as your tier
Processing SpeedSlower (low priority)Fast (high priority)
WebhooksFully functionalFully functional
API Functionality100% identical100% identical
Test and production environments have identical APIs. Code that works in test will work in production.

Test Environment

Purpose

Test mode is designed for:
  • ✅ Development and debugging
  • ✅ Integration testing
  • ✅ Experimenting with templates
  • ✅ Training and demos
  • ✅ CI/CD pipeline testing

Limitations

Test videos include a “TEST MODE” watermark and are rendered at lower quality. Never use test videos for production content.
Quality Restrictions:
  • Maximum resolution: 720p (even if you request 1080p or 4K)
  • Lower bitrate encoding
  • Reduced frame rate (24fps vs 30fps)
  • No priority processing
Feature Restrictions:
  • ❌ No custom branding
  • ❌ No priority support
  • ❌ No SLA guarantees

Getting Test API Keys

Test keys are available on all plans (including Free):
# Create a test API key
curl -X POST https://api.getbluma.com/api/v1/api-keys \
  -H "Authorization: Bearer YOUR_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Development Key",
    "environment": "test"
  }'
Response:
{
  "id": "key_abc123",
  "key": "bluma_test_a1b2c3d4e5f6g7h8i9j0",
  "name": "Development Key",
  "environment": "test",
  "created_at": "2025-11-03T10:30:00Z"
}
You can have unlimited test API keys. Create separate keys for different environments (local dev, staging, CI/CD).

Using Test Keys

Simply swap your API key:
// Development
const API_KEY = process.env.BLUMA_TEST_KEY; // bluma_test_...

// Same code works identically
const response = await fetch('https://api.getbluma.com/api/v1/videos', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${API_KEY}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    template_id: 'meme-dialogue',
    context: { prompt: 'Test video' }
  })
});

Production Environment

Purpose

Production mode is for:
  • ✅ Live applications
  • ✅ Customer-facing content
  • ✅ High-quality video generation
  • ✅ Branded content
  • ✅ Commercial use

Benefits

Full Quality:
  • Up to 4K resolution
  • High bitrate encoding
  • 30fps rendering
  • Priority processing (2-3x faster)
No Limitations:
  • ✅ Custom branding
  • ✅ White-label support
  • ✅ Priority customer support
  • ✅ SLA guarantees (Enterprise)

Getting Production API Keys

Production keys require a paid plan:
  1. Upgrade your account at getbluma.com/billing
  2. Create production key:
curl -X POST https://api.getbluma.com/api/v1/api-keys \
  -H "Authorization: Bearer YOUR_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Production Key",
    "environment": "production"
  }'
Response:
{
  "id": "key_xyz789",
  "key": "bluma_live_x1y2z3a4b5c6d7e8f9g0",
  "name": "Production Key",
  "environment": "production",
  "created_at": "2025-11-03T10:30:00Z"
}
Production keys consume credits. Monitor your usage at getbluma.com/brand/api-usage.

Switching from Test to Production

Step 1: Test Thoroughly

Before switching to production:
1

Test All Templates

Generate videos with every template you plan to use
2

Test Error Handling

Verify your code handles errors gracefully (invalid inputs, rate limits, etc.)
3

Test Webhooks

If using webhooks, verify signature verification and event handling
4

Load Test

Test with realistic volumes to ensure you’re within rate limits
5

Review Output

Verify video quality and content meet your requirements (ignore watermark)

Step 2: Upgrade Your Plan

If you’re on the Free tier, upgrade to a paid plan:
  1. Go to getbluma.com/billing
  2. Select a plan (Starter, Pro, or Enterprise)
  3. Complete payment setup

Step 3: Create Production API Key

# Create production key
curl -X POST https://api.getbluma.com/api/v1/api-keys \
  -H "Authorization: Bearer YOUR_SESSION_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Production Key - Main App",
    "environment": "production"
  }'
Save the key securely - you won’t see it again.

Step 4: Update Environment Variables

Update your environment configuration:
# .env.production
BLUMA_API_KEY=bluma_live_x1y2z3a4b5c6d7e8f9g0

# Or use separate variables
BLUMA_TEST_KEY=bluma_test_...
BLUMA_LIVE_KEY=bluma_live_...

Step 5: Update Your Code (Optional)

If you want environment-based switching:
// config.js
const environment = process.env.NODE_ENV || 'development';

const config = {
  development: {
    apiKey: process.env.BLUMA_TEST_KEY,
    apiUrl: 'https://api.getbluma.com/api/v1'
  },
  production: {
    apiKey: process.env.BLUMA_LIVE_KEY,
    apiUrl: 'https://api.getbluma.com/api/v1'
  }
};

export default config[environment];
// api-client.js
import config from './config.js';

async function generateVideo(templateId, context) {
  const response = await fetch(`${config.apiUrl}/videos`, {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${config.apiKey}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({ template_id: templateId, context })
  });

  return response.json();
}

Step 6: Deploy and Monitor

1

Deploy to Production

Deploy your application with the production API key
2

Generate Test Video

Generate one video to verify production key works correctly
3

Monitor Usage

Watch usage dashboard for any issues
4

Set Up Alerts

Configure webhook alerts for credits.low and credits.exhausted events

Environment-Based Configuration

Node.js Example

// config/bluma.js
export const blumaConfig = {
  apiKey: process.env.BLUMA_API_KEY,
  apiUrl: 'https://api.getbluma.com/api/v1',
  environment: process.env.BLUMA_ENVIRONMENT || 'test'
};

// Validation
if (!blumaConfig.apiKey) {
  throw new Error('BLUMA_API_KEY environment variable is required');
}

if (blumaConfig.environment === 'production' &&
    blumaConfig.apiKey.startsWith('bluma_test_')) {
  throw new Error('Cannot use test API key in production environment');
}

if (blumaConfig.environment === 'test' &&
    blumaConfig.apiKey.startsWith('bluma_live_')) {
  console.warn('⚠️  Warning: Using production API key in test environment (will consume credits)');
}

Python Example

# config.py
import os

class BlumaConfig:
    API_KEY = os.getenv('BLUMA_API_KEY')
    API_URL = 'https://api.getbluma.com/api/v1'
    ENVIRONMENT = os.getenv('BLUMA_ENVIRONMENT', 'test')

    @classmethod
    def validate(cls):
        if not cls.API_KEY:
            raise ValueError('BLUMA_API_KEY environment variable is required')

        if cls.ENVIRONMENT == 'production' and cls.API_KEY.startswith('bluma_test_'):
            raise ValueError('Cannot use test API key in production')

        if cls.ENVIRONMENT == 'test' and cls.API_KEY.startswith('bluma_live_'):
            print('⚠️  Warning: Using production API key in test (will consume credits)')

# Validate on import
BlumaConfig.validate()

API Key Management

Separate Keys for Different Purposes

Local Development

Test key for local developmentbluma_test_local_dev

CI/CD Pipeline

Test key for automated testsbluma_test_ci_cd

Staging Environment

Test or production key for stagingbluma_test_staging

Production

Production key for live appbluma_live_production

Naming Convention

Use descriptive names to identify keys:
# Good naming
"Production - Main App"
"Test - Local Development"
"Test - GitHub Actions CI"
"Production - Background Jobs"

# Poor naming
"Key 1"
"New Key"
"Test"

Key Rotation

Regularly rotate production keys for security:
# 1. Create new production key
curl -X POST https://api.getbluma.com/api/v1/api-keys \
  -H "Authorization: Bearer YOUR_SESSION_TOKEN" \
  -d '{"name": "Production Key (2025-11)", "environment": "production"}'

# 2. Update your application with new key
# 3. Deploy updated application
# 4. Delete old key

curl -X DELETE https://api.getbluma.com/api/v1/api-keys/key_old123 \
  -H "Authorization: Bearer YOUR_SESSION_TOKEN"
Rotate keys quarterly or after any security incident.

Credit Usage

Test Environment

  • Zero credits consumed
  • Unlimited video generation
  • ✅ All features available (except full quality)

Production Environment

Credits are consumed per video based on:
  • Template complexity
  • Resolution (720p, 1080p, 4K)
  • Duration
  • AI features used
See Credits documentation for detailed pricing.

Monitoring Credit Usage

# Check current balance
curl https://api.getbluma.com/api/v1/credits/balance \
  -H "Authorization: Bearer YOUR_API_KEY"
Response:
{
  "credits": 88,
  "tier": "pro",
  "monthly_allowance": 500,
  "overage_used": 0,
  "reset_date": "2025-12-01T00:00:00Z"
}

Setting Up Credit Alerts

# Get notified when credits run low
curl -X POST https://api.getbluma.com/api/v1/webhooks \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "url": "https://yourapp.com/webhooks/bluma",
    "events": ["credits.low", "credits.exhausted"]
  }'

Rate Limits

Test and production keys share the same rate limits based on your account tier.
TierRequests/HourBurst Limit
Free10010
Starter1,00050
Pro5,000100
Enterprise50,000500
This applies to both test and production keys. If you need separate rate limits, upgrade to Enterprise and request custom configuration.

Common Mistakes to Avoid

❌ Using Production Keys in Test

// ❌ DON'T DO THIS
const API_KEY = 'bluma_live_x1y2z3...'; // Production key

// Testing in development
await generateVideo('meme-dialogue', { prompt: 'Test' });
// This will consume real credits!
Fix: Always use test keys for development:
// ✅ CORRECT
const API_KEY = process.env.BLUMA_API_KEY; // bluma_test_... in development

❌ Hardcoding API Keys

// ❌ NEVER DO THIS
const API_KEY = 'bluma_live_x1y2z3a4b5c6d7e8f9g0';
Fix: Always use environment variables:
// ✅ CORRECT
const API_KEY = process.env.BLUMA_API_KEY;

❌ Committing Keys to Git

# ❌ DON'T DO THIS
git add .env
git commit -m "Add API keys"
Fix: Add to .gitignore:
# .gitignore
.env
.env.local
.env.production

Best Practices

Environment Variables

Store keys in environment variables, never in code

Separate Keys

Use different keys for dev, staging, and production

Test First

Always test changes in test environment before deploying

Monitor Usage

Set up dashboards and alerts for production usage

Rotate Keys

Regularly rotate production keys for security

Document Keys

Maintain documentation of which keys are used where

Checklist for Going to Production

Use this checklist before launching:
  • Thoroughly tested all templates in test environment
  • Implemented error handling for all API calls
  • Set up webhook signature verification
  • Configured environment-based API key selection
  • Added API keys to environment variables (not hardcoded)
  • Added .env files to .gitignore
  • Upgraded to a paid plan
  • Created production API key
  • Set up credit usage monitoring
  • Configured webhook alerts for low credits
  • Tested production key with single video
  • Documented key rotation procedure
  • Set up monitoring/logging for API calls
  • Configured rate limit handling
  • Reviewed security best practices
  • Prepared rollback plan

Troubleshooting

Cause: Still using a test API keyCheck:
echo $BLUMA_API_KEY
# Should start with bluma_live_, not bluma_test_
Fix: Ensure you’re using a production key (bluma_live_*)
Cause: Not enough credits remainingCheck balance:
curl https://api.getbluma.com/api/v1/credits/balance \
  -H "Authorization: Bearer YOUR_API_KEY"
Fix:
Possible causes:
  • Key was deleted
  • Typo in API key
  • Missing Bearer prefix
Test:
curl https://api.getbluma.com/api/v1/credits/balance \
  -H "Authorization: Bearer YOUR_TEST_KEY"
If you get 401, create a new test key.
The API is identical in test and production. Only differences are:
  • Video quality (test is lower)
  • Watermark (test has it)
  • Credits (test is free)
  • Processing speed (production is faster)
If you’re seeing API behavior differences, check:
  • Environment variables
  • Network/firewall differences
  • Rate limiting

Next Steps

Summary

  • Test environment is free, unlimited, but produces watermarked lower-quality videos
  • Production environment requires a paid plan but produces full-quality videos
  • APIs are identical - code tested in test will work in production
  • Use environment variables to manage keys and switch between environments
  • Monitor usage in production to avoid unexpected credit consumption