Reference
Model Config Reference
Real model implementation flow: SQLite storage, encryption, binding resolution, and apply behavior
Model Config Reference
Model implementation has two layers:
- Console-global model pool in
~/.downcity/downcity.db(SQLite) - Project-local
model.primaryin each agentdowncity.json
1) Persistence layout
Console-global model pool:
- file:
~/.downcity/downcity.db - tables:
model_providers,models - write entrypoint:
city model ...
Project-local binding:
- file:
<project>/downcity.json - field:
model.primary
2) Write flow
-
city model ...
writes provider/model records into~/.downcity/downcity.db -
Console UI model switch
updates current agentdowncity.json -> model.primary -
city agent create
selects a model id from console pool and writesmodel.primary
3) Read flow at runtime
{
"model": {
"primary": "default"
}
}primary must reference an existing model id in SQLite, otherwise startup fails.
4) Encryption behavior
Provider apiKey is not stored in plaintext:
- algorithm: AES-256-GCM field-level encryption
- key priority:
DC_MODEL_DB_KEYenv var >~/.downcity/console/model-db.key - DB field:
api_key_encrypted
5) Commands
Manage model pool globally:
city model list
city model get model fastBind agent to a model ID:
city config set model.primary fast6) Apply changes
Restart agent after model changes:
city agent restart .