Skip to content

Sub2API 0.1.134

Choose a tag to compare

@github-actions github-actions released this 26 Apr 06:29
· 4266 commits to main since this release

AI API Gateway Platform - 将 AI 订阅配额分发和管理

Cursor sends ApplyPatch as a custom/freeform tool, but the OpenAI upstream path needs function tools for reliable model selection. The api2cursor-compatible shape is to convert the tool definition to a function with the original description and an empty object schema, while also converting custom tool history into function_call/function_call_output items before it enters the upstream path.

Constraint: Keep Cursor-specific protocol repair inside the Cursor compat boundary and avoid shared OpenAI gateway changes.

Rejected: Add a patch string parameter to ApplyPatch | it makes the model emit {patch: ...}, which Cursor's custom ApplyPatch executor treats as invalid raw input.

Rejected: Response-side ApplyPatch argument unwrapping | not used by api2cursor and risks breaking normal Cursor tool-call assembly.

Confidence: medium

Scope-risk: narrow

Directive: Preserve function.arguments deltas, including empty strings; Cursor relies on them for streaming tool-call assembly.

Tested: go test ./internal/compat/cursor ./internal/handler ./internal/service -run 'Cursor|Compat|ChatStream|ChatCompletions|ApplyPatch|OpenAI|ResponsesShape' -count=1

Tested: go vet ./internal/compat/cursor ./internal/handler ./internal/service

Tested: git diff --check

Not-tested: Live Cursor ApplyPatch edit after v0.1.134 rollout


📥 Installation

Docker:

# GitHub Container Registry
docker pull ghcr.io/wanggang8/sub2api:0.1.134

One-line install (Linux):

curl -sSL https://raw.githubusercontent.com/wanggang8/sub2api/main/deploy/install.sh | sudo bash

Manual download:
Download the appropriate archive for your platform from the assets below.

📚 Documentation