Sayoyo commited on
Commit
7d44db3
·
1 Parent(s): db9ad53

feat: add v1/model

Browse files
Files changed (1) hide show
  1. acestep/api_server.py +37 -0
acestep/api_server.py CHANGED
@@ -1284,6 +1284,43 @@ def create_app() -> FastAPI:
1284
  "version": "1.0",
1285
  }
1286
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1287
  @app.get("/v1/audio")
1288
  async def get_audio(path: str):
1289
  """Serve audio file by path."""
 
1284
  "version": "1.0",
1285
  }
1286
 
1287
+ @app.get("/v1/models")
1288
+ async def list_models():
1289
+ """List available DiT models."""
1290
+ models = []
1291
+
1292
+ # Primary model (always available if initialized)
1293
+ if getattr(app.state, "_initialized", False):
1294
+ primary_model = _get_model_name(app.state._config_path)
1295
+ if primary_model:
1296
+ models.append({
1297
+ "name": primary_model,
1298
+ "is_default": True,
1299
+ })
1300
+
1301
+ # Secondary model
1302
+ if getattr(app.state, "_initialized2", False) and app.state._config_path2:
1303
+ secondary_model = _get_model_name(app.state._config_path2)
1304
+ if secondary_model:
1305
+ models.append({
1306
+ "name": secondary_model,
1307
+ "is_default": False,
1308
+ })
1309
+
1310
+ # Third model
1311
+ if getattr(app.state, "_initialized3", False) and app.state._config_path3:
1312
+ third_model = _get_model_name(app.state._config_path3)
1313
+ if third_model:
1314
+ models.append({
1315
+ "name": third_model,
1316
+ "is_default": False,
1317
+ })
1318
+
1319
+ return {
1320
+ "models": models,
1321
+ "default_model": models[0]["name"] if models else None,
1322
+ }
1323
+
1324
  @app.get("/v1/audio")
1325
  async def get_audio(path: str):
1326
  """Serve audio file by path."""