Commit 85a75b2
committed
feat: Add ExtraBody/ExtraFields support for custom OpenAI-compatible API parameters
This change enables passing custom parameters to OpenAI-compatible API
providers via the provider config's extra_body field. The implementation
maps extra_body to Fantasy's extra_fields, which are then passed through
to the underlying OpenAI SDK's SetExtraFields() method.
Key changes:
- Added extra_body mapping to extra_fields in getProviderOptions()
- Merge extra_body options into provider options chain
- Uses charm.land/fantasy v0.1.1 with ExtraFields support
This enables advanced provider features like Z.AI GLM's thinking mode:
{
"providers": {
"z.ai": {
"extra_body": {
"thinking": {
"type": "enabled",
"budget_tokens": 26214
}
}
}
}
}
The extra_body parameters are correctly passed through the HTTP request
to the provider API.1 parent 35c05ff commit 85a75b2
2 files changed
+21
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
53 | 58 | | |
54 | 59 | | |
55 | 60 | | |
| |||
58 | 63 | | |
59 | 64 | | |
60 | 65 | | |
61 | | - | |
62 | 66 | | |
63 | 67 | | |
64 | 68 | | |
| |||
158 | 162 | | |
159 | 163 | | |
160 | 164 | | |
161 | | - | |
162 | 165 | | |
163 | 166 | | |
164 | 167 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
| 145 | + | |
145 | 146 | | |
146 | 147 | | |
147 | 148 | | |
| |||
164 | 165 | | |
165 | 166 | | |
166 | 167 | | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
167 | 182 | | |
168 | 183 | | |
169 | 184 | | |
| 185 | + | |
170 | 186 | | |
171 | 187 | | |
172 | 188 | | |
| |||
0 commit comments