Streamline agent setup

This commit is contained in:
hwhung
2026-04-27 11:55:31 +08:00
parent af74853254
commit 3782902257
5 changed files with 28 additions and 64 deletions
+23 -61
View File
@@ -1,34 +1,34 @@
# Agent Setup
# Agent Instructions
This artifact is a standalone Express API server. It exposes a static model dashboard and OpenAI-compatible proxy routes backed by internally supplied provider endpoints.
This repository is a standalone Express API server. It is not intended to be added to a parent workspace.
## Required Agent Actions
1. Install dependencies:
## Run Exactly
```bash
pnpm install
pnpm install --ignore-workspace
pnpm dev
```
`pnpm-lock.yaml` is intentionally not tracked in this repository. `pnpm install` may generate one locally.
The server starts with built-in defaults even when `config.json` does not exist:
2. Create and fill `config.json`.
- host: `0.0.0.0`
- port: `8080`
- proxy bearer token: `dev-proxy-key`
Do not create `config.json` unless internal provider endpoints are available.
## Fill Provider Config
Only if internal provider endpoints are available:
```bash
cp config.example.json config.json
```
Replace provider values when internal endpoints are available:
Then fill only these values:
```json
{
"server": {
"host": "127.0.0.1",
"port": 8080
},
"proxy": {
"apiKey": "dev-proxy-key"
},
"providers": {
"openai": {
"apiKey": "internal-openai-token",
@@ -38,49 +38,13 @@ Replace provider values when internal endpoints are available:
"apiKey": "internal-anthropic-token",
"baseURL": "https://your-internal-anthropic-endpoint"
}
},
"logging": {
"level": "info",
"pretty": true
}
}
```
Use only internal endpoints supplied by the runtime/integration. Do not use public official provider endpoints in this proxy config.
Use internal endpoints supplied by the runtime/integration. Do not use public official provider endpoints.
If no provider endpoints are available, leave `providers.*.apiKey` and `providers.*.baseURL` empty. The server still boots, `/dashboard` works, `/api/healthz` works, and `/v1/models` works. Chat completion calls return `503` until the target provider has both `apiKey` and `baseURL`.
3. Start the server:
```bash
pnpm dev
```
The default config path is `config.json`. To use a different file:
```bash
pnpm dev -- --config ./config.local.json
```
## Hosted Deployment
For a hosted runtime that must bind all interfaces, set:
```json
{
"server": {
"host": "0.0.0.0",
"port": 8080
}
}
```
Build and run production output:
```bash
pnpm build
pnpm start
```
If provider endpoints are not available, leave config absent. The dashboard, health check, and model list still work. Chat completion calls return `503` until the target provider has both `apiKey` and `baseURL`.
## Routes
@@ -103,13 +67,11 @@ curl -s http://localhost:8080/api/healthz
curl -s -H "Authorization: Bearer dev-proxy-key" http://localhost:8080/v1/models
```
Chat completion check:
Expected chat result without provider config: `503` with a message asking for `providers.<name>.apiKey` and `providers.<name>.baseURL`.
## Production
```bash
curl -s http://localhost:8080/v1/chat/completions \
-H "Authorization: Bearer dev-proxy-key" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-5.2","messages":[{"role":"user","content":"hello"}]}'
pnpm build
pnpm start
```
Expected result without provider config: `503` with a message asking for `providers.<name>.apiKey` and `providers.<name>.baseURL`.