Skip to content

Commit 154af79

Browse files
authored
Merge pull request #5 from Core-Mate/codex/fix-env-example-startup
[codex] Complete backend env example and startup checks
2 parents eeb5a14 + ff8c5a9 commit 154af79

2 files changed

Lines changed: 62 additions & 11 deletions

File tree

server/apps/backend/.env.example

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
# OpenGUI Server Environment Configuration
2-
# Copy this file to .env and fill in your values
1+
# OpenGUI Server environment configuration
2+
#
3+
# Quick start:
4+
# 1. Copy this file to .env
5+
# cp apps/backend/.env.example apps/backend/.env
6+
# 2. Fill in the required model settings below.
7+
# 3. Never commit the real .env file or real API keys.
38

49
# App
510
NODE_ENV=development
@@ -14,18 +19,40 @@ REDIS_PORT=6379
1419
REDIS_DB=0
1520
REDIS_PASSWORD=
1621

17-
# Claude Agent (plan-supervisor, summarizer, executor-a11y)
22+
# ============================================================
23+
# Required model configuration
24+
# ============================================================
25+
#
26+
# OpenGUI uses these variables at runtime:
27+
# - CLAUDE_* is the default text/action model config for:
28+
# plan-supervisor, summarizer, executor-a11y, and action-summarizer.
29+
# - VLM_* is the vision model config for executor-vlm.
30+
#
31+
# CLAUDE_BASE_URL and VLM_BASE_URL are optional when you use the provider's
32+
# default endpoint. Set them when using an OpenAI-compatible gateway.
33+
#
34+
# OpenAI-compatible example:
35+
# CLAUDE_BASE_URL=https://your-openai-compatible-endpoint/v1
36+
# CLAUDE_MODEL=your-text-model
37+
# CLAUDE_SMALL_MODEL=your-small-or-cheaper-text-model
38+
# VLM_BASE_URL=https://your-openai-compatible-endpoint/v1
39+
# VLM_MODEL=your-vision-model
40+
#
41+
# Do not put real API keys in this example file.
42+
43+
# Text/action agents
1844
CLAUDE_API_KEY=
1945
CLAUDE_BASE_URL=
20-
CLAUDE_MODEL=anthropic/claude-sonnet-4.6
21-
CLAUDE_SMALL_MODEL=anthropic/claude-haiku-4.5
46+
CLAUDE_MODEL=
47+
CLAUDE_SMALL_MODEL=
2248

23-
# VLM Agent (executor-vlm) — 视觉模型
49+
# Vision agent
2450
VLM_API_KEY=
2551
VLM_BASE_URL=
2652
VLM_MODEL=
2753

28-
# Creator Agent (Claude Agent SDK)
54+
# Optional: Creator Agent (Claude Agent SDK)
55+
# Only required if you use creator-agent SDK features.
2956
ANTHROPIC_API_KEY=
3057
# ANTHROPIC_BASE_URL=
3158

server/start.sh

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,11 @@ ENV_EXAMPLE=apps/backend/.env.example
8383
if [ ! -f "$ENV_FILE" ]; then
8484
if [ -f "$ENV_EXAMPLE" ]; then
8585
cp "$ENV_EXAMPLE" "$ENV_FILE"
86-
warn ".env was created from .env.example. Please edit it and add your API keys:"
86+
warn ".env was created from .env.example. Please edit it and add the required model configuration:"
8787
warn " File: $ENV_FILE"
88-
warn " CLAUDE_API_KEY, VLM_API_KEY, ANTHROPIC_API_KEY"
88+
warn " Required: CLAUDE_API_KEY, CLAUDE_MODEL, CLAUDE_SMALL_MODEL, VLM_API_KEY, VLM_MODEL"
89+
warn " Optional: CLAUDE_BASE_URL, VLM_BASE_URL for OpenAI-compatible gateways"
90+
warn " Optional: ANTHROPIC_API_KEY only for Creator Agent SDK features"
8991
warn "Run this script again after editing the file."
9092
exit 0
9193
else
@@ -95,8 +97,30 @@ fi
9597

9698
set -a; source "$ENV_FILE" 2>/dev/null || true; set +a
9799

98-
if [ -z "$CLAUDE_API_KEY" ]; then
99-
warn "CLAUDE_API_KEY is not set. Please edit .env."
100+
REQUIRED_MODEL_VARS=(
101+
CLAUDE_API_KEY
102+
CLAUDE_MODEL
103+
CLAUDE_SMALL_MODEL
104+
VLM_API_KEY
105+
VLM_MODEL
106+
)
107+
108+
MISSING_MODEL_VARS=()
109+
for var_name in "${REQUIRED_MODEL_VARS[@]}"; do
110+
if [ -z "${!var_name}" ]; then
111+
MISSING_MODEL_VARS+=("$var_name")
112+
fi
113+
done
114+
115+
if [ "${#MISSING_MODEL_VARS[@]}" -gt 0 ]; then
116+
warn "Missing required model configuration in $ENV_FILE:"
117+
for var_name in "${MISSING_MODEL_VARS[@]}"; do
118+
warn " $var_name"
119+
done
120+
warn "Fill these values and run ./start.sh again."
121+
warn "If text and vision use the same provider, fill both CLAUDE_* and VLM_* explicitly."
122+
warn "ANTHROPIC_API_KEY is optional unless you use Creator Agent SDK features."
123+
exit 1
100124
fi
101125

102126
info ".env loaded"

0 commit comments

Comments
 (0)