Skip to content

Configuration

Start from these files:

  • gproxy.example.toml: minimum runnable example
  • gproxy.example.full.toml: full field reference

Runtime priority:

CLI args / env vars > gproxy.toml > defaults

Common overrides:

  • --config / GPROXY_CONFIG_PATH
  • --host / GPROXY_HOST
  • --port / GPROXY_PORT
  • --proxy / GPROXY_PROXY
  • --admin-key / GPROXY_ADMIN_KEY
  • --mask-sensitive-info / GPROXY_MASK_SENSITIVE_INFO
  • --data-dir / GPROXY_DATA_DIR
  • --dsn / GPROXY_DSN

gproxy-storage enables sqlite + mysql + postgres. Switch backend by changing global.dsn.

Examples:

# SQLite (default)
dsn = "sqlite://./data/gproxy.db?mode=rwc"
# MySQL
dsn = "mysql://user:password@127.0.0.1:3306/gproxy"
# PostgreSQL
dsn = "postgres://user:password@127.0.0.1:5432/gproxy"
FieldDescription
hostListen address, default 0.0.0.0
portListen port, default 8787
proxyUpstream proxy; empty string means disabled
hf_tokenOptional HuggingFace token
hf_urlHuggingFace base URL, default https://huggingface.co
admin_keyAdmin key; can be auto-generated on first run
mask_sensitive_infoMask sensitive fields in logs/events
data_dirData directory, default ./data
dsnDB DSN (sqlite/mysql/postgres)
FieldDefaultDescription
storage_write_queue_capacity4096Storage write queue capacity
storage_write_max_batch_size1024Max events per write batch
storage_write_aggregate_window_ms25Aggregation window in ms

Define each channel with [[channels]]:

  • id: channel ID (built-in like openai, or custom like mycustom)
  • enabled: whether enabled
  • settings: channel settings (usually includes base_url)
  • dispatch: optional protocol dispatch rules
  • credentials: credential list (supports multiple credentials)

Example:

[[channels]]
id = "openai"
enabled = true
[channels.settings]
base_url = "https://api.openai.com"
[[channels.credentials]]
id = "openai-main"
label = "primary"
secret = "sk-replace-me"
ChannelidOAuth/v1/usagesecret credential
OpenAIopenaiNoNoYes
ClaudeclaudeNoNoYes
AiStudioaistudioNoNoYes
VertexExpressvertexexpressNoNoYes
VertexvertexNoNoNo (service account)
GeminiCligeminicliYesYesNo (OAuth builtin)
ClaudeCodeclaudecodeYesYesNo (OAuth/Cookie builtin)
CodexcodexYesYesNo (OAuth builtin)
AntigravityantigravityYesYesNo (OAuth builtin)
NvidianvidiaNoNoYes
DeepseekdeepseekNoNoYes
GroqgroqNoNoYes
[[channels]]
id = "mycustom"
enabled = true
[channels.settings]
base_url = "https://api.example.com"
[[channels.credentials]]
secret = "custom-provider-api-key"

Notes:

  • Custom channels use ProviderDispatchTable::default_for_custom() by default.
  • You can explicitly provide dispatch for fine-grained protocol routing.

Available fields:

  • id / label: human-readable identifiers
  • secret: API key credential
  • builtin: structured OAuth / ServiceAccount credential
  • state: health status seed

Health status types:

  • healthy: available
  • partial: model-level cooldown (partially available)
  • dead: unavailable

dispatch defines how a request is executed:

  • Passthrough: forward as-is
  • TransformTo: transform to target protocol then forward
  • Local: local implementation
  • Unsupported: explicitly unsupported

This is the core mechanism that enables multiple protocol entrances across heterogeneous upstream providers.