fix: list models API

Fix the list models API to match the corresponding OpenAI API format.
This commit is contained in:
chenmz00 2025-03-05 21:49:27 +08:00 committed by GitHub
parent 2753a4a654
commit b2ba795cfd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -13,7 +13,7 @@ router = APIRouter()
@router.get('/models', tags=['openai'])
async def list_models():
return [{"id": Config().model_name, "name": Config().model_name}]
return {"data": [{"id": Config().model_name, "name": Config().model_name}], "object": "list"}
@router.post('/chat/completions', tags=['openai'])