You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add Anthropic Messages API and Google Gemini API endpoints
- POST /v1/messages — Anthropic Messages API with streaming (SSE)
- POST /v1beta/models/:model:generateContent — Gemini non-streaming
- POST /v1beta/models/:model:streamGenerateContent — Gemini NDJSON streaming
- New helpers: normalizeAnthropicMessages, normalizeGeminiContents,
extractGeminiSystemInstruction, mapFinishReasonToAnthropic/Gemini
- 35 new tests (77 -> 112 total, all passing)
- Update README to document all supported API formats
Closes#38, #39
Copy file name to clipboardExpand all lines: README.md
+73-7Lines changed: 73 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,12 @@
1
1
# opencode-llm-proxy
2
2
3
-
An [OpenCode](https://opencode.ai) plugin that starts a local OpenAI-compatible HTTP server backed by your OpenCode providers.
3
+
An [OpenCode](https://opencode.ai) plugin that starts a local HTTP server backed by your OpenCode providers, with support for multiple LLM API formats:
4
4
5
-
Any tool or application that speaks the OpenAI Chat Completions or Responses API can use it — including LangChain, custom scripts, local frontends, etc.
5
+
-**OpenAI** Chat Completions (`POST /v1/chat/completions`) and Responses (`POST /v1/responses`)
6
+
-**Anthropic** Messages API (`POST /v1/messages`)
7
+
-**Google Gemini** API (`POST /v1beta/models/:model:generateContent`)
8
+
9
+
Any tool or SDK that targets one of these APIs can point at the proxy without code changes.
The plugin hooks into OpenCode at startup and spawns a Bun HTTP server. Incoming OpenAI-format requests are translated into OpenCode SDK calls (`client.session.create` + `client.session.prompt`), routed through whichever provider/model is requested, and the response is returned in OpenAI format.
219
+
The plugin hooks into OpenCode at startup and spawns a Bun HTTP server. Incoming requests (in OpenAI, Anthropic, or Gemini format) are translated into OpenCode SDK calls (`client.session.create` + `client.session.prompt`), routed through whichever provider/model is requested, and the response is returned in the matching API format.
153
220
154
221
Each request creates a temporary OpenCode session, so prompts and responses appear in the OpenCode session list.
155
222
156
223
## Limitations
157
224
158
-
- Streaming (`"stream": true`) is not yet implemented — requests will return a 400 error.
159
225
- Tool/function calling is not forwarded; all built-in OpenCode tools are disabled for proxy sessions.
160
-
-The proxy only handles `POST /v1/chat/completions` and `POST /v1/responses`. Other OpenAI endpoints are not implemented.
226
+
-Only text content is handled; image and file inputs are ignored.
0 commit comments