feat: generic background Responses API providers — sference backend#32
Open
apejcic wants to merge 1 commit into
Open
feat: generic background Responses API providers — sference backend#32apejcic wants to merge 1 commit into
apejcic wants to merge 1 commit into
Conversation
Adds a 'responses-bg' backend type to the proxy: Anthropic /v1/messages requests are translated to POST /v1/responses with background:true and metadata.completion_window, polled to completion, and synthesized back as Anthropic SSE (with ping keepalive). Tool calls try native OpenAI function format first and fall back to prompt-based emulation on 400. sference.com is registered as a regular backend (-b sf, default model moonshotai/Kimi-K2.6, window via -w/SFERENCE_COMPLETION_WINDOW), plus an env-configurable custom provider (BG_PROVIDER_*). New /_proxy/window control endpoint; /_proxy/status now reports type, window, tool_mode. Also: proxy logs moved to stderr so launchers read a clean port from stdout, origin guard applied to all control POST endpoints, http upstreams supported for self-hosted providers, and macOS-safe ms timing in the benchmark. Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Adds a 'responses-bg' backend type to the proxy: Anthropic /v1/messages
requests are translated to POST /v1/responses with background:true and
metadata.completion_window, polled to completion, and synthesized back
as Anthropic SSE (with ping keepalive). Tool calls try native OpenAI
function format first and fall back to prompt-based emulation on 400.
sference.com is registered as a regular backend (-b sf, default model
moonshotai/Kimi-K2.6, window via -w/SFERENCE_COMPLETION_WINDOW), plus
an env-configurable custom provider (BG_PROVIDER_*). New /_proxy/window
control endpoint; /_proxy/status now reports type, window, tool_mode.
Also: proxy logs moved to stderr so launchers read a clean port from
stdout, origin guard applied to all control POST endpoints, http
upstreams supported for self-hosted providers, and macOS-safe ms
timing in the benchmark.