@blockrun/cc 0.6.0 โ 0.6.2
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.
- package/README.md +182 -152
- package/dist/proxy/server.js +12 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,35 +1,75 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<h1>brcc โ BlockRun Claude Code</h1>
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
<p>Claude Code hits rate limits. Accounts get locked. Phone verification fails.<br>
|
|
6
|
+
You're paying $200/month and still can't work.<br><br>
|
|
7
|
+
<strong>brcc removes all of that. Any model. No limits. Pay what you use.</strong></p>
|
|
6
8
|
|
|
7
|
-
|
|
8
|
-
npm install -g @blockrun/cc
|
|
9
|
-
brcc start
|
|
10
|
-
```
|
|
9
|
+
<br>
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
<img src="https://img.shields.io/badge/๐_No_Rate_Limits-black?style=for-the-badge" alt="No rate limits">
|
|
12
|
+
<img src="https://img.shields.io/badge/๐_No_Account_Needed-blue?style=for-the-badge" alt="No account">
|
|
13
|
+
<img src="https://img.shields.io/badge/๐ค_40+_Models-yellow?style=for-the-badge" alt="40+ models">
|
|
14
|
+
<img src="https://img.shields.io/badge/๐ฐ_Pay_Per_Use-purple?style=for-the-badge" alt="Pay per use">
|
|
15
|
+
<img src="https://img.shields.io/badge/โ_Base_+_Solana-green?style=for-the-badge" alt="Base + Solana">
|
|
13
16
|
|
|
14
|
-
|
|
17
|
+
[](https://npmjs.com/package/@blockrun/cc)
|
|
18
|
+
[](https://npmjs.com/package/@blockrun/cc)
|
|
19
|
+
[](https://github.com/BlockRunAI/brcc)
|
|
20
|
+
[](https://typescriptlang.org)
|
|
21
|
+
[](LICENSE)
|
|
15
22
|
|
|
16
|
-
|
|
23
|
+
[](https://x402.org)
|
|
24
|
+
[](https://base.org)
|
|
25
|
+
[](https://solana.com)
|
|
26
|
+
[](https://blockrun.ai)
|
|
27
|
+
[](https://t.me/blockrunAI)
|
|
17
28
|
|
|
18
|
-
|
|
19
|
-
- **"Account disabled after payment"** โ 145 comments
|
|
20
|
-
- **"Phone verification โ unable to send code"** โ 546 comments
|
|
21
|
-
- **"5-hour limit reached in less than 1h30"** โ 108 comments
|
|
22
|
-
- **"Rate limit reached despite Max subscription"** โ 89 comments
|
|
29
|
+
</div>
|
|
23
30
|
|
|
24
|
-
|
|
31
|
+
> **brcc** is a local proxy that lets you run Claude Code with any LLM model โ GPT-5, Claude, Gemini, DeepSeek, Grok, and 40+ more โ without rate limits, without an Anthropic account, and without phone verification. You pay per request with USDC via the [x402](https://x402.org) protocol. Your wallet is your identity. Your private key never leaves your machine.
|
|
25
32
|
|
|
26
|
-
|
|
33
|
+
---
|
|
27
34
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
35
|
+
## Why brcc exists
|
|
36
|
+
|
|
37
|
+
Claude Code users are frustrated. Over **4,350 GitHub issue comments** about the same problems:
|
|
38
|
+
|
|
39
|
+
| | Issue | Comments |
|
|
40
|
+
|--|-------|----------|
|
|
41
|
+
| ๐ด | ["Instantly hitting usage limits with Max subscription"](https://github.com/anthropics/claude-code/issues/16157) | 1,252 |
|
|
42
|
+
| ๐ด | ["Phone verification โ unable to send code"](https://github.com/anthropics/claude-code/issues/34229) | 546 |
|
|
43
|
+
| ๐ด | ["Account disabled after payment"](https://github.com/anthropics/claude-code/issues/5088) | 145 |
|
|
44
|
+
| ๐ด | ["5-hour limit reached in less than 1h30"](https://github.com/anthropics/claude-code/issues/6457) | 108 |
|
|
45
|
+
| ๐ด | ["Rate limit reached despite Max subscription and only 16% usage"](https://github.com/anthropics/claude-code/issues/29579) | 89 |
|
|
46
|
+
|
|
47
|
+
**Every one of these people is a potential brcc user.**
|
|
48
|
+
|
|
49
|
+
brcc eliminates all of these problems:
|
|
50
|
+
|
|
51
|
+
- **No rate limits** โ pay per request, use as much as you want
|
|
52
|
+
- **No account** โ a wallet is generated locally, no signup
|
|
53
|
+
- **No phone verification** โ USDC is your authentication
|
|
54
|
+
- **No region restrictions** โ works everywhere, priced the same
|
|
55
|
+
- **No billing surprises** โ transparent per-token pricing
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## How it compares
|
|
60
|
+
|
|
61
|
+
| | Claude Max ($200/mo) | OpenRouter | **brcc** |
|
|
62
|
+
|--|---------------------|------------|----------|
|
|
63
|
+
| **Rate limits** | Constantly hit | Per-model limits | **None** |
|
|
64
|
+
| **Account required** | Yes + phone | Yes + email | **No** |
|
|
65
|
+
| **Models** | Claude only | 200+ (manual select) | **40+ (auto or manual)** |
|
|
66
|
+
| **Payment** | Credit card, subscription | Credit card, pre-pay | **USDC per-request** |
|
|
67
|
+
| **Auth** | OAuth + API key conflicts | API key | **Wallet signature** |
|
|
68
|
+
| **Pricing** | Opaque | Transparent | **Transparent** |
|
|
69
|
+
| **Runs locally** | N/A | No | **Yes (proxy)** |
|
|
70
|
+
| **Monthly cost** | $100-200 fixed | Varies | **$5-50 based on usage** |
|
|
71
|
+
|
|
72
|
+
---
|
|
33
73
|
|
|
34
74
|
## Quick Start
|
|
35
75
|
|
|
@@ -39,111 +79,59 @@ Claude Code --> brcc (local proxy) --> BlockRun API --> Any model
|
|
|
39
79
|
curl -fsSL https://raw.githubusercontent.com/BlockRunAI/brcc/main/install.sh | bash
|
|
40
80
|
```
|
|
41
81
|
|
|
42
|
-
Installs Node.js (if
|
|
82
|
+
Installs Node.js (if needed) + Claude Code + brcc + creates wallet.
|
|
43
83
|
|
|
44
84
|
### Manual install
|
|
45
85
|
|
|
46
86
|
```bash
|
|
47
|
-
#
|
|
87
|
+
# 1. Install Claude Code
|
|
48
88
|
curl -fsSL https://claude.ai/install.sh | bash
|
|
49
89
|
|
|
50
|
-
# Install brcc (use sudo on Linux)
|
|
51
|
-
npm install -g @blockrun/cc
|
|
90
|
+
# 2. Install brcc (use sudo on Linux)
|
|
91
|
+
sudo npm install -g @blockrun/cc # use sudo on Linux
|
|
52
92
|
|
|
53
|
-
# Create
|
|
54
|
-
brcc setup
|
|
55
|
-
#
|
|
56
|
-
|
|
93
|
+
# 3. Create wallet
|
|
94
|
+
brcc setup base # Base chain (Coinbase L2)
|
|
95
|
+
# or
|
|
96
|
+
brcc setup solana # Solana chain
|
|
57
97
|
|
|
58
|
-
# Fund your wallet
|
|
59
|
-
# Send $5-10 USDC on Base chain to your wallet address
|
|
60
|
-
# Buy USDC on Coinbase, send directly to your address
|
|
98
|
+
# 4. Fund your wallet with USDC (or use free models without funding)
|
|
61
99
|
|
|
62
|
-
# Launch
|
|
100
|
+
# 5. Launch
|
|
63
101
|
brcc start
|
|
64
102
|
```
|
|
65
103
|
|
|
66
104
|
That's it. Claude Code opens with access to 40+ models, no rate limits.
|
|
67
105
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
| Model | ~Requests per $5 | Best For |
|
|
71
|
-
|-------|-------------------|----------|
|
|
72
|
-
| Claude Sonnet 4.6 | ~100 | Coding (default) |
|
|
73
|
-
| GPT-5.4 | ~80 | Reasoning |
|
|
74
|
-
| Claude Haiku 4.5 | ~500 | Fast tasks |
|
|
75
|
-
| DeepSeek V3 | ~5,000 | Budget coding |
|
|
76
|
-
| GPT-OSS 120B | Unlimited | Free tier |
|
|
77
|
-
|
|
78
|
-
## Why brcc vs Claude Max Subscription
|
|
79
|
-
|
|
80
|
-
| | Claude Max ($100-200/mo) | brcc |
|
|
81
|
-
|--|--------------------------|------|
|
|
82
|
-
| **Rate limits** | Constantly hit | None |
|
|
83
|
-
| **Account locks** | Common | Impossible โ no account |
|
|
84
|
-
| **Phone verification** | Required | Not needed |
|
|
85
|
-
| **Pricing** | Opaque, subscription | Transparent, pay-per-token |
|
|
86
|
-
| **Region restrictions** | Some countries blocked | Works everywhere |
|
|
87
|
-
| **Models** | Claude only | 40+ models (GPT, Gemini, DeepSeek...) |
|
|
88
|
-
| **Monthly cost** | $100-200 fixed | $5-50 based on usage |
|
|
89
|
-
| **Auth issues** | OAuth, API key conflicts | Wallet = identity |
|
|
90
|
-
|
|
91
|
-
## Commands
|
|
106
|
+
---
|
|
92
107
|
|
|
93
|
-
|
|
108
|
+
## Choosing Models
|
|
94
109
|
|
|
95
|
-
|
|
110
|
+
### From the command line
|
|
96
111
|
|
|
97
112
|
```bash
|
|
98
|
-
brcc
|
|
99
|
-
brcc
|
|
100
|
-
brcc
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
```
|
|
104
|
-
$ brcc setup base
|
|
105
|
-
Wallet created!
|
|
106
|
-
Address: 0xCC8c44AD3dc2A58D841c3EB26131E49b22665EF8
|
|
107
|
-
Send USDC on Base to this address to fund your account.
|
|
108
|
-
Chain: base โ saved to ~/.blockrun/
|
|
113
|
+
brcc start # Default (Claude Sonnet 4.6)
|
|
114
|
+
brcc start --model nvidia/gpt-oss-120b # Free โ no USDC needed
|
|
115
|
+
brcc start --model openai/gpt-5.4 # GPT-5.4
|
|
116
|
+
brcc start --model deepseek/deepseek-chat # Budget coding ($0.28/M)
|
|
117
|
+
brcc start --model anthropic/claude-opus-4.6 # Most capable
|
|
109
118
|
```
|
|
110
119
|
|
|
111
|
-
|
|
120
|
+
### Inside Claude Code
|
|
112
121
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
Starts the payment proxy and launches Claude Code.
|
|
116
|
-
|
|
117
|
-
```
|
|
118
|
-
$ brcc start
|
|
119
|
-
brcc โ BlockRun Claude Code
|
|
120
|
-
|
|
121
|
-
Wallet: 0xCC8c...5EF8
|
|
122
|
-
Proxy: http://localhost:8402
|
|
123
|
-
Backend: https://blockrun.ai/api
|
|
122
|
+
Use `/model` to switch between Sonnet, Opus, and Haiku. Each maps to the BlockRun model you've configured:
|
|
124
123
|
|
|
125
|
-
Starting Claude Code...
|
|
126
|
-
```
|
|
127
|
-
|
|
128
|
-
Options:
|
|
129
124
|
```bash
|
|
130
|
-
|
|
131
|
-
brcc
|
|
132
|
-
brcc
|
|
133
|
-
brcc
|
|
134
|
-
brcc start --no-launch # Proxy only
|
|
135
|
-
brcc start -p 9000 # Custom port
|
|
125
|
+
# Customize what each /model option routes to
|
|
126
|
+
brcc config set sonnet-model anthropic/claude-sonnet-4.6 # default
|
|
127
|
+
brcc config set opus-model anthropic/claude-opus-4.6 # default
|
|
128
|
+
brcc config set haiku-model deepseek/deepseek-chat # cheap alternative
|
|
136
129
|
```
|
|
137
130
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
### `brcc models`
|
|
131
|
+
### List all models
|
|
141
132
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
```
|
|
133
|
+
```bash
|
|
145
134
|
$ brcc models
|
|
146
|
-
Available Models
|
|
147
135
|
|
|
148
136
|
Free Models (no USDC needed)
|
|
149
137
|
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
@@ -158,91 +146,133 @@ Paid Models
|
|
|
158
146
|
openai/gpt-5.4 $2.50/M $15.00/M
|
|
159
147
|
anthropic/claude-sonnet-4.6 $3.00/M $15.00/M
|
|
160
148
|
anthropic/claude-opus-4.6 $5.00/M $25.00/M
|
|
161
|
-
...
|
|
149
|
+
... (31 models total)
|
|
162
150
|
```
|
|
163
151
|
|
|
164
|
-
|
|
152
|
+
---
|
|
165
153
|
|
|
166
|
-
|
|
154
|
+
## What $5 Gets You
|
|
167
155
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
156
|
+
| Model | ~Requests per $5 | Best For |
|
|
157
|
+
|-------|-------------------|----------|
|
|
158
|
+
| DeepSeek V3 | ~5,000 | Budget coding |
|
|
159
|
+
| Claude Haiku 4.5 | ~500 | Fast tasks |
|
|
160
|
+
| Claude Sonnet 4.6 | ~100 | General coding |
|
|
161
|
+
| GPT-5.4 | ~80 | Reasoning |
|
|
162
|
+
| Claude Opus 4.6 | ~50 | Most capable |
|
|
163
|
+
| GPT-OSS 120B | **Unlimited** | Free tier |
|
|
171
164
|
|
|
172
|
-
|
|
173
|
-
brcc config set sonnet-model openai/gpt-5.4
|
|
165
|
+
---
|
|
174
166
|
|
|
175
|
-
|
|
176
|
-
brcc config set default-model nvidia/gpt-oss-120b
|
|
167
|
+
## Commands
|
|
177
168
|
|
|
178
|
-
|
|
179
|
-
|
|
169
|
+
| Command | Description |
|
|
170
|
+
|---------|-------------|
|
|
171
|
+
| `brcc setup [base\|solana]` | Create wallet for payments |
|
|
172
|
+
| `brcc start [--model <id>]` | Start proxy + launch Claude Code |
|
|
173
|
+
| `brcc models` | List all models with pricing |
|
|
174
|
+
| `brcc balance` | Check wallet USDC balance |
|
|
175
|
+
| `brcc config set <key> <value>` | Configure model mappings |
|
|
176
|
+
| `brcc config list` | View current settings |
|
|
177
|
+
|
|
178
|
+
### `brcc setup`
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
brcc setup # Default: Base chain
|
|
182
|
+
brcc setup base # Coinbase L2 โ low fees, fast
|
|
183
|
+
brcc setup solana # Solana โ also low fees, fast
|
|
180
184
|
```
|
|
181
185
|
|
|
182
|
-
|
|
186
|
+
Your wallet is saved to `~/.blockrun/` and shared with all BlockRun tools.
|
|
183
187
|
|
|
184
|
-
|
|
188
|
+
### `brcc start`
|
|
185
189
|
|
|
190
|
+
```bash
|
|
191
|
+
brcc start # Default model
|
|
192
|
+
brcc start --model nvidia/gpt-oss-120b # Free model
|
|
193
|
+
brcc start --model openai/gpt-5.4 # Specific model
|
|
194
|
+
brcc start --no-launch # Proxy only mode
|
|
195
|
+
brcc start -p 9000 # Custom port
|
|
186
196
|
```
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
197
|
+
|
|
198
|
+
### `brcc config`
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
brcc config set default-model nvidia/gpt-oss-120b
|
|
202
|
+
brcc config set sonnet-model openai/gpt-5.4
|
|
203
|
+
brcc config set opus-model anthropic/claude-opus-4.6
|
|
204
|
+
brcc config set haiku-model deepseek/deepseek-chat
|
|
205
|
+
brcc config list
|
|
190
206
|
```
|
|
191
207
|
|
|
208
|
+
---
|
|
209
|
+
|
|
192
210
|
## How It Works
|
|
193
211
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
212
|
+
```
|
|
213
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
214
|
+
โ Claude Code โ
|
|
215
|
+
โ (thinks it's talking to Anthropic) โ
|
|
216
|
+
โโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
217
|
+
โ Anthropic Messages API format
|
|
218
|
+
โผ
|
|
219
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
220
|
+
โ brcc proxy (localhost:8402) โ
|
|
221
|
+
โ โ
|
|
222
|
+
โ 1. Receives request from Claude Code โ
|
|
223
|
+
โ 2. Replaces model name (if --model set) โ
|
|
224
|
+
โ 3. Signs x402 USDC payment with your wallet โ
|
|
225
|
+
โ 4. Forwards to BlockRun API โ
|
|
226
|
+
โ 5. Streams response back to Claude Code โ
|
|
227
|
+
โโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
228
|
+
โ + x402 payment signature
|
|
229
|
+
โผ
|
|
230
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
231
|
+
โ BlockRun API (blockrun.ai or sol.blockrun.ai) โ
|
|
232
|
+
โ โ
|
|
233
|
+
โ Routes to: GPT-5 ยท Claude ยท Gemini ยท DeepSeek ยท Grok ยท โ
|
|
234
|
+
โ NVIDIA ยท MiniMax ยท Moonshot ยท 40+ models โ
|
|
235
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
Your private key stays on your machine. Only payment signatures are sent.
|
|
200
239
|
|
|
201
|
-
|
|
240
|
+
---
|
|
202
241
|
|
|
203
242
|
## Funding Your Wallet
|
|
204
243
|
|
|
205
|
-
brcc uses USDC
|
|
206
|
-
|
|
207
|
-
1. **Buy USDC** on [Coinbase](https://coinbase.com), [Binance](https://binance.com), or any exchange
|
|
208
|
-
2. **Send USDC** to your brcc wallet address (shown in `brcc setup`)
|
|
209
|
-
3. **Make sure it's on Base chain** โ not Ethereum mainnet
|
|
244
|
+
brcc uses USDC โ a dollar-pegged stablecoin. No crypto volatility.
|
|
210
245
|
|
|
211
|
-
|
|
246
|
+
**Base chain (default):**
|
|
247
|
+
1. Buy USDC on [Coinbase](https://coinbase.com)
|
|
248
|
+
2. Send to your brcc wallet address (shown in `brcc setup`)
|
|
249
|
+
3. Make sure it's on **Base** network (not Ethereum mainnet)
|
|
212
250
|
|
|
213
|
-
|
|
251
|
+
**Solana chain:**
|
|
252
|
+
1. Buy USDC on any exchange
|
|
253
|
+
2. Send to your brcc Solana address
|
|
254
|
+
3. Send on **Solana** network
|
|
214
255
|
|
|
215
|
-
|
|
256
|
+
Typical cost: **$0.001โ$0.05 per interaction**. $5 lasts most developers a week.
|
|
216
257
|
|
|
217
|
-
|
|
218
|
-
- **Anthropic**: Claude Opus 4.6, Sonnet 4.6, Haiku 4.5
|
|
219
|
-
- **Google**: Gemini 3.1 Pro, 2.5 Pro, 2.5 Flash
|
|
220
|
-
- **DeepSeek**: V3, Reasoner
|
|
221
|
-
- **xAI**: Grok 3, Grok 4
|
|
222
|
-
- **Free**: NVIDIA GPT-OSS 120B (no payment needed)
|
|
258
|
+
---
|
|
223
259
|
|
|
224
260
|
## FAQ
|
|
225
261
|
|
|
226
|
-
**
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
**Q: Do I need an Anthropic account?**
|
|
230
|
-
A: No. brcc bypasses Anthropic entirely. You don't need an Anthropic account, API key, or subscription.
|
|
231
|
-
|
|
232
|
-
**Q: Is my wallet safe?**
|
|
233
|
-
A: Your private key stays on your machine (`~/.blockrun/.session`, chmod 600). It's only used for local signing โ never transmitted over the network.
|
|
262
|
+
**Do I need an Anthropic account?**
|
|
263
|
+
No. brcc connects Claude Code to BlockRun instead of Anthropic.
|
|
234
264
|
|
|
235
|
-
**
|
|
236
|
-
|
|
265
|
+
**Can I use non-Claude models?**
|
|
266
|
+
Yes. GPT-5, Gemini, DeepSeek, Grok, and 30+ others work through Claude Code via brcc.
|
|
237
267
|
|
|
238
|
-
|
|
239
|
-
A: Yes. Claude Code works with any model that speaks the Anthropic Messages API format. Through brcc, you can use GPT-5, Gemini, DeepSeek, and 30+ other models.
|
|
268
|
+
---
|
|
240
269
|
|
|
241
270
|
## Links
|
|
242
271
|
|
|
243
272
|
- [BlockRun](https://blockrun.ai) โ The AI gateway powering brcc
|
|
244
|
-
- [
|
|
245
|
-
- [
|
|
273
|
+
- [npm package](https://npmjs.com/package/@blockrun/cc)
|
|
274
|
+
- [Roadmap](docs/ROADMAP.md)
|
|
275
|
+
- [Telegram](https://t.me/blockrunAI)
|
|
246
276
|
- [GitHub Issues](https://github.com/BlockRunAI/brcc/issues)
|
|
247
277
|
|
|
248
278
|
## License
|
package/dist/proxy/server.js
CHANGED
|
@@ -29,13 +29,22 @@ export function createProxy(options) {
|
|
|
29
29
|
});
|
|
30
30
|
req.on('end', async () => {
|
|
31
31
|
try {
|
|
32
|
-
if (
|
|
32
|
+
if (body) {
|
|
33
33
|
try {
|
|
34
34
|
const parsed = JSON.parse(body);
|
|
35
|
-
if (parsed.model) {
|
|
35
|
+
if (options.modelOverride && parsed.model) {
|
|
36
36
|
parsed.model = options.modelOverride;
|
|
37
|
-
body = JSON.stringify(parsed);
|
|
38
37
|
}
|
|
38
|
+
if (parsed.max_tokens) {
|
|
39
|
+
const model = (parsed.model || '').toLowerCase();
|
|
40
|
+
if (model.includes('deepseek') || model.includes('haiku') || model.includes('gpt-oss')) {
|
|
41
|
+
parsed.max_tokens = Math.min(parsed.max_tokens, 8192);
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
parsed.max_tokens = Math.min(parsed.max_tokens, 16384);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
body = JSON.stringify(parsed);
|
|
39
48
|
}
|
|
40
49
|
catch { /* not JSON, pass through */ }
|
|
41
50
|
}
|