routes
routes
¶
Route handlers for the OpenAI-compatible API server.
Classes¶
Functions¶
chat_completions
async
¶
Handle chat completion requests (streaming and non-streaming).
Source code in src/locus/server/routes.py
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 | |
list_models
async
¶
List selectable engine models for the installed-model picker.
Direct cloud models live in the Cloud Models tab. Models advertised by a configured LiteLLM engine remain here because LiteLLM owns their routing and may use provider-qualified IDs that resemble OpenRouter IDs.
Source code in src/locus/server/routes.py
pull_model
async
¶
Pull / download a model from the Ollama registry.
Source code in src/locus/server/routes.py
delete_model
async
¶
Delete a model from Ollama.
Source code in src/locus/server/routes.py
reload_cloud_engine
async
¶
Hot-reload cloud API keys and (re-)initialize the cloud engine.
Called by the desktop app immediately after the user saves a cloud API key so that cloud models become available without a full app restart.
Source code in src/locus/server/routes.py
1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 | |
savings
async
¶
Return savings summary compared to cloud providers.
Only includes telemetry from the current server session so that counters start at zero each time a new model + agent is launched.
Source code in src/locus/server/routes.py
reset_telemetry
async
¶
Clear all stored telemetry records.
Useful after updating token-counting methodology — clears historical records that were computed under the old rules so that the savings dashboard and leaderboard submissions start fresh with corrected values.
Source code in src/locus/server/routes.py
server_info
async
¶
Return server configuration: model, agent, engine.
Source code in src/locus/server/routes.py
health
async
¶
Health check endpoint.
Source code in src/locus/server/routes.py
list_channels
async
¶
List available messaging channels.
Source code in src/locus/server/routes.py
channel_send
async
¶
Send a message to a channel.
Source code in src/locus/server/routes.py
channel_status
async
¶
Return channel bridge connection status.
Source code in src/locus/server/routes.py
security_scan
async
¶
Run a read-only security environment audit and return findings.