Skip to main content

Recipe Serve

The praisonai serve recipe command starts an HTTP server that exposes recipe endpoints for remote invocation.

Quick Start

Command Options

Security

Host Binding Safety

By default, the server binds to 127.0.0.1 (localhost only). Binding to 0.0.0.0 (all interfaces) requires authentication.
A typo in the auth: field (e.g. apikey, api_key, APIKey) refuses to start on a non-localhost bind rather than silently downgrading to no auth. This is intentional — see PR #3926.

Authentication Modes

Supported Auth Modes

The recipe server accepts exactly three auth modes, defined as a single source of truth in praisonai.recipe.serve:
create_app(config) validates the auth value at construction time and raises ValueError for anything else — including typos (apikey, apiKey), empty strings (""), and non-strings (False, []).
Any non-localhost bind refuses to start unless auth is one of the supported non-none modes (or --api-key is passed on the CLI). The CLI runs its checks in this order:
1

Load config

Read serve.yaml (or CLI flags) into the config.
2

Validate auth mode

Reject any auth value outside SUPPORTED_AUTH_TYPES before binding.
3

Bind guard

Refuse a non-localhost bind that resolves to auth: none with no --api-key.
4

Serve

Start the server only after all checks pass.

API Key Authentication

Clients must include the X-API-Key header:

Configuration File

Create a serve.yaml file for persistent configuration:
Use the config file:

Configuration Precedence

  1. CLI flags (highest priority)
  2. Environment variables
  3. Config file
  4. Defaults (lowest priority)

API Endpoints

Health Check

Response:

List Recipes

Response:

Describe Recipe

Response:

Get Recipe Schema

Response:

Run Recipe

Response:

Stream Recipe (SSE)

Response (Server-Sent Events):

Examples

Development Mode

Production Mode

Using with Docker

Client Examples

curl

Python

JavaScript

Environment Variables

Troubleshooting

Port Already in Use

Solution: Use a different port or stop the existing process:

Missing Dependencies

Solution: Install serve extras:

Auth Required for Public Binding

Solution: Enable authentication:

Unsupported Auth Mode

Solution: Use an exact supported mode (none, api-key, or jwt). Typos like apikey, api_key, or apiKey fail closed rather than downgrading to no auth.