Commit 429a6dd
authored
🤖 feat: add OpenAI promptCacheKey for improved caching (#1174)
Wire AI SDK's `providerOptions.openai.promptCacheKey` to improve OpenAI
prompt cache hit rates.
## Changes
- Derive cache key as `mux-v1-{workspaceId}` for OpenAI requests
- Pass workspaceId from `AIService.streamMessage` to
`buildProviderOptions`
- Only set promptCacheKey when workspaceId is available (always true in
real requests)
This enables OpenAI to route requests to cached prefixes within a
workspace, improving cache hit rates for repeated calls.
---
_Generated with `mux` • Model: `anthropic:claude-opus-4-5` • Thinking:
`high`_1 parent e1be6b4 commit 429a6dd
File tree
3 files changed
+59
-2
lines changed- src
- common/utils/ai
- node/services
3 files changed
+59
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
120 | 121 | | |
121 | 122 | | |
122 | 123 | | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
| 68 | + | |
| 69 | + | |
69 | 70 | | |
70 | 71 | | |
71 | 72 | | |
| |||
210 | 211 | | |
211 | 212 | | |
212 | 213 | | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
213 | 219 | | |
214 | 220 | | |
215 | 221 | | |
216 | 222 | | |
217 | 223 | | |
| 224 | + | |
218 | 225 | | |
219 | 226 | | |
220 | 227 | | |
| |||
225 | 232 | | |
226 | 233 | | |
227 | 234 | | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
228 | 238 | | |
229 | 239 | | |
230 | 240 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1370 | 1370 | | |
1371 | 1371 | | |
1372 | 1372 | | |
| 1373 | + | |
1373 | 1374 | | |
1374 | 1375 | | |
1375 | 1376 | | |
1376 | 1377 | | |
1377 | 1378 | | |
1378 | | - | |
| 1379 | + | |
| 1380 | + | |
1379 | 1381 | | |
1380 | 1382 | | |
1381 | 1383 | | |
| |||
0 commit comments