@@ -51,6 +51,9 @@ class CellArgs(BaseModel):
51
51
region_name : Optional [str ] = None
52
52
request_schema : Optional [str ] = None
53
53
response_path : Optional [str ] = None
54
+ # Parameters for custom API endpoints
55
+ api_base : Optional [str ] = None
56
+ api_key_name : Optional [str ] = None
54
57
55
58
56
59
# Should match CellArgs
@@ -63,6 +66,9 @@ class FixArgs(BaseModel):
63
66
region_name : Optional [str ] = None
64
67
request_schema : Optional [str ] = None
65
68
response_path : Optional [str ] = None
69
+ # Parameters for custom API endpoints
70
+ api_base : Optional [str ] = None
71
+ api_key_name : Optional [str ] = None
66
72
67
73
68
74
class HelpArgs (BaseModel ):
@@ -133,6 +139,16 @@ def verify_json_value(ctx, param, value):
133
139
default = "markdown" ,
134
140
help = FORMAT_HELP ,
135
141
)
142
+ @click .option (
143
+ "--api-base" ,
144
+ required = False ,
145
+ help = "Base URL for the API endpoint." ,
146
+ )
147
+ @click .option (
148
+ "--api-key-name" ,
149
+ required = False ,
150
+ help = "Name of the environment variable containing the API key." ,
151
+ )
136
152
@click .option (
137
153
REGION_NAME_SHORT_OPTION ,
138
154
REGION_NAME_LONG_OPTION ,
@@ -168,6 +184,11 @@ def cell_magic_parser(context: click.Context, **kwargs):
168
184
model IDs (with the provider ID explicitly prefixed, followed by a colon)
169
185
are accepted.
170
186
187
+ Optional parameters:
188
+ --api-base: Base URL for the API endpoint
189
+ --api-key-name: Name of the environment variable containing the API key
190
+ (the actual key should be stored in the .env file)
191
+
171
192
To view available language models, please run `%ai list`.
172
193
"""
173
194
if not kwargs ["model_id" ] and context .default_map :
@@ -191,6 +212,16 @@ def line_magic_parser():
191
212
default = "markdown" ,
192
213
help = FORMAT_HELP ,
193
214
)
215
+ @click .option (
216
+ "--api-base" ,
217
+ required = False ,
218
+ help = "Base URL for the API endpoint." ,
219
+ )
220
+ @click .option (
221
+ "--api-key-name" ,
222
+ required = False ,
223
+ help = "Name of the environment variable containing the API key." ,
224
+ )
194
225
@click .option (
195
226
REGION_NAME_SHORT_OPTION ,
196
227
REGION_NAME_LONG_OPTION ,
0 commit comments