feat: add GET /api/models endpoint

Returns available Claude models from SDK and the configured default model.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Adriano Dal Pastro
2026-05-25 21:07:12 +00:00
parent e54f828722
commit df068bc0f8
3 changed files with 35 additions and 1 deletions
+14
View File
@@ -11,6 +11,20 @@ app.get("/health", (_req, res) => {
res.json({ status: "ok" });
});
app.get("/models", async (_req, res) => {
try {
const conv = query({
prompt: ".",
options: { model: "claude-sonnet-4-6", allowedTools: [] },
});
const models = await conv.supportedModels();
await conv.return();
res.json({ success: true, models });
} catch (error) {
res.json({ success: false, error: error.message });
}
});
app.post("/process", async (req, res) => {
const { prompt, system_prompt, model, session_id } = req.body;