Skip to content

API Keys Setup

OpenSNS supports multiple AI providers. This guide covers how to get and configure API keys.

ProviderFeaturesPricing
OpenAIGPT-4 for text generationPay-per-use
Fal.aiFast image/video generationPay-per-use
OllamaLocal LLM (free)Free (self-hosted)
ComfyUILocal image generationFree (self-hosted)
  1. Go to platform.openai.com
  2. Sign in or create an account
  3. Navigate to API Keys section
  4. Click “Create new secret key”
  5. Copy the key (starts with sk-)

Set keys in backend/.env for all users:

backend/.env
OPENAI_API_KEY=sk-your-openai-key
FAL_KEY=your-fal-key

Each user can configure their own keys:

  1. Log in to OpenSNS
  2. Go to Settings
  3. Enter your API keys
  4. Click Save Settings

OpenSNS encrypts all stored API keys using Fernet (AES-128):

  • Keys are encrypted before storage
  • Only the key owner can use them
  • Keys are never exposed in API responses
  • UI shows only “configured” status, never the actual key

After configuring keys, test they work:

  1. Go to Settings
  2. Click Test Connection
  3. Shows status for each configured provider

For privacy or cost savings, use local AI:

Terminal window
# Install Ollama
curl -fsSL https://ollama.ai/install.sh | sh
# Pull a model
ollama pull llama2
# Configure OpenSNS
OLLAMA_URL=http://localhost:11434
DEFAULT_LLM_ENGINE=ollama
  1. Install ComfyUI
  2. Start the server
  3. Configure:
Terminal window
COMFYUI_URL=http://localhost:8188
DEFAULT_IMAGE_ENGINE=comfyui

Without API keys, OpenSNS uses “fallback mode”:

  • Text generation returns placeholder copy
  • Images use product images from scraping
  • Videos use source images

This is useful for testing the workflow without incurring costs.

Once you have OpenSNS running locally, interactive API documentation is available:

These are auto-generated from the FastAPI backend and always up-to-date.

Generate ad creatives from any product URL. Open source, self-hostable, free tier available.

Try OpenSNS Free →