AI Gateway

OpenAI-compatible chat completions endpoint. Proxies requests through a flowgen flow, enabling pre/post processing, logging, and tool execution.

Exposes a /v1/chat/completions endpoint that accepts the OpenAI request format and streams responses as Server-Sent Events. Routes requests to registered llm_proxy backends based on the model field (model: "<proxy-name>/<downstream-model>").

Server configuration

The AI gateway runs as its own HTTP server, independent of the webhook HTTP server and MCP server:

worker:
  ai_gateway:
    enabled: true
    port: 3002
    path: /v1
    # credentials_path: /etc/flowgen/credentials/ai.json

Task configuration

- llm_proxy:
    name: gateway
    protocol: openai
    credentials_path: /path/to/credentials.json
FieldTypeDefaultDescription
namestringrequiredUnique proxy name used in model routing (<name>/<model>).
protocolstringopenaiWire protocol for the proxy endpoint. Currently only openai.
credentials_pathstringnullPath to credentials file for endpoint authentication.

Requests are sent to POST /v1/chat/completions with the standard OpenAI chat format. Use <proxy-name>/<downstream-model> as the model value to route to a specific proxy backend.

Output

Format: JSON

FieldTypeDescription
promptstringUser prompt merged from messages.
system_promptstring / nullSystem message if present.
modelstringRequested model name.
temperaturenumber / nullSampling temperature if specified.
max_tokensint / nullToken limit if specified.
streamboolWhether streaming was requested.