1## Web search calls
2
3**get** `/organization/usage/web_search_calls`
4
5Get web search calls usage details for the organization.
6
7### Query Parameters
8
9- `start_time: number`
10
11 Start time (Unix seconds) of the query time range, inclusive.
12
13- `api_key_ids: optional array of string`
14
15 Return only usage for these API keys.
16
17- `bucket_width: optional "1m" or "1h" or "1d"`
18
19 Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`.
20
21 - `"1m"`
22
23 - `"1h"`
24
25 - `"1d"`
26
27- `context_levels: optional array of "low" or "medium" or "high"`
28
29 Return only web search usage for these context levels.
30
31 - `"low"`
32
33 - `"medium"`
34
35 - `"high"`
36
37- `end_time: optional number`
38
39 End time (Unix seconds) of the query time range, exclusive.
40
41- `group_by: optional array of "project_id" or "user_id" or "api_key_id" or 2 more`
42
43 Group the usage data by the specified fields. Support fields include `project_id`, `user_id`, `api_key_id`, `model`, `context_level` or any combination of them.
44
45 - `"project_id"`
46
47 - `"user_id"`
48
49 - `"api_key_id"`
50
51 - `"model"`
52
53 - `"context_level"`
54
55- `limit: optional number`
56
57 Specifies the number of buckets to return.
58
59 - `bucket_width=1d`: default: 7, max: 31
60 - `bucket_width=1h`: default: 24, max: 168
61 - `bucket_width=1m`: default: 60, max: 1440
62
63- `models: optional array of string`
64
65 Return only usage for these models.
66
67- `page: optional string`
68
69 A cursor for use in pagination. Corresponding to the `next_page` field from the previous response.
70
71- `project_ids: optional array of string`
72
73 Return only usage for these projects.
74
75- `user_ids: optional array of string`
76
77 Return only usage for these users.
78
79### Returns
80
81- `data: array of object { end_time, object, results, start_time }`
82
83 - `end_time: number`
84
85 - `object: "bucket"`
86
87 - `"bucket"`
88
89 - `results: array of object { input_tokens, num_model_requests, object, 10 more } or object { input_tokens, num_model_requests, object, 4 more } or object { input_tokens, num_model_requests, object, 4 more } or 8 more`
90
91 - `OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }`
92
93 The aggregated completions usage details of the specific time bucket.
94
95 - `input_tokens: number`
96
97 The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.
98
99 - `num_model_requests: number`
100
101 The count of requests made to the model.
102
103 - `object: "organization.usage.completions.result"`
104
105 - `"organization.usage.completions.result"`
106
107 - `output_tokens: number`
108
109 The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.
110
111 - `api_key_id: optional string`
112
113 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.
114
115 - `batch: optional boolean`
116
117 When `group_by=batch`, this field tells whether the grouped usage result is batch or not.
118
119 - `input_audio_tokens: optional number`
120
121 The aggregated number of audio input tokens used, including cached tokens.
122
123 - `input_cached_tokens: optional number`
124
125 The aggregated number of text input tokens that has been cached from previous requests. For customers subscribe to scale tier, this includes scale tier tokens.
126
127 - `model: optional string`
128
129 When `group_by=model`, this field provides the model name of the grouped usage result.
130
131 - `output_audio_tokens: optional number`
132
133 The aggregated number of audio output tokens used.
134
135 - `project_id: optional string`
136
137 When `group_by=project_id`, this field provides the project ID of the grouped usage result.
138
139 - `service_tier: optional string`
140
141 When `group_by=service_tier`, this field provides the service tier of the grouped usage result.
142
143 - `user_id: optional string`
144
145 When `group_by=user_id`, this field provides the user ID of the grouped usage result.
146
147 - `OrganizationUsageEmbeddingsResult object { input_tokens, num_model_requests, object, 4 more }`
148
149 The aggregated embeddings usage details of the specific time bucket.
150
151 - `input_tokens: number`
152
153 The aggregated number of input tokens used.
154
155 - `num_model_requests: number`
156
157 The count of requests made to the model.
158
159 - `object: "organization.usage.embeddings.result"`
160
161 - `"organization.usage.embeddings.result"`
162
163 - `api_key_id: optional string`
164
165 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.
166
167 - `model: optional string`
168
169 When `group_by=model`, this field provides the model name of the grouped usage result.
170
171 - `project_id: optional string`
172
173 When `group_by=project_id`, this field provides the project ID of the grouped usage result.
174
175 - `user_id: optional string`
176
177 When `group_by=user_id`, this field provides the user ID of the grouped usage result.
178
179 - `OrganizationUsageModerationsResult object { input_tokens, num_model_requests, object, 4 more }`
180
181 The aggregated moderations usage details of the specific time bucket.
182
183 - `input_tokens: number`
184
185 The aggregated number of input tokens used.
186
187 - `num_model_requests: number`
188
189 The count of requests made to the model.
190
191 - `object: "organization.usage.moderations.result"`
192
193 - `"organization.usage.moderations.result"`
194
195 - `api_key_id: optional string`
196
197 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.
198
199 - `model: optional string`
200
201 When `group_by=model`, this field provides the model name of the grouped usage result.
202
203 - `project_id: optional string`
204
205 When `group_by=project_id`, this field provides the project ID of the grouped usage result.
206
207 - `user_id: optional string`
208
209 When `group_by=user_id`, this field provides the user ID of the grouped usage result.
210
211 - `OrganizationUsageImagesResult object { images, num_model_requests, object, 6 more }`
212
213 The aggregated images usage details of the specific time bucket.
214
215 - `images: number`
216
217 The number of images processed.
218
219 - `num_model_requests: number`
220
221 The count of requests made to the model.
222
223 - `object: "organization.usage.images.result"`
224
225 - `"organization.usage.images.result"`
226
227 - `api_key_id: optional string`
228
229 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.
230
231 - `model: optional string`
232
233 When `group_by=model`, this field provides the model name of the grouped usage result.
234
235 - `project_id: optional string`
236
237 When `group_by=project_id`, this field provides the project ID of the grouped usage result.
238
239 - `size: optional string`
240
241 When `group_by=size`, this field provides the image size of the grouped usage result.
242
243 - `source: optional string`
244
245 When `group_by=source`, this field provides the source of the grouped usage result, possible values are `image.generation`, `image.edit`, `image.variation`.
246
247 - `user_id: optional string`
248
249 When `group_by=user_id`, this field provides the user ID of the grouped usage result.
250
251 - `OrganizationUsageAudioSpeechesResult object { characters, num_model_requests, object, 4 more }`
252
253 The aggregated audio speeches usage details of the specific time bucket.
254
255 - `characters: number`
256
257 The number of characters processed.
258
259 - `num_model_requests: number`
260
261 The count of requests made to the model.
262
263 - `object: "organization.usage.audio_speeches.result"`
264
265 - `"organization.usage.audio_speeches.result"`
266
267 - `api_key_id: optional string`
268
269 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.
270
271 - `model: optional string`
272
273 When `group_by=model`, this field provides the model name of the grouped usage result.
274
275 - `project_id: optional string`
276
277 When `group_by=project_id`, this field provides the project ID of the grouped usage result.
278
279 - `user_id: optional string`
280
281 When `group_by=user_id`, this field provides the user ID of the grouped usage result.
282
283 - `OrganizationUsageAudioTranscriptionsResult object { num_model_requests, object, seconds, 4 more }`
284
285 The aggregated audio transcriptions usage details of the specific time bucket.
286
287 - `num_model_requests: number`
288
289 The count of requests made to the model.
290
291 - `object: "organization.usage.audio_transcriptions.result"`
292
293 - `"organization.usage.audio_transcriptions.result"`
294
295 - `seconds: number`
296
297 The number of seconds processed.
298
299 - `api_key_id: optional string`
300
301 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.
302
303 - `model: optional string`
304
305 When `group_by=model`, this field provides the model name of the grouped usage result.
306
307 - `project_id: optional string`
308
309 When `group_by=project_id`, this field provides the project ID of the grouped usage result.
310
311 - `user_id: optional string`
312
313 When `group_by=user_id`, this field provides the user ID of the grouped usage result.
314
315 - `OrganizationUsageVectorStoresResult object { object, usage_bytes, project_id }`
316
317 The aggregated vector stores usage details of the specific time bucket.
318
319 - `object: "organization.usage.vector_stores.result"`
320
321 - `"organization.usage.vector_stores.result"`
322
323 - `usage_bytes: number`
324
325 The vector stores usage in bytes.
326
327 - `project_id: optional string`
328
329 When `group_by=project_id`, this field provides the project ID of the grouped usage result.
330
331 - `OrganizationUsageCodeInterpreterSessionsResult object { num_sessions, object, project_id }`
332
333 The aggregated code interpreter sessions usage details of the specific time bucket.
334
335 - `num_sessions: number`
336
337 The number of code interpreter sessions.
338
339 - `object: "organization.usage.code_interpreter_sessions.result"`
340
341 - `"organization.usage.code_interpreter_sessions.result"`
342
343 - `project_id: optional string`
344
345 When `group_by=project_id`, this field provides the project ID of the grouped usage result.
346
347 - `OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }`
348
349 The aggregated file search calls usage details of the specific time bucket.
350
351 - `num_requests: number`
352
353 The count of file search calls.
354
355 - `object: "organization.usage.file_searches.result"`
356
357 - `"organization.usage.file_searches.result"`
358
359 - `api_key_id: optional string`
360
361 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.
362
363 - `project_id: optional string`
364
365 When `group_by=project_id`, this field provides the project ID of the grouped usage result.
366
367 - `user_id: optional string`
368
369 When `group_by=user_id`, this field provides the user ID of the grouped usage result.
370
371 - `vector_store_id: optional string`
372
373 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.
374
375 - `OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }`
376
377 The aggregated web search calls usage details of the specific time bucket.
378
379 - `num_model_requests: number`
380
381 The count of model requests.
382
383 - `num_requests: number`
384
385 The count of web search calls.
386
387 - `object: "organization.usage.web_searches.result"`
388
389 - `"organization.usage.web_searches.result"`
390
391 - `api_key_id: optional string`
392
393 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.
394
395 - `context_level: optional string`
396
397 When `group_by=context_level`, this field provides the search context size of the grouped usage result.
398
399 - `model: optional string`
400
401 When `group_by=model`, this field provides the model name of the grouped usage result.
402
403 - `project_id: optional string`
404
405 When `group_by=project_id`, this field provides the project ID of the grouped usage result.
406
407 - `user_id: optional string`
408
409 When `group_by=user_id`, this field provides the user ID of the grouped usage result.
410
411 - `OrganizationCostsResult object { object, amount, api_key_id, 3 more }`
412
413 The aggregated costs details of the specific time bucket.
414
415 - `object: "organization.costs.result"`
416
417 - `"organization.costs.result"`
418
419 - `amount: optional object { currency, value }`
420
421 The monetary value in its associated currency.
422
423 - `currency: optional string`
424
425 Lowercase ISO-4217 currency e.g. "usd"
426
427 - `value: optional number`
428
429 The numeric value of the cost.
430
431 - `api_key_id: optional string`
432
433 When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result.
434
435 - `line_item: optional string`
436
437 When `group_by=line_item`, this field provides the line item of the grouped costs result.
438
439 - `project_id: optional string`
440
441 When `group_by=project_id`, this field provides the project ID of the grouped costs result.
442
443 - `quantity: optional number`
444
445 When `group_by=line_item`, this field provides the quantity of the grouped costs result.
446
447 - `start_time: number`
448
449- `has_more: boolean`
450
451- `next_page: string`
452
453- `object: "page"`
454
455 - `"page"`
456
457### Example
458
459```http
460curl https://api.openai.com/v1/organization/usage/web_search_calls \
461 -H "Authorization: Bearer $OPENAI_ADMIN_KEY"
462```
463
464#### Response
465
466```json
467{
468 "data": [
469 {
470 "end_time": 0,
471 "object": "bucket",
472 "results": [
473 {
474 "input_tokens": 0,
475 "num_model_requests": 0,
476 "object": "organization.usage.completions.result",
477 "output_tokens": 0,
478 "api_key_id": "api_key_id",
479 "batch": true,
480 "input_audio_tokens": 0,
481 "input_cached_tokens": 0,
482 "model": "model",
483 "output_audio_tokens": 0,
484 "project_id": "project_id",
485 "service_tier": "service_tier",
486 "user_id": "user_id"
487 }
488 ],
489 "start_time": 0
490 }
491 ],
492 "has_more": true,
493 "next_page": "next_page",
494 "object": "page"
495}
496```
497
498### Example
499
500```http
501curl "https://api.openai.com/v1/organization/usage/web_search_calls?start_time=1730419200&limit=1" \
502-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
503-H "Content-Type: application/json"
504```
505
506#### Response
507
508```json
509{
510 "object": "page",
511 "data": [
512 {
513 "object": "bucket",
514 "start_time": 1730419200,
515 "end_time": 1730505600,
516 "results": [
517 {
518 "object": "organization.usage.web_searches.result",
519 "num_model_requests": 2,
520 "num_requests": 2,
521 "project_id": null,
522 "user_id": null,
523 "api_key_id": null,
524 "model": null,
525 "context_level": null
526 }
527 ]
528 }
529 ],
530 "has_more": false,
531 "next_page": null
532}
533```