Playground

Interactive prompt testing with real-time streaming, multi-model comparison, and run history.

Enterprise feature

The Playground requires an Enterprise plan.

Overview

The Playground lets you test prompts against any configured provider directly through Ingate. It supports real-time SSE streaming, side-by-side model comparison, parameter tuning, and automatic run history persistence.

Run a Prompt

POST
/api/v1/playground/run

Execute a prompt. Supports streaming via SSE. Requires member role.

bash
curl -X POST https://api.ingateai.com/api/v1/playground/run \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "provider": "openai",
    "model": "gpt-4o-mini",
    "prompt_text": "Explain quantum computing in one sentence.",
    "parameters": {"temperature": 0.7, "max_tokens": 100},
    "stream": false
  }'

Streaming Mode

Set stream: true to receive SSE (Server-Sent Events) chunks in real time. The response streams data: events for each token, an event: done when complete, and event: error on failure.

Prompt from Registry

You can reference a prompt from the registry by ID and provide variables:

json
{
  "provider": "openai",
  "model": "gpt-4o",
  "prompt_id": "billing/invoice-parser",
  "variables": {"invoice_text": "Order #1234\nTotal: $99.00"},
  "stream": true
}

Compare Models

POST
/api/v1/playground/compare

Run the same prompt against 2–3 targets simultaneously with multiplexed SSE.

bash
curl -X POST https://api.ingateai.com/api/v1/playground/compare \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt_text": "Explain quantum computing in one sentence.",
    "targets": [
      {"provider": "openai", "model": "gpt-4o"},
      {"provider": "anthropic", "model": "claude-3-5-sonnet-20241022"},
      {"provider": "openai", "model": "gpt-4o-mini"}
    ],
    "parameters": {"temperature": 0.7}
  }'

The SSE stream uses indexed events so you can tell which target each chunk belongs to:

event: chunk:0
data: {"index": 0, "content": "Quantum computing"}

event: chunk:1
data: {"index": 1, "content": "Quantum computing uses"}

event: done:0
data: {"index": 0, "done": true, "stats": {"tokens_in": 12, "tokens_out": 25, "latency_ms": 890}}

event: done:1
data: {"index": 1, "done": true, "stats": {"tokens_in": 12, "tokens_out": 30, "latency_ms": 1200}}

Run History

GET
/api/v1/playground/history

Paginated list of previous playground runs.

Every playground execution is automatically saved with prompt text, response, token counts, cost, and latency. Use limit and offset for pagination.

Save as Prompt Version

POST
/api/v1/playground/save-version

Save a playground result as a new prompt version in the registry.

json
{
  "namespace": "support",
  "slug": "greeting",
  "content": "You are a helpful support agent. Greet the user warmly."
}

Available Providers

GET
/api/v1/playground/providers

List providers available for playground use.

Iterate fast

Use the playground to experiment with different models, temperatures, and prompt variations. When you find something that works, save it as a prompt version directly from the playground.