feat: route upstream keys by model group

This commit is contained in:
wlx committed 2026-09-29 14:46:02 +08:00
1 parent ce0a718686
commit 0876dfe08e
9 files changed
+195 -41

No files matched your search

+15 -1
View File
@@ -42,8 +42,13 @@ SESSION_TTL_HOURS=168
JAVA_OPTS='-Xms256m -Xmx1536m -XX:+ExitOnOutOfMemoryError'
GATEWAY_REQUESTS_PER_MINUTE=60
GATEWAY_READS_PER_MINUTE=300
GATEWAY_DEFAULT_MODEL_CONCURRENCY=4
# 0 disables an artificial MOYI-side model/group cap; the upstream provider
# still controls its own RPS/RPM/TPM/concurrency limits.
GATEWAY_DEFAULT_MODEL_CONCURRENCY=0
GATEWAY_DEFAULT_KEY_CONCURRENCY=4
GATEWAY_DISABLE_MODEL_CONCURRENCY=false
GATEWAY_QUEUE_WAIT_MS=30000
GATEWAY_QUEUE_POLL_MS=100
TASK_MAX_QUEUED_PER_MODEL=100
MOYI_TASK_WORKER_INTERVAL_MS=1000
# Accepted async tasks retry polling for up to this duration, then release
@@ -85,3 +90,12 @@ OSS_ENDPOINT=oss-cn-beijing-internal.aliyuncs.com
OSS_BUCKET=
OSS_ACCESS_KEY_ID=
OSS_ACCESS_KEY_SECRET=
# Optional per-route upstream key pools. Do not commit real values. Replace
# ROUTE_ID with the normalized MOYI route/model id (uppercase, non-alphanumerics
# replaced by underscores), and separate multiple keys with '|'. Route pools
# take precedence over model pools, then channel-level pools, then the single
# encrypted credential stored in the admin channel record.
# MOYI_UPSTREAM_API_KEYS_ROUTE_<NORMALIZED_ROUTE_ID>='upstream_key'
# MOYI_UPSTREAM_API_KEYS_MODEL_<NORMALIZED_UPSTREAM_MODEL>='upstream_key'
# MOYI_UPSTREAM_API_KEYS_APIPRO='key_for_channel_fallback_1|key_for_channel_fallback_2'
+4
View File
@@ -9,6 +9,10 @@ services:
JAVA_RUNTIME_IMAGE: ${JAVA_RUNTIME_IMAGE:-eclipse-temurin:21-jre-alpine}
image: moyi-api:${MOYI_IMAGE_TAG:-dev}
restart: unless-stopped
# Pass per-route key pools from the deployment secret file without
# committing secret names or values to the repository.
env_file:
- .env.cloud
environment:
CONTROL_PLANE_HOST: 0.0.0.0
CONTROL_PLANE_PORT: 8787