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/diapason/server/routes.py
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 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 | |
action_metrics
async
¶
Privacy-safe latency distribution for deterministic actions.
list_models
async
¶
List locally installed models (Ollama).
Cloud models are not included here — they live in the Cloud Models tab of the UI and are selected there, not from this endpoint. Embedding models are not included either — offering a model that cannot chat in a chat-model picker is a loaded footgun (see _est_modele_embedding). The server's own default model comes first: it is what the desktop app picks when nothing is selected yet.
Source code in src/diapason/server/routes.py
prewarm_model
async
¶
Keep a local Ollama model resident without generating any content.
Source code in src/diapason/server/routes.py
pull_model
async
¶
Pull / download a model from the Ollama registry.
Source code in src/diapason/server/routes.py
delete_model
async
¶
Delete a model from Ollama.
Source code in src/diapason/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/diapason/server/routes.py
1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 | |
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/diapason/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/diapason/server/routes.py
server_info
async
¶
Return server configuration: model, agent, engine.
Source code in src/diapason/server/routes.py
health
async
¶
Health check endpoint.
Source code in src/diapason/server/routes.py
list_channels
async
¶
List available messaging channels.
Source code in src/diapason/server/routes.py
channel_send
async
¶
Send a message to a channel.
Source code in src/diapason/server/routes.py
channel_status
async
¶
Return channel bridge connection status.
Source code in src/diapason/server/routes.py
security_scan
async
¶
Run a read-only security environment audit and return findings.