Tools and state
openai_conversations
Serve OpenAI Conversations API endpoints locally through the configured response store.
Switching projects opens that project’s default documentation release.
Versions marked “overview” do not contain this page. Selecting one opens that version’s documentation overview.
On this page
Handles all /v1/conversations endpoints locally.
Configuration Notes
All matched requests are served from the owner-scoped store and never forwarded upstream. Unmatched paths pass through as Continue. The filter resolves the store from the per-request registry the serving runtime provisions, and takes an owner-bound handle. ai_operation must precede this filter in the same chain. Optional rate_limit admission reuses the core request limiter and formats its 429 rejection as OpenAI JSON. One budget covers all local operations; mode: global shares it across callers and mode: per_ip uses the TCP peer address, not the authenticated owner or forwarded headers. rate is requests per second and burst is bucket capacity. The block is disabled when absent. Admission runs after trusted owner resolution and before store access; failed CRUD requests consume capacity too. A pipeline rebuild creates fresh buckets. Request-body pre-read can run before admission, so this policy does not bound body-buffering memory or ingress bandwidth. Configure connection and request-body size limits separately when those costs need to be constrained. Core per-IP state bounds and eviction apply. Shadow mode records decisions without rejecting. Successful local responses do not gain rate-limit headers.
Local validation errors return OpenAI JSON 400, missing owner-scoped resources return 404, and storage failures return a generic JSON 500. Error envelopes always include message, type, code, and param (the latter two may be null). Initial items commit atomically with their new conversation. Item deletion returns conversation metadata captured under the same mutation lock, without a fallible post-commit read.
For a managed POST /v1/responses with conversation, completed JSON and SSE responses append the request input and final output items to the local Conversation. Streaming append-back reads the canonical terminal response state without buffering SSE. With the default fail-closed policy, it persists before response.completed is released; failure_mode: open opts out of that guarantee. Incomplete or failed streams do not append a turn. The provider owns history on a direct OpenAI passthrough route. Place this filter after openai_response_store in the request chain so reverse response hooks append the conversation turn before storing its successful response.
Configuration
| Field | Type | Required | Description |
|---|---|---|---|
rate_limit | any | no | Optional request admission using the core rate_limit configuration. A mapping with required mode (global or per_ip), rate (positive requests per second), and burst (integer capacity, at least rate). scope defaults to local for existing configurations. Optional ipv6_prefix_len (1 to 128, default 128) groups IPv6 peers; shadow (boolean, default false) observes without rejecting. Global or per-IP budgets cover all eight local operations together. |
backend | sqlite | postgres | yes | Storage backend to use. |
database_url | string (secret) | yes | Database connection URL. Wrapped in [SecretString] to prevent accidental logging of credentials. |
conversations_table | string | no | Table name for conversation records. |
items_table | string | no | Table name for conversation item records. |
ssl_mode | SslMode | no | TLS mode for PostgreSQL connections. Only valid when backend is postgres. Overrides any sslmode parameter in the connection URL. |
ssl_root_cert | string (secret) | no | Path to a PEM-encoded root CA certificate for PostgreSQL TLS verification. Only valid when backend is postgres and the effective SSL mode is verify-ca or verify-full. |
ssl_client_cert | string (secret) | no | Path to a PEM-encoded client certificate for mutual TLS with PostgreSQL. Only valid when backend is postgres and the effective SSL mode is verify-ca or verify-full. Must be configured together with ssl_client_key. Enables certificate authentication so the server does not challenge for a password. |
ssl_client_key | string (secret) | no | Path to the PEM-encoded private key for ssl_client_cert. Only valid when backend is postgres. Must be an unencrypted PKCS#8 key (mode 0600) and configured together with ssl_client_cert. The native-tls backend (OpenSSL on Linux, Security.framework on macOS) accepts PKCS#8 only; convert a SEC1/PKCS#1 key with openssl pkcs8 -topk8 -nocrypt. |
require_certificate_authentication | bool | no | Enforce the certificate-authentication compliance profile for PostgreSQL. When enabled, the filter fails to start unless ssl_mode is verify-full, both ssl_client_cert and ssl_client_key are set, and no password reaches the connection (rejecting a password in database_url, TLS parameters in database_url, and the PGPASSWORD environment variable). It also rejects non-addressing connection parameters in database_url (application_name, options/options[...], statement-cache-capacity), which the certificate-authentication rebuild would silently drop; set such defaults on the database role instead (ALTER ROLE ... SET ...). The ssl_client_key file must also be owner-only (mode 0600, enforced on Unix). This keeps application-side password cryptography off the connection path. The PostgreSQL server must independently use a cert rule in pg_hba.conf; the proxy cannot enforce that server-side requirement. |
allow_private_database_url | bool | no | Allow PostgreSQL URLs that target local-sensitive addresses. By default, DNS names, localhost, loopback, private, link-local, cloud metadata, unspecified, and Unix socket targets are rejected. This opt-in is intended for local development and tests; cloud metadata, unspecified, and multicast addresses remain blocked when it is enabled. |
pool | PoolConfig | no | Connection pool tuning options. When omitted, sqlx defaults apply (max_connections = 10, idle_timeout = 600s, acquire_timeout = 30s). |
ttl | Duration | no | Time-to-live for stored records. Records older than this are eligible for deletion. When unset, the reaper is disabled. |
sweep_interval | Duration | no | How often to run the reaper sweep. Defaults to 1 hour when ttl is set. |
sweep_batch_size | NonZeroU32 | no | Maximum number of records to delete in a single sweep batch. |
Example
- filter: ai_operation
- filter: openai_conversations
backend: postgres
database_url: postgres://praxis:password@db.example.com/praxis
conversations_table: conversations
items_table: conversation_items
allow_private_database_url: true
rate_limit:
scope: local
mode: global
rate: 100
burst: 200