removing restcting of available models, fixing max tokens issues in test

This commit is contained in:
Badri Narayanan S
2025-12-27 12:17:45 +05:30
parent f86c4f4d32
commit 9b7dcf3a6c
10 changed files with 63 additions and 93 deletions

View File

@@ -193,7 +193,7 @@ app.get('/account-limits', async (req, res) => {
}
}
const sortedModels = Array.from(allModelIds).filter(m => m.includes('claude')).sort();
const sortedModels = Array.from(allModelIds).sort();
// Return ASCII table format
if (format === 'table') {
@@ -352,8 +352,32 @@ app.post('/refresh-token', async (req, res) => {
/**
* List models endpoint (OpenAI-compatible format)
*/
app.get('/v1/models', (req, res) => {
res.json(listModels());
app.get('/v1/models', async (req, res) => {
try {
await ensureInitialized();
const account = accountManager.pickNext();
if (!account) {
return res.status(503).json({
type: 'error',
error: {
type: 'api_error',
message: 'No accounts available'
}
});
}
const token = await accountManager.getTokenForAccount(account);
const models = await listModels(token);
res.json(models);
} catch (error) {
console.error('[API] Error listing models:', error);
res.status(500).json({
type: 'error',
error: {
type: 'api_error',
message: error.message
}
});
}
});
/**