o402 0.1.5

OpenAI-compatible gateway, paid with x402.
[server]
# Container/compose: 0.0.0.0:8080 (Caddy reaches o402:8080 on the Docker network).
# systemd + reverse proxy on the host: 127.0.0.1:8080
bind = "0.0.0.0:8080"
base_url = "https://o402.qntx.org"
shutdown_timeout_secs = 30
body_limit_bytes = 33554432
request_timeout_secs = 180

[server.cors]
# CorsLayer is outermost and must expose Payment-* or the browser hides 402.
origins = [
  "http://localhost:5173",
  "http://127.0.0.1:5173",
  "https://chat.qntx.org",
]

[observability]
level = "info"
format = "json"
# metrics_bind = "127.0.0.1:9090"

[payment]
enabled = true
# Stop / missing usage: charge request_floor, not the signed ceiling.
missing_usage = "floor"
abort_usage = "floor"
max_timeout_seconds = 300

[payment.facilitator]
url = "https://facilitator.qntx.org"
timeout_secs = 60
supported_cache_ttl_secs = 600

# Entire header value. Public facilitator requires [http.auth].
[payment.facilitator.auth.verify]
Authorization = "$FACILITATOR_AUTH_HEADER"
[payment.facilitator.auth.settle]
Authorization = "$FACILITATOR_AUTH_HEADER"
[payment.facilitator.auth.supported]
Authorization = "$FACILITATOR_AUTH_HEADER"

[payment.settlement]
exact_non_stream = "sequential-wait-settle"
exact_stream = "wait-2xx-then-spawn"
upto_non_stream = "sequential-wait-settle"
upto_stream = "stream-then-settle"

[payment.pay_to]
"eip155:*" = "$O402_EVM_PAY_TO"
"solana:*" = "$O402_SOLANA_PAY_TO"

[[payment.accepts]]
scheme = "upto"
network = "eip155:143"
asset = "usdc"

[[payment.accepts]]
scheme = "upto"
network = "eip155:10143"
asset = "usdc"

[[payment.accepts]]
scheme = "exact"
network = "eip155:143"
asset = "usdc"
transfer_method = "eip3009"

[[payment.accepts]]
scheme = "exact"
network = "eip155:10143"
asset = "usdc"
transfer_method = "eip3009"

[[payment.accepts]]
scheme = "exact"
network = "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"
asset = "usdc"

[pricing.default]
scheme = "upto"
price = "0.001"
request_floor = "0.00001"
input_per_million = "0.15"
output_per_million = "0.60"
cached_input_per_million = "0.075"
reasoning_per_million = "0.60"
ceiling_multiplier = "1.0"
max_ceiling = "5.00"
max_input_tokens = 128000
default_max_output_tokens = 4096

# Compose: Bifrost on the docker network. Host: http://127.0.0.1:8081
[[upstreams]]
name = "bifrost"
base_url = "http://bifrost:8080"
api_key = "$BIFROST_API_KEY"
timeout_secs = 300
connect_timeout_secs = 10
allow_insecure = true

# Optional catalog overrides. Unknown models use pricing.default and this upstream.
# [[models]]
# id = "openai/gpt-4o-mini"
# upstream = "bifrost"
# owned_by = "openai"
# scheme = "upto"
# input_per_million = "0.15"
# output_per_million = "0.60"