Skip to main content

PromptsLive

GATEWAY
Documentation

How to Use PromptsLive

PromptsLive is an AI content safety gateway proxy. It sits between your application and AI model providers (OpenAI, Anthropic, Gemini, OpenRouter, Groq), applying moderation, blacklist filtering, and telemetry monitoring on every request before forwarding it to the upstream model.

Architecture

Requests flow through a sequential pipeline:

  1. Authenticate โ€” Validate the Bearer pl_live_... token against your project.
  2. Local Blacklist โ€” Scan prompt text for blocked phrases (exact substring match).
  3. OpenAI Moderation API โ€” Send content to OpenAI's moderation endpoint for category scoring.
  4. Category Rules โ€” Map each flagged category to PASS, BLOCK, or REDACT.
  5. Provider Routing โ€” Resolve the model to a provider key, select the correct upstream API, and forward the request.
  6. Telemetry โ€” Log request/response metadata to D1 for analytics.

Getting Started

1. Create a Project

In the Dashboard, click the project dropdown and select + New Project. Give it a name โ€” a unique pl_live_... token is generated automatically. This token is what your application uses to authenticate API requests.

2. Configure API Keys

Navigate to the Settings tab. Enter your provider API keys:

  • OpenAI Key โ€” for gpt-4o, gpt-4o-mini, o1, o3 models
  • Anthropic Key โ€” for claude-3-opus, claude-3-sonnet, claude-3-haiku
  • Gemini Key โ€” for gemini-2.5-pro, gemini-2.5-flash
  • OpenRouter Key โ€” universal proxy for openai/*, anthropic/*, and unknown models
  • Groq Key โ€” for llama-*, mixtral-*, deepseek-* models

The gateway auto-resolves the correct key based on the model in each request. Click Save Global Credentials to persist them to D1.

3. Select a Default Model

In Settings, choose a model from the dropdown or select Other (custom) to enter any model identifier. The selected model pre-populates the Test Gateway drawer. Model selection persists across page reloads.

API Reference

Proxy Endpoint

POST /api/v1/chat/completions
Authorization: Bearer pl_live_<your-project-token>
Content-Type: application/json

{
  "model": "gpt-4o",
  "messages": [{"role": "user", "content": "Hello, world!"}],
  "stream": true
}

Request Format

The endpoint accepts the OpenAI Chat Completions API format. Key fields:

  • model โ€” any supported model identifier (see Settings for the full list)
  • messages โ€” array of {role, content} objects
  • stream โ€” set to true for SSE streaming (recommended)

Response Format

Responses are OpenAI-compatible. Streamed responses use Server-Sent Events (SSE):

data: {"choices":[{"delta":{"content":"Hello"}}]}
data: {"choices":[{"delta":{"content":" world"}}]}
data: [DONE]

Error Responses

  • 400 โ€” missing token, invalid model, or content blocked by rules
  • 401 โ€” invalid or expired pl_live_... token
  • 500 โ€” upstream provider error or internal failure

Rules Matrix

The Rules Matrix tab lets you configure safety policies per project. Each OpenAI moderation category (harassment, hate, violence, etc.) can be set to:

  • PASS โ€” allow the request through
  • BLOCK โ€” reject with a policy violation message
  • REDACT โ€” strip violating content and forward the rest

Blacklist

Add exact-match phrases to the project blacklist. Any prompt containing a blacklisted string is blocked before reaching the moderation API. Useful for company-specific prohibited terms or prompt injection patterns.

Test Gateway Playground

Click the Test Gateway button in the dashboard header to open the playground drawer. It lets you send test payloads through your active rules matrix to verify behavior before integrating the API.

  • Model โ€” select from common models or the one set in Settings
  • Project โ€” picks your project automatically (auto-fills the gateway key)
  • Test Payload โ€” type a prompt to test against your rules
  • Real-time Streaming โ€” tokens appear as they arrive; click Stop to cancel
  • Routing Indicator โ€” shows which provider API was used (OpenAI, Anthropic, etc.)

Press Ctrl+Enter to send.

Multi-Provider Routing

PromptsLive auto-routes requests to the correct provider based on the model name:

Model PatternProviderAPI Endpoint
gpt-*, o1, o3OpenAIapi.openai.com
claude-*Anthropicapi.anthropic.com
gemini-*Geminigenerativelanguage.googleapis.com
openai/*, anthropic/*OpenRouteropenrouter.ai
llama-*, mixtral-*, deepseek-*Groqapi.groq.com
(unknown)OpenRouteropenrouter.ai

Unknown models default to OpenRouter, which acts as a universal proxy for 200+ models. For Anthropic models, PromptsLive automatically translates the request/response between OpenAI and Anthropic formats.

Settings

The Settings tab stores global workspace configuration:

  • Default Model โ€” the model pre-populated in the Test Gateway. Persists to D1.
  • Provider Keys โ€” API keys for each provider. Masked by default; toggle Show/Hide to reveal.
  • Save Global Credentials โ€” persists all keys + model to the D1 database.

Telemetry & Logging

Overview Tab

Displays aggregate stats (total, blocked, redacted, success) for the selected project, plus an hourly timeline of request activity.

Streaming Logs

Live tail of all proxy requests with status, trigger reasons, and prompt previews. Filterable by status and searchable by content.

Zero-Retention Mode

When editing a project, enable zero-retention to prevent storing full request/response text in telemetry logs. Only metadata (status, timestamp, prompt preview) is retained.