Harden streaming, pagination, and config loading

This commit is contained in:
sid 2026-03-19 18:52:09 -06:00
parent 02c9c76667
commit 6cda36312a
16 changed files with 1079 additions and 244 deletions

View file

@ -24,20 +24,50 @@ providers:
anthropic:
# Base URL for Anthropic API (can be changed for custom endpoints)
base_url: "https://api.anthropic.com"
# Maximum number of retries for failed requests
max_retries: 3
# OpenAI configuration
openai:
# API key for OpenAI
# Can also be set via OPENAI_API_KEY environment variable
# api_key: "..."
# Base URL for OpenAI API (can be changed for custom endpoints)
# Can also be set via OPENAI_BASE_URL environment variable
# base_url: "https://api.openai.com"
# Allow clients to provide their own API key via header
# Can also be set via OPENAI_ALLOW_CLIENT_API_KEY environment variable
allow_client_api_key: false
# Header name for client-provided API key (default: x-openai-api-key)
# Can also be set via OPENAI_CLIENT_API_KEY_HEADER environment variable
client_api_key_header: "x-openai-api-key"
# CORS Configuration
# Controls Cross-Origin Resource Sharing for the web UI
cors:
# Allowed origins (use ["*"] for all origins - not recommended for production)
# Can also be set via CORS_ALLOWED_ORIGINS environment variable (comma-separated)
allowed_origins:
- "*"
# Allowed HTTP methods
# Can also be set via CORS_ALLOWED_METHODS environment variable (comma-separated)
allowed_methods:
- "GET"
- "POST"
- "PUT"
- "DELETE"
- "OPTIONS"
# Allowed headers (use ["*"] for all headers)
# Can also be set via CORS_ALLOWED_HEADERS environment variable (comma-separated)
allowed_headers:
- "*"
# Storage configuration
storage:
# SQLite database path for storing request history
@ -69,23 +99,30 @@ subagents:
# The following environment variables will override the YAML configuration:
#
# Server:
# PORT - Server port
# READ_TIMEOUT - Read timeout duration
# WRITE_TIMEOUT - Write timeout duration
# IDLE_TIMEOUT - Idle timeout duration
# PORT - Server port
# READ_TIMEOUT - Read timeout duration
# WRITE_TIMEOUT - Write timeout duration
# IDLE_TIMEOUT - Idle timeout duration
#
# Anthropic:
# ANTHROPIC_FORWARD_URL - Anthropic base URL
# ANTHROPIC_VERSION - Anthropic API version
# ANTHROPIC_MAX_RETRIES - Maximum retries for Anthropic requests
# ANTHROPIC_FORWARD_URL - Anthropic base URL
# ANTHROPIC_VERSION - Anthropic API version
# ANTHROPIC_MAX_RETRIES - Maximum retries for Anthropic requests
#
# OpenAI:
# OPENAI_API_KEY - OpenAI API key
# OPENAI_BASE_URL - OpenAI base URL
# OPENAI_API_KEY - OpenAI API key
# OPENAI_BASE_URL - OpenAI base URL
# OPENAI_ALLOW_CLIENT_API_KEY - Allow client-provided API keys (true/false)
# OPENAI_CLIENT_API_KEY_HEADER - Header name for client API key
#
# Storage:
# DB_PATH - Database file path
# DB_PATH - Database file path
#
# CORS:
# CORS_ALLOWED_ORIGINS - Comma-separated allowed origins
# CORS_ALLOWED_METHODS - Comma-separated allowed methods
# CORS_ALLOWED_HEADERS - Comma-separated allowed headers
#
# Subagents:
# SUBAGENT_MAPPINGS - Comma-separated subagent:model pairs
# Example: "code-reviewer:claude-3-5-sonnet"
# SUBAGENT_MAPPINGS - Comma-separated subagent:model pairs
# Example: "code-reviewer:claude-3-5-sonnet"