swixter 0.1.6 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +21 -0
  2. package/dist/cli/index.js +1314 -195
  3. package/package.json +3 -11
package/README.md CHANGED
@@ -4,6 +4,8 @@
4
4
  [![Test Status](https://github.com/dawnswwwww/swixter/actions/workflows/test.yml/badge.svg)](https://github.com/dawnswwwww/swixter/actions/workflows/test.yml)
5
5
  [![Release Status](https://github.com/dawnswwwww/swixter/actions/workflows/release.yml/badge.svg)](https://github.com/dawnswwwww/swixter/actions/workflows/release.yml)
6
6
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
+ [![Website](https://img.shields.io/badge/Website-swixter.cc-4a4733)](https://swixter.cc)
8
+ [![Docs](https://img.shields.io/badge/Docs-docs.swixter.cc-4a4733)](https://docs.swixter.cc)
7
9
 
8
10
  > Make AI coding tools effortlessly switchable
9
11
 
@@ -183,6 +185,7 @@ Key capabilities:
183
185
  - **Failover** - Tries profiles in group priority order, returns first successful response
184
186
  - **Circuit Breaker** - Skips providers that failed 3 consecutive times, auto-recovers after 60s
185
187
  - **Streaming** - Transparently forwards SSE/NDJSON streaming responses
188
+ - **API Format Conversion** - Automatically converts between Anthropic Messages and OpenAI Chat Completions APIs
186
189
  - **Multi-format** - Supports both OpenAI Chat (`/v1/chat/completions`) and Anthropic (`/v1/messages`, `/v1/responses`) APIs
187
190
  - **Model Rewriting** - Different providers in a group can use different model names; the proxy rewrites them automatically
188
191
 
@@ -192,6 +195,7 @@ Key capabilities:
192
195
  # Start proxy as a background service
193
196
  swixter proxy start # Start with default group
194
197
  swixter proxy start --group ha-group # Start with specific group
198
+ swixter proxy start --profile groq-local # Start with single profile (gateway mode)
195
199
  swixter proxy start --port 8080 # Custom port (default: 15721)
196
200
  swixter proxy start --daemon # Run in background
197
201
 
@@ -221,6 +225,23 @@ The easiest way to use the proxy. It:
221
225
  swixter proxy run -- claude # One command, everything automatic
222
226
  ```
223
227
 
228
+ ### API Format Conversion
229
+
230
+ The proxy automatically converts between API formats. When Claude Code sends Anthropic Messages API requests to `/v1/messages`, but the target provider uses OpenAI Chat Completions format, the proxy handles the bidirectional conversion transparently — including request body, response body, and SSE streaming.
231
+
232
+ ```bash
233
+ # Create a profile with explicit API format
234
+ swixter claude create groq-local \
235
+ --provider groq \
236
+ --api-key $GROQ_API_KEY \
237
+ --api-format openai_chat
238
+
239
+ # Start proxy in single-profile gateway mode
240
+ swixter proxy start --profile groq-local --port 3456
241
+ ```
242
+
243
+ Supported conversions: Anthropic Messages ↔ OpenAI Chat Completions (request, response, and SSE streaming).
244
+
224
245
  ### Circuit Breaker
225
246
 
226
247
  Per-profile circuit breaker prevents wasting time on failing providers: