ANY /proxy/openai/*
Proxy requests to OpenAI API with automatic credential injection, policy enforcement, prompt drift detection, and cost tracking. All requests are logged in the audit trail.Authentication
Does not require session authentication. Uses OpenAI API key from the credential vault.Endpoint Format
/proxy/openai is forwarded to the OpenAI API (default: https://api.openai.com).
Request Flow
- Rate limiting (if configured): Check
llm.rate_limit_per_minute - LLM guards (if enabled):
- Model allowlist check (
llm.allowed_models) - Prompt drift detection (
llm.prompt_drift) - Prompt size limits (
llm.prompt_size_guard)
- Model allowlist check (
- Credential injection: Retrieve OpenAI API key from vault and add
Authorization: Bearer sk-...header - Upstream request: Forward to OpenAI API
- Cost tracking (if enabled): Parse usage and record cost based on
llm.model_pricing - Audit logging: Record decision, cost, and cryptographic proof in audit log
Policy Enforcement
Maximum requests per minute across all LLM providers. 0 = disabled.
List of allowed model names (case-insensitive). Empty = all models allowed.Example:
["gpt-4o", "gpt-4o-mini"]Enable prompt drift detection. Records baseline system prompt and alerts on changes.
Action when drift is detected:
alert (log warning) or deny (block request).Enable prompt size limiting.
Maximum total characters in prompt (approximate). 0 = no limit.
Cost Tracking
Fishnet tracks token usage and calculates costs based on model pricing:For streaming requests to
/v1/chat/completions, Fishnet automatically injects stream_options.include_usage: true to ensure usage data is included in the stream.Headers Forwarding
All request headers are forwarded to OpenAI except:authorization(replaced with vault credential)x-api-key(stripped)host,connection,keep-alive,transfer-encoding,content-length(HTTP infrastructure)
X-Request-ID for tracing.
Body Forwarding
Request bodies are forwarded as-is to OpenAI. For JSON requests, Fishnet parses the body to:- Extract the
modelfield for allowlist checking - Extract the
streamfield to detect streaming requests - Extract system prompts for drift detection
- Count total characters for size limits
Examples
Streaming Example
Fishnet automatically adds
stream_options.include_usage: true to chat completion requests to track token usage in streams.Error Responses
llm.allowed_models list.llm.prompt_drift.mode = deny.llm.prompt_size_guard.max_prompt_tokens when action is deny.llm.rate_limit_per_minute).Audit Log Entry
Each proxied request creates an audit log entry:GET /api/audit?service=openai.