feat: OpenAI-compatible API server + streaming support#956
Open
feat: OpenAI-compatible API server + streaming support#956
Conversation
Cherry-picked from PR #828, rebased onto current main with conflict resolution.
… CORS Cherry-picked from PR #828.
Cherry-picked from PR #828.
Cherry-picked from PR #828.
Cherry-picked from PR #828.
Cherry-picked from PR #828, resolved conflicts with main.
… WebUI Cherry-picked from PR #828, resolved conflicts with main.
…tion, cache streaming config, add setup integration and security docs - Remove unused _write_sse_chat_completion pseudo-streaming method (dead code) - Extract _resolve_model() helper in gateway/run.py, use from api_server - Cache streaming config at GatewayRunner init instead of YAML parsing per-message - Add API_SERVER_* env vars to OPTIONAL_ENV_VARS for hermes setup integration - Add security warning about network exposure without API_SERVER_KEY
Add configurable reply_to_mode for Telegram multi-chunk replies: - off: never thread replies to original message - first: only first chunk threads (default, preserves current behavior) - all: all chunks thread to original message Configurable via reply_to_mode in platform config or TELEGRAM_REPLY_TO_MODE env var. Cherry-picked from PR #855 by raulvidis, rebased onto current main. Dropped asyncio_mode=auto pyproject.toml change, added @pytest.mark.asyncio decorators, fixed test IDs to use numeric strings. Co-authored-by: Raul <77628552+raulvidis@users.noreply.github.com>
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Rebased and improved version of PR #828. Adds an OpenAI-compatible HTTP API server as a gateway platform adapter, plus streaming support across all platforms.
What this enables
Any OpenAI-compatible frontend — Open WebUI (126k★), LobeChat (73k★), LibreChat (34k★), AnythingLLM (56k★), NextChat (87k★), ChatBox (39k★), etc. — can connect to hermes-agent by pointing at
http://localhost:8642/v1.Endpoints
/v1/chat/completions/v1/responsesprevious_response_idorconversation)/v1/responses/{id}/v1/responses/{id}/v1/models/healthKey features
conversationparameterAPI_SERVER_KEYenv varImprovements over PR #828
_write_sse_chat_completionpseudo-streaming method deleted_resolve_model()helper in gateway/run.py — API server now imports it instead of duplicating the YAML parsingGatewayRunner.__init__instead of parsing config.yaml on every messageAPI_SERVER_ENABLED,API_SERVER_KEY,API_SERVER_PORT,API_SERVER_HOSTregistered inOPTIONAL_ENV_VARSsohermes setupprompts for themDocumentation
Test results