SpyBara
Go Premium

Reference 2026-05-11 18:00 UTC to 2026-05-18 22:01 UTC

164 files changed +14,607 −57. View all changes and history on the product overview
2026
Wed 27 06:42 Fri 22 06:33 Wed 20 06:35 Tue 19 06:34 Mon 18 22:01 Mon 11 18:00 Thu 7 21:57 Tue 5 23:00 Sat 2 05:57
Details

18 18 

19- `--project: optional array of object { id, role }`19- `--project: optional array of object { id, role }`

20 20 

21 An array of projects to which membership is granted at the same time the org invite is accepted. If omitted, the user will be invited to the default project for compatibility with legacy behavior.21 An array of projects to which membership is granted at the same time the org invite is accepted. If omitted, the user will be invited to the default project for compatibility with legacy behavior. If empty list is passed, the user will not be invited to any projects, including the default one.

22 22 

23### Returns23### Returns

24 24 

Details

1## Retrieve project hosted tool permissions

2 

3`$ openai admin:organization:projects:hosted-tool-permissions retrieve`

4 

5**get** `/organization/projects/{project_id}/hosted_tool_permissions`

6 

7Returns hosted tool permissions for a project.

8 

9### Parameters

10 

11- `--project-id: string`

12 

13 The ID of the project.

14 

15### Returns

16 

17- `project_hosted_tool_permissions: object { code_interpreter, file_search, image_generation, 2 more }`

18 

19 Represents hosted tool permissions for a project.

20 

21 - `code_interpreter: object { enabled }`

22 

23 Permission state for a single hosted tool on a project.

24 

25 - `enabled: boolean`

26 

27 Whether the hosted tool is enabled for the project.

28 

29 - `file_search: object { enabled }`

30 

31 Permission state for a single hosted tool on a project.

32 

33 - `enabled: boolean`

34 

35 Whether the hosted tool is enabled for the project.

36 

37 - `image_generation: object { enabled }`

38 

39 Permission state for a single hosted tool on a project.

40 

41 - `enabled: boolean`

42 

43 Whether the hosted tool is enabled for the project.

44 

45 - `mcp: object { enabled }`

46 

47 Permission state for a single hosted tool on a project.

48 

49 - `enabled: boolean`

50 

51 Whether the hosted tool is enabled for the project.

52 

53 - `web_search: object { enabled }`

54 

55 Permission state for a single hosted tool on a project.

56 

57 - `enabled: boolean`

58 

59 Whether the hosted tool is enabled for the project.

60 

61### Example

62 

63```cli

64openai admin:organization:projects:hosted-tool-permissions retrieve \

65 --admin-api-key 'My Admin API Key' \

66 --project-id project_id

67```

68 

69#### Response

70 

71```json

72{

73 "code_interpreter": {

74 "enabled": true

75 },

76 "file_search": {

77 "enabled": true

78 },

79 "image_generation": {

80 "enabled": true

81 },

82 "mcp": {

83 "enabled": true

84 },

85 "web_search": {

86 "enabled": true

87 }

88}

89```

Details

1## Modify project hosted tool permissions

2 

3`$ openai admin:organization:projects:hosted-tool-permissions update`

4 

5**post** `/organization/projects/{project_id}/hosted_tool_permissions`

6 

7Updates hosted tool permissions for a project.

8 

9### Parameters

10 

11- `--project-id: string`

12 

13 The ID of the project.

14 

15- `--code-interpreter: optional object { enabled }`

16 

17 The code interpreter permission update.

18 

19- `--file-search: optional object { enabled }`

20 

21 The file search permission update.

22 

23- `--image-generation: optional object { enabled }`

24 

25 The image generation permission update.

26 

27- `--mcp: optional object { enabled }`

28 

29 The MCP permission update.

30 

31- `--web-search: optional object { enabled }`

32 

33 The web search permission update.

34 

35### Returns

36 

37- `project_hosted_tool_permissions: object { code_interpreter, file_search, image_generation, 2 more }`

38 

39 Represents hosted tool permissions for a project.

40 

41 - `code_interpreter: object { enabled }`

42 

43 Permission state for a single hosted tool on a project.

44 

45 - `enabled: boolean`

46 

47 Whether the hosted tool is enabled for the project.

48 

49 - `file_search: object { enabled }`

50 

51 Permission state for a single hosted tool on a project.

52 

53 - `enabled: boolean`

54 

55 Whether the hosted tool is enabled for the project.

56 

57 - `image_generation: object { enabled }`

58 

59 Permission state for a single hosted tool on a project.

60 

61 - `enabled: boolean`

62 

63 Whether the hosted tool is enabled for the project.

64 

65 - `mcp: object { enabled }`

66 

67 Permission state for a single hosted tool on a project.

68 

69 - `enabled: boolean`

70 

71 Whether the hosted tool is enabled for the project.

72 

73 - `web_search: object { enabled }`

74 

75 Permission state for a single hosted tool on a project.

76 

77 - `enabled: boolean`

78 

79 Whether the hosted tool is enabled for the project.

80 

81### Example

82 

83```cli

84openai admin:organization:projects:hosted-tool-permissions update \

85 --admin-api-key 'My Admin API Key' \

86 --project-id project_id

87```

88 

89#### Response

90 

91```json

92{

93 "code_interpreter": {

94 "enabled": true

95 },

96 "file_search": {

97 "enabled": true

98 },

99 "image_generation": {

100 "enabled": true

101 },

102 "mcp": {

103 "enabled": true

104 },

105 "web_search": {

106 "enabled": true

107 }

108}

109```

Details

1## Delete project model permissions

2 

3`$ openai admin:organization:projects:model-permissions delete`

4 

5**delete** `/organization/projects/{project_id}/model_permissions`

6 

7Deletes model permissions for a project.

8 

9### Parameters

10 

11- `--project-id: string`

12 

13 The ID of the project.

14 

15### Returns

16 

17- `project_model_permissions_deleted: object { deleted, object }`

18 

19 Confirmation payload returned after deleting project model permissions.

20 

21 - `deleted: boolean`

22 

23 Whether the project model permissions were deleted.

24 

25 - `object: "project.model_permissions.deleted"`

26 

27 The object type, which is always `project.model_permissions.deleted`.

28 

29### Example

30 

31```cli

32openai admin:organization:projects:model-permissions delete \

33 --admin-api-key 'My Admin API Key' \

34 --project-id project_id

35```

36 

37#### Response

38 

39```json

40{

41 "deleted": true,

42 "object": "project.model_permissions.deleted"

43}

44```

Details

1## Retrieve project model permissions

2 

3`$ openai admin:organization:projects:model-permissions retrieve`

4 

5**get** `/organization/projects/{project_id}/model_permissions`

6 

7Returns model permissions for a project.

8 

9### Parameters

10 

11- `--project-id: string`

12 

13 The ID of the project.

14 

15### Returns

16 

17- `project_model_permissions: object { mode, model_ids, object }`

18 

19 Represents the model allowlist or denylist policy for a project.

20 

21 - `mode: "allow_list" or "deny_list"`

22 

23 Whether the project uses an allowlist or a denylist.

24 

25 - `"allow_list"`

26 

27 - `"deny_list"`

28 

29 - `model_ids: array of string`

30 

31 The model IDs included in the model permissions policy.

32 

33 - `object: "project.model_permissions"`

34 

35 The object type, which is always `project.model_permissions`.

36 

37### Example

38 

39```cli

40openai admin:organization:projects:model-permissions retrieve \

41 --admin-api-key 'My Admin API Key' \

42 --project-id project_id

43```

44 

45#### Response

46 

47```json

48{

49 "mode": "allow_list",

50 "model_ids": [

51 "string"

52 ],

53 "object": "project.model_permissions"

54}

55```

Details

1## Modify project model permissions

2 

3`$ openai admin:organization:projects:model-permissions update`

4 

5**post** `/organization/projects/{project_id}/model_permissions`

6 

7Updates model permissions for a project.

8 

9### Parameters

10 

11- `--project-id: string`

12 

13 The ID of the project.

14 

15- `--mode: "allow_list" or "deny_list"`

16 

17 The model permissions mode to apply.

18 

19- `--model-id: array of string`

20 

21 The model IDs included in this permissions policy.

22 

23### Returns

24 

25- `project_model_permissions: object { mode, model_ids, object }`

26 

27 Represents the model allowlist or denylist policy for a project.

28 

29 - `mode: "allow_list" or "deny_list"`

30 

31 Whether the project uses an allowlist or a denylist.

32 

33 - `"allow_list"`

34 

35 - `"deny_list"`

36 

37 - `model_ids: array of string`

38 

39 The model IDs included in the model permissions policy.

40 

41 - `object: "project.model_permissions"`

42 

43 The object type, which is always `project.model_permissions`.

44 

45### Example

46 

47```cli

48openai admin:organization:projects:model-permissions update \

49 --admin-api-key 'My Admin API Key' \

50 --project-id project_id \

51 --mode allow_list \

52 --model-id string

53```

54 

55#### Response

56 

57```json

58{

59 "mode": "allow_list",

60 "model_ids": [

61 "string"

62 ],

63 "object": "project.model_permissions"

64}

65```

Details

62 62 

63 - `object: "bucket"`63 - `object: "bucket"`

64 64 

65 - `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 6 more`65 - `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`

66 66 

67 - `organization.usage.completions.result: object { input_tokens, num_model_requests, object, 10 more }`67 - `organization.usage.completions.result: object { input_tokens, num_model_requests, object, 10 more }`

68 68 


304 304 

305 When `group_by=project_id`, this field provides the project ID of the grouped usage result.305 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

306 306 

307 - `organization.usage.file_searches.result: object { num_requests, object, api_key_id, 3 more }`

308 

309 The aggregated file search calls usage details of the specific time bucket.

310 

311 - `num_requests: number`

312 

313 The count of file search calls.

314 

315 - `object: "organization.usage.file_searches.result"`

316 

317 - `api_key_id: optional string`

318 

319 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

320 

321 - `project_id: optional string`

322 

323 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

324 

325 - `user_id: optional string`

326 

327 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

328 

329 - `vector_store_id: optional string`

330 

331 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

332 

333 - `organization.usage.web_searches.result: object { num_model_requests, num_requests, object, 5 more }`

334 

335 The aggregated web search calls usage details of the specific time bucket.

336 

337 - `num_model_requests: number`

338 

339 The count of model requests.

340 

341 - `num_requests: number`

342 

343 The count of web search calls.

344 

345 - `object: "organization.usage.web_searches.result"`

346 

347 - `api_key_id: optional string`

348 

349 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

350 

351 - `context_level: optional string`

352 

353 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

354 

355 - `model: optional string`

356 

357 When `group_by=model`, this field provides the model name of the grouped usage result.

358 

359 - `project_id: optional string`

360 

361 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

362 

363 - `user_id: optional string`

364 

365 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

366 

307 - `organization.costs.result: object { object, amount, api_key_id, 3 more }`367 - `organization.costs.result: object { object, amount, api_key_id, 3 more }`

308 368 

309 The aggregated costs details of the specific time bucket.369 The aggregated costs details of the specific time bucket.

Details

62 62 

63 - `object: "bucket"`63 - `object: "bucket"`

64 64 

65 - `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 6 more`65 - `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`

66 66 

67 - `organization.usage.completions.result: object { input_tokens, num_model_requests, object, 10 more }`67 - `organization.usage.completions.result: object { input_tokens, num_model_requests, object, 10 more }`

68 68 


304 304 

305 When `group_by=project_id`, this field provides the project ID of the grouped usage result.305 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

306 306 

307 - `organization.usage.file_searches.result: object { num_requests, object, api_key_id, 3 more }`

308 

309 The aggregated file search calls usage details of the specific time bucket.

310 

311 - `num_requests: number`

312 

313 The count of file search calls.

314 

315 - `object: "organization.usage.file_searches.result"`

316 

317 - `api_key_id: optional string`

318 

319 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

320 

321 - `project_id: optional string`

322 

323 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

324 

325 - `user_id: optional string`

326 

327 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

328 

329 - `vector_store_id: optional string`

330 

331 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

332 

333 - `organization.usage.web_searches.result: object { num_model_requests, num_requests, object, 5 more }`

334 

335 The aggregated web search calls usage details of the specific time bucket.

336 

337 - `num_model_requests: number`

338 

339 The count of model requests.

340 

341 - `num_requests: number`

342 

343 The count of web search calls.

344 

345 - `object: "organization.usage.web_searches.result"`

346 

347 - `api_key_id: optional string`

348 

349 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

350 

351 - `context_level: optional string`

352 

353 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

354 

355 - `model: optional string`

356 

357 When `group_by=model`, this field provides the model name of the grouped usage result.

358 

359 - `project_id: optional string`

360 

361 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

362 

363 - `user_id: optional string`

364 

365 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

366 

307 - `organization.costs.result: object { object, amount, api_key_id, 3 more }`367 - `organization.costs.result: object { object, amount, api_key_id, 3 more }`

308 368 

309 The aggregated costs details of the specific time bucket.369 The aggregated costs details of the specific time bucket.

Details

50 50 

51 - `object: "bucket"`51 - `object: "bucket"`

52 52 

53 - `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 6 more`53 - `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`

54 54 

55 - `organization.usage.completions.result: object { input_tokens, num_model_requests, object, 10 more }`55 - `organization.usage.completions.result: object { input_tokens, num_model_requests, object, 10 more }`

56 56 


292 292 

293 When `group_by=project_id`, this field provides the project ID of the grouped usage result.293 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

294 294 

295 - `organization.usage.file_searches.result: object { num_requests, object, api_key_id, 3 more }`

296 

297 The aggregated file search calls usage details of the specific time bucket.

298 

299 - `num_requests: number`

300 

301 The count of file search calls.

302 

303 - `object: "organization.usage.file_searches.result"`

304 

305 - `api_key_id: optional string`

306 

307 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

308 

309 - `project_id: optional string`

310 

311 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

312 

313 - `user_id: optional string`

314 

315 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

316 

317 - `vector_store_id: optional string`

318 

319 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

320 

321 - `organization.usage.web_searches.result: object { num_model_requests, num_requests, object, 5 more }`

322 

323 The aggregated web search calls usage details of the specific time bucket.

324 

325 - `num_model_requests: number`

326 

327 The count of model requests.

328 

329 - `num_requests: number`

330 

331 The count of web search calls.

332 

333 - `object: "organization.usage.web_searches.result"`

334 

335 - `api_key_id: optional string`

336 

337 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

338 

339 - `context_level: optional string`

340 

341 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

342 

343 - `model: optional string`

344 

345 When `group_by=model`, this field provides the model name of the grouped usage result.

346 

347 - `project_id: optional string`

348 

349 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

350 

351 - `user_id: optional string`

352 

353 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

354 

295 - `organization.costs.result: object { object, amount, api_key_id, 3 more }`355 - `organization.costs.result: object { object, amount, api_key_id, 3 more }`

296 356 

297 The aggregated costs details of the specific time bucket.357 The aggregated costs details of the specific time bucket.

Details

66 66 

67 - `object: "bucket"`67 - `object: "bucket"`

68 68 

69 - `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 6 more`69 - `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`

70 70 

71 - `organization.usage.completions.result: object { input_tokens, num_model_requests, object, 10 more }`71 - `organization.usage.completions.result: object { input_tokens, num_model_requests, object, 10 more }`

72 72 


308 308 

309 When `group_by=project_id`, this field provides the project ID of the grouped usage result.309 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

310 310 

311 - `organization.usage.file_searches.result: object { num_requests, object, api_key_id, 3 more }`

312 

313 The aggregated file search calls usage details of the specific time bucket.

314 

315 - `num_requests: number`

316 

317 The count of file search calls.

318 

319 - `object: "organization.usage.file_searches.result"`

320 

321 - `api_key_id: optional string`

322 

323 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

324 

325 - `project_id: optional string`

326 

327 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

328 

329 - `user_id: optional string`

330 

331 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

332 

333 - `vector_store_id: optional string`

334 

335 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

336 

337 - `organization.usage.web_searches.result: object { num_model_requests, num_requests, object, 5 more }`

338 

339 The aggregated web search calls usage details of the specific time bucket.

340 

341 - `num_model_requests: number`

342 

343 The count of model requests.

344 

345 - `num_requests: number`

346 

347 The count of web search calls.

348 

349 - `object: "organization.usage.web_searches.result"`

350 

351 - `api_key_id: optional string`

352 

353 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

354 

355 - `context_level: optional string`

356 

357 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

358 

359 - `model: optional string`

360 

361 When `group_by=model`, this field provides the model name 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 

311 - `organization.costs.result: object { object, amount, api_key_id, 3 more }`371 - `organization.costs.result: object { object, amount, api_key_id, 3 more }`

312 372 

313 The aggregated costs details of the specific time bucket.373 The aggregated costs details of the specific time bucket.

Details

50 50 

51 - `object: "bucket"`51 - `object: "bucket"`

52 52 

53 - `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 6 more`53 - `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`

54 54 

55 - `organization.usage.completions.result: object { input_tokens, num_model_requests, object, 10 more }`55 - `organization.usage.completions.result: object { input_tokens, num_model_requests, object, 10 more }`

56 56 


292 292 

293 When `group_by=project_id`, this field provides the project ID of the grouped usage result.293 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

294 294 

295 - `organization.usage.file_searches.result: object { num_requests, object, api_key_id, 3 more }`

296 

297 The aggregated file search calls usage details of the specific time bucket.

298 

299 - `num_requests: number`

300 

301 The count of file search calls.

302 

303 - `object: "organization.usage.file_searches.result"`

304 

305 - `api_key_id: optional string`

306 

307 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

308 

309 - `project_id: optional string`

310 

311 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

312 

313 - `user_id: optional string`

314 

315 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

316 

317 - `vector_store_id: optional string`

318 

319 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

320 

321 - `organization.usage.web_searches.result: object { num_model_requests, num_requests, object, 5 more }`

322 

323 The aggregated web search calls usage details of the specific time bucket.

324 

325 - `num_model_requests: number`

326 

327 The count of model requests.

328 

329 - `num_requests: number`

330 

331 The count of web search calls.

332 

333 - `object: "organization.usage.web_searches.result"`

334 

335 - `api_key_id: optional string`

336 

337 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

338 

339 - `context_level: optional string`

340 

341 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

342 

343 - `model: optional string`

344 

345 When `group_by=model`, this field provides the model name of the grouped usage result.

346 

347 - `project_id: optional string`

348 

349 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

350 

351 - `user_id: optional string`

352 

353 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

354 

295 - `organization.costs.result: object { object, amount, api_key_id, 3 more }`355 - `organization.costs.result: object { object, amount, api_key_id, 3 more }`

296 356 

297 The aggregated costs details of the specific time bucket.357 The aggregated costs details of the specific time bucket.

Details

62 62 

63 - `object: "bucket"`63 - `object: "bucket"`

64 64 

65 - `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 6 more`65 - `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`

66 66 

67 - `organization.usage.completions.result: object { input_tokens, num_model_requests, object, 10 more }`67 - `organization.usage.completions.result: object { input_tokens, num_model_requests, object, 10 more }`

68 68 


304 304 

305 When `group_by=project_id`, this field provides the project ID of the grouped usage result.305 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

306 306 

307 - `organization.usage.file_searches.result: object { num_requests, object, api_key_id, 3 more }`

308 

309 The aggregated file search calls usage details of the specific time bucket.

310 

311 - `num_requests: number`

312 

313 The count of file search calls.

314 

315 - `object: "organization.usage.file_searches.result"`

316 

317 - `api_key_id: optional string`

318 

319 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

320 

321 - `project_id: optional string`

322 

323 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

324 

325 - `user_id: optional string`

326 

327 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

328 

329 - `vector_store_id: optional string`

330 

331 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

332 

333 - `organization.usage.web_searches.result: object { num_model_requests, num_requests, object, 5 more }`

334 

335 The aggregated web search calls usage details of the specific time bucket.

336 

337 - `num_model_requests: number`

338 

339 The count of model requests.

340 

341 - `num_requests: number`

342 

343 The count of web search calls.

344 

345 - `object: "organization.usage.web_searches.result"`

346 

347 - `api_key_id: optional string`

348 

349 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

350 

351 - `context_level: optional string`

352 

353 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

354 

355 - `model: optional string`

356 

357 When `group_by=model`, this field provides the model name of the grouped usage result.

358 

359 - `project_id: optional string`

360 

361 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

362 

363 - `user_id: optional string`

364 

365 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

366 

307 - `organization.costs.result: object { object, amount, api_key_id, 3 more }`367 - `organization.costs.result: object { object, amount, api_key_id, 3 more }`

308 368 

309 The aggregated costs details of the specific time bucket.369 The aggregated costs details of the specific time bucket.

Details

1## File search calls

2 

3`$ openai admin:organization:usage file-search-calls`

4 

5**get** `/organization/usage/file_search_calls`

6 

7Get file search calls usage details for the organization.

8 

9### Parameters

10 

11- `--start-time: number`

12 

13 Start time (Unix seconds) of the query time range, inclusive.

14 

15- `--api-key-id: optional array of string`

16 

17 Return only usage for these API keys.

18 

19- `--bucket-width: optional "1m" or "1h" or "1d"`

20 

21 Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`.

22 

23- `--end-time: optional number`

24 

25 End time (Unix seconds) of the query time range, exclusive.

26 

27- `--group-by: optional array of "project_id" or "user_id" or "api_key_id" or "vector_store_id"`

28 

29 Group the usage data by the specified fields. Support fields include `project_id`, `user_id`, `api_key_id`, `vector_store_id` or any combination of them.

30 

31- `--limit: optional number`

32 

33 Specifies the number of buckets to return.

34 

35 - `bucket_width=1d`: default: 7, max: 31

36 - `bucket_width=1h`: default: 24, max: 168

37 - `bucket_width=1m`: default: 60, max: 1440

38 

39- `--page: optional string`

40 

41 A cursor for use in pagination. Corresponding to the `next_page` field from the previous response.

42 

43- `--project-id: optional array of string`

44 

45 Return only usage for these projects.

46 

47- `--user-id: optional array of string`

48 

49 Return only usage for these users.

50 

51- `--vector-store-id: optional array of string`

52 

53 Return only usage for these vector stores.

54 

55### Returns

56 

57- `AdminOrganizationUsageFileSearchCallsResponse: object { data, has_more, next_page, object }`

58 

59 - `data: array of object { end_time, object, results, start_time }`

60 

61 - `end_time: number`

62 

63 - `object: "bucket"`

64 

65 - `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`

66 

67 - `organization.usage.completions.result: object { input_tokens, num_model_requests, object, 10 more }`

68 

69 The aggregated completions usage details of the specific time bucket.

70 

71 - `input_tokens: number`

72 

73 The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.

74 

75 - `num_model_requests: number`

76 

77 The count of requests made to the model.

78 

79 - `object: "organization.usage.completions.result"`

80 

81 - `output_tokens: number`

82 

83 The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.

84 

85 - `api_key_id: optional string`

86 

87 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

88 

89 - `batch: optional boolean`

90 

91 When `group_by=batch`, this field tells whether the grouped usage result is batch or not.

92 

93 - `input_audio_tokens: optional number`

94 

95 The aggregated number of audio input tokens used, including cached tokens.

96 

97 - `input_cached_tokens: optional number`

98 

99 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.

100 

101 - `model: optional string`

102 

103 When `group_by=model`, this field provides the model name of the grouped usage result.

104 

105 - `output_audio_tokens: optional number`

106 

107 The aggregated number of audio output tokens used.

108 

109 - `project_id: optional string`

110 

111 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

112 

113 - `service_tier: optional string`

114 

115 When `group_by=service_tier`, this field provides the service tier of the grouped usage result.

116 

117 - `user_id: optional string`

118 

119 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

120 

121 - `organization.usage.embeddings.result: object { input_tokens, num_model_requests, object, 4 more }`

122 

123 The aggregated embeddings usage details of the specific time bucket.

124 

125 - `input_tokens: number`

126 

127 The aggregated number of input tokens used.

128 

129 - `num_model_requests: number`

130 

131 The count of requests made to the model.

132 

133 - `object: "organization.usage.embeddings.result"`

134 

135 - `api_key_id: optional string`

136 

137 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

138 

139 - `model: optional string`

140 

141 When `group_by=model`, this field provides the model name of the grouped usage result.

142 

143 - `project_id: optional string`

144 

145 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

146 

147 - `user_id: optional string`

148 

149 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

150 

151 - `organization.usage.moderations.result: object { input_tokens, num_model_requests, object, 4 more }`

152 

153 The aggregated moderations usage details of the specific time bucket.

154 

155 - `input_tokens: number`

156 

157 The aggregated number of input tokens used.

158 

159 - `num_model_requests: number`

160 

161 The count of requests made to the model.

162 

163 - `object: "organization.usage.moderations.result"`

164 

165 - `api_key_id: optional string`

166 

167 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

168 

169 - `model: optional string`

170 

171 When `group_by=model`, this field provides the model name of the grouped usage result.

172 

173 - `project_id: optional string`

174 

175 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

176 

177 - `user_id: optional string`

178 

179 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

180 

181 - `organization.usage.images.result: object { images, num_model_requests, object, 6 more }`

182 

183 The aggregated images usage details of the specific time bucket.

184 

185 - `images: number`

186 

187 The number of images processed.

188 

189 - `num_model_requests: number`

190 

191 The count of requests made to the model.

192 

193 - `object: "organization.usage.images.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 - `size: optional string`

208 

209 When `group_by=size`, this field provides the image size of the grouped usage result.

210 

211 - `source: optional string`

212 

213 When `group_by=source`, this field provides the source of the grouped usage result, possible values are `image.generation`, `image.edit`, `image.variation`.

214 

215 - `user_id: optional string`

216 

217 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

218 

219 - `organization.usage.audio_speeches.result: object { characters, num_model_requests, object, 4 more }`

220 

221 The aggregated audio speeches usage details of the specific time bucket.

222 

223 - `characters: number`

224 

225 The number of characters processed.

226 

227 - `num_model_requests: number`

228 

229 The count of requests made to the model.

230 

231 - `object: "organization.usage.audio_speeches.result"`

232 

233 - `api_key_id: optional string`

234 

235 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

236 

237 - `model: optional string`

238 

239 When `group_by=model`, this field provides the model name of the grouped usage result.

240 

241 - `project_id: optional string`

242 

243 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

244 

245 - `user_id: optional string`

246 

247 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

248 

249 - `organization.usage.audio_transcriptions.result: object { num_model_requests, object, seconds, 4 more }`

250 

251 The aggregated audio transcriptions usage details of the specific time bucket.

252 

253 - `num_model_requests: number`

254 

255 The count of requests made to the model.

256 

257 - `object: "organization.usage.audio_transcriptions.result"`

258 

259 - `seconds: number`

260 

261 The number of seconds processed.

262 

263 - `api_key_id: optional string`

264 

265 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

266 

267 - `model: optional string`

268 

269 When `group_by=model`, this field provides the model name of the grouped usage result.

270 

271 - `project_id: optional string`

272 

273 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

274 

275 - `user_id: optional string`

276 

277 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

278 

279 - `organization.usage.vector_stores.result: object { object, usage_bytes, project_id }`

280 

281 The aggregated vector stores usage details of the specific time bucket.

282 

283 - `object: "organization.usage.vector_stores.result"`

284 

285 - `usage_bytes: number`

286 

287 The vector stores usage in bytes.

288 

289 - `project_id: optional string`

290 

291 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

292 

293 - `organization.usage.code_interpreter_sessions.result: object { num_sessions, object, project_id }`

294 

295 The aggregated code interpreter sessions usage details of the specific time bucket.

296 

297 - `num_sessions: number`

298 

299 The number of code interpreter sessions.

300 

301 - `object: "organization.usage.code_interpreter_sessions.result"`

302 

303 - `project_id: optional string`

304 

305 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

306 

307 - `organization.usage.file_searches.result: object { num_requests, object, api_key_id, 3 more }`

308 

309 The aggregated file search calls usage details of the specific time bucket.

310 

311 - `num_requests: number`

312 

313 The count of file search calls.

314 

315 - `object: "organization.usage.file_searches.result"`

316 

317 - `api_key_id: optional string`

318 

319 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

320 

321 - `project_id: optional string`

322 

323 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

324 

325 - `user_id: optional string`

326 

327 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

328 

329 - `vector_store_id: optional string`

330 

331 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

332 

333 - `organization.usage.web_searches.result: object { num_model_requests, num_requests, object, 5 more }`

334 

335 The aggregated web search calls usage details of the specific time bucket.

336 

337 - `num_model_requests: number`

338 

339 The count of model requests.

340 

341 - `num_requests: number`

342 

343 The count of web search calls.

344 

345 - `object: "organization.usage.web_searches.result"`

346 

347 - `api_key_id: optional string`

348 

349 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

350 

351 - `context_level: optional string`

352 

353 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

354 

355 - `model: optional string`

356 

357 When `group_by=model`, this field provides the model name of the grouped usage result.

358 

359 - `project_id: optional string`

360 

361 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

362 

363 - `user_id: optional string`

364 

365 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

366 

367 - `organization.costs.result: object { object, amount, api_key_id, 3 more }`

368 

369 The aggregated costs details of the specific time bucket.

370 

371 - `object: "organization.costs.result"`

372 

373 - `amount: optional object { currency, value }`

374 

375 The monetary value in its associated currency.

376 

377 - `currency: optional string`

378 

379 Lowercase ISO-4217 currency e.g. "usd"

380 

381 - `value: optional number`

382 

383 The numeric value of the cost.

384 

385 - `api_key_id: optional string`

386 

387 When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result.

388 

389 - `line_item: optional string`

390 

391 When `group_by=line_item`, this field provides the line item of the grouped costs result.

392 

393 - `project_id: optional string`

394 

395 When `group_by=project_id`, this field provides the project ID of the grouped costs result.

396 

397 - `quantity: optional number`

398 

399 When `group_by=line_item`, this field provides the quantity of the grouped costs result.

400 

401 - `start_time: number`

402 

403 - `has_more: boolean`

404 

405 - `next_page: string`

406 

407 - `object: "page"`

408 

409### Example

410 

411```cli

412openai admin:organization:usage file-search-calls \

413 --admin-api-key 'My Admin API Key' \

414 --start-time 0

415```

416 

417#### Response

418 

419```json

420{

421 "data": [

422 {

423 "end_time": 0,

424 "object": "bucket",

425 "results": [

426 {

427 "input_tokens": 0,

428 "num_model_requests": 0,

429 "object": "organization.usage.completions.result",

430 "output_tokens": 0,

431 "api_key_id": "api_key_id",

432 "batch": true,

433 "input_audio_tokens": 0,

434 "input_cached_tokens": 0,

435 "model": "model",

436 "output_audio_tokens": 0,

437 "project_id": "project_id",

438 "service_tier": "service_tier",

439 "user_id": "user_id"

440 }

441 ],

442 "start_time": 0

443 }

444 ],

445 "has_more": true,

446 "next_page": "next_page",

447 "object": "page"

448}

449```

Details

70 70 

71 - `object: "bucket"`71 - `object: "bucket"`

72 72 

73 - `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 6 more`73 - `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`

74 74 

75 - `organization.usage.completions.result: object { input_tokens, num_model_requests, object, 10 more }`75 - `organization.usage.completions.result: object { input_tokens, num_model_requests, object, 10 more }`

76 76 


312 312 

313 When `group_by=project_id`, this field provides the project ID of the grouped usage result.313 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

314 314 

315 - `organization.usage.file_searches.result: object { num_requests, object, api_key_id, 3 more }`

316 

317 The aggregated file search calls usage details of the specific time bucket.

318 

319 - `num_requests: number`

320 

321 The count of file search calls.

322 

323 - `object: "organization.usage.file_searches.result"`

324 

325 - `api_key_id: optional string`

326 

327 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

328 

329 - `project_id: optional string`

330 

331 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

332 

333 - `user_id: optional string`

334 

335 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

336 

337 - `vector_store_id: optional string`

338 

339 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

340 

341 - `organization.usage.web_searches.result: object { num_model_requests, num_requests, object, 5 more }`

342 

343 The aggregated web search calls usage details of the specific time bucket.

344 

345 - `num_model_requests: number`

346 

347 The count of model requests.

348 

349 - `num_requests: number`

350 

351 The count of web search calls.

352 

353 - `object: "organization.usage.web_searches.result"`

354 

355 - `api_key_id: optional string`

356 

357 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

358 

359 - `context_level: optional string`

360 

361 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

362 

363 - `model: optional string`

364 

365 When `group_by=model`, this field provides the model name of the grouped usage result.

366 

367 - `project_id: optional string`

368 

369 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

370 

371 - `user_id: optional string`

372 

373 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

374 

315 - `organization.costs.result: object { object, amount, api_key_id, 3 more }`375 - `organization.costs.result: object { object, amount, api_key_id, 3 more }`

316 376 

317 The aggregated costs details of the specific time bucket.377 The aggregated costs details of the specific time bucket.

Details

62 62 

63 - `object: "bucket"`63 - `object: "bucket"`

64 64 

65 - `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 6 more`65 - `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`

66 66 

67 - `organization.usage.completions.result: object { input_tokens, num_model_requests, object, 10 more }`67 - `organization.usage.completions.result: object { input_tokens, num_model_requests, object, 10 more }`

68 68 


304 304 

305 When `group_by=project_id`, this field provides the project ID of the grouped usage result.305 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

306 306 

307 - `organization.usage.file_searches.result: object { num_requests, object, api_key_id, 3 more }`

308 

309 The aggregated file search calls usage details of the specific time bucket.

310 

311 - `num_requests: number`

312 

313 The count of file search calls.

314 

315 - `object: "organization.usage.file_searches.result"`

316 

317 - `api_key_id: optional string`

318 

319 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

320 

321 - `project_id: optional string`

322 

323 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

324 

325 - `user_id: optional string`

326 

327 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

328 

329 - `vector_store_id: optional string`

330 

331 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

332 

333 - `organization.usage.web_searches.result: object { num_model_requests, num_requests, object, 5 more }`

334 

335 The aggregated web search calls usage details of the specific time bucket.

336 

337 - `num_model_requests: number`

338 

339 The count of model requests.

340 

341 - `num_requests: number`

342 

343 The count of web search calls.

344 

345 - `object: "organization.usage.web_searches.result"`

346 

347 - `api_key_id: optional string`

348 

349 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

350 

351 - `context_level: optional string`

352 

353 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

354 

355 - `model: optional string`

356 

357 When `group_by=model`, this field provides the model name of the grouped usage result.

358 

359 - `project_id: optional string`

360 

361 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

362 

363 - `user_id: optional string`

364 

365 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

366 

307 - `organization.costs.result: object { object, amount, api_key_id, 3 more }`367 - `organization.costs.result: object { object, amount, api_key_id, 3 more }`

308 368 

309 The aggregated costs details of the specific time bucket.369 The aggregated costs details of the specific time bucket.

Details

50 50 

51 - `object: "bucket"`51 - `object: "bucket"`

52 52 

53 - `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 6 more`53 - `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`

54 54 

55 - `organization.usage.completions.result: object { input_tokens, num_model_requests, object, 10 more }`55 - `organization.usage.completions.result: object { input_tokens, num_model_requests, object, 10 more }`

56 56 


292 292 

293 When `group_by=project_id`, this field provides the project ID of the grouped usage result.293 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

294 294 

295 - `organization.usage.file_searches.result: object { num_requests, object, api_key_id, 3 more }`

296 

297 The aggregated file search calls usage details of the specific time bucket.

298 

299 - `num_requests: number`

300 

301 The count of file search calls.

302 

303 - `object: "organization.usage.file_searches.result"`

304 

305 - `api_key_id: optional string`

306 

307 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

308 

309 - `project_id: optional string`

310 

311 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

312 

313 - `user_id: optional string`

314 

315 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

316 

317 - `vector_store_id: optional string`

318 

319 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

320 

321 - `organization.usage.web_searches.result: object { num_model_requests, num_requests, object, 5 more }`

322 

323 The aggregated web search calls usage details of the specific time bucket.

324 

325 - `num_model_requests: number`

326 

327 The count of model requests.

328 

329 - `num_requests: number`

330 

331 The count of web search calls.

332 

333 - `object: "organization.usage.web_searches.result"`

334 

335 - `api_key_id: optional string`

336 

337 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

338 

339 - `context_level: optional string`

340 

341 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

342 

343 - `model: optional string`

344 

345 When `group_by=model`, this field provides the model name of the grouped usage result.

346 

347 - `project_id: optional string`

348 

349 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

350 

351 - `user_id: optional string`

352 

353 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

354 

295 - `organization.costs.result: object { object, amount, api_key_id, 3 more }`355 - `organization.costs.result: object { object, amount, api_key_id, 3 more }`

296 356 

297 The aggregated costs details of the specific time bucket.357 The aggregated costs details of the specific time bucket.

Details

1## Web search calls

2 

3`$ openai admin:organization:usage web-search-calls`

4 

5**get** `/organization/usage/web_search_calls`

6 

7Get web search calls usage details for the organization.

8 

9### Parameters

10 

11- `--start-time: number`

12 

13 Start time (Unix seconds) of the query time range, inclusive.

14 

15- `--api-key-id: optional array of string`

16 

17 Return only usage for these API keys.

18 

19- `--bucket-width: optional "1m" or "1h" or "1d"`

20 

21 Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`.

22 

23- `--context-level: optional array of "low" or "medium" or "high"`

24 

25 Return only web search usage for these context levels.

26 

27- `--end-time: optional number`

28 

29 End time (Unix seconds) of the query time range, exclusive.

30 

31- `--group-by: optional array of "project_id" or "user_id" or "api_key_id" or 2 more`

32 

33 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.

34 

35- `--limit: optional number`

36 

37 Specifies the number of buckets to return.

38 

39 - `bucket_width=1d`: default: 7, max: 31

40 - `bucket_width=1h`: default: 24, max: 168

41 - `bucket_width=1m`: default: 60, max: 1440

42 

43- `--model: optional array of string`

44 

45 Return only usage for these models.

46 

47- `--page: optional string`

48 

49 A cursor for use in pagination. Corresponding to the `next_page` field from the previous response.

50 

51- `--project-id: optional array of string`

52 

53 Return only usage for these projects.

54 

55- `--user-id: optional array of string`

56 

57 Return only usage for these users.

58 

59### Returns

60 

61- `AdminOrganizationUsageWebSearchCallsResponse: object { data, has_more, next_page, object }`

62 

63 - `data: array of object { end_time, object, results, start_time }`

64 

65 - `end_time: number`

66 

67 - `object: "bucket"`

68 

69 - `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`

70 

71 - `organization.usage.completions.result: object { input_tokens, num_model_requests, object, 10 more }`

72 

73 The aggregated completions usage details of the specific time bucket.

74 

75 - `input_tokens: number`

76 

77 The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.

78 

79 - `num_model_requests: number`

80 

81 The count of requests made to the model.

82 

83 - `object: "organization.usage.completions.result"`

84 

85 - `output_tokens: number`

86 

87 The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.

88 

89 - `api_key_id: optional string`

90 

91 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

92 

93 - `batch: optional boolean`

94 

95 When `group_by=batch`, this field tells whether the grouped usage result is batch or not.

96 

97 - `input_audio_tokens: optional number`

98 

99 The aggregated number of audio input tokens used, including cached tokens.

100 

101 - `input_cached_tokens: optional number`

102 

103 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.

104 

105 - `model: optional string`

106 

107 When `group_by=model`, this field provides the model name of the grouped usage result.

108 

109 - `output_audio_tokens: optional number`

110 

111 The aggregated number of audio output tokens used.

112 

113 - `project_id: optional string`

114 

115 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

116 

117 - `service_tier: optional string`

118 

119 When `group_by=service_tier`, this field provides the service tier of the grouped usage result.

120 

121 - `user_id: optional string`

122 

123 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

124 

125 - `organization.usage.embeddings.result: object { input_tokens, num_model_requests, object, 4 more }`

126 

127 The aggregated embeddings usage details of the specific time bucket.

128 

129 - `input_tokens: number`

130 

131 The aggregated number of input tokens used.

132 

133 - `num_model_requests: number`

134 

135 The count of requests made to the model.

136 

137 - `object: "organization.usage.embeddings.result"`

138 

139 - `api_key_id: optional string`

140 

141 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

142 

143 - `model: optional string`

144 

145 When `group_by=model`, this field provides the model name of the grouped usage result.

146 

147 - `project_id: optional string`

148 

149 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

150 

151 - `user_id: optional string`

152 

153 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

154 

155 - `organization.usage.moderations.result: object { input_tokens, num_model_requests, object, 4 more }`

156 

157 The aggregated moderations usage details of the specific time bucket.

158 

159 - `input_tokens: number`

160 

161 The aggregated number of input tokens used.

162 

163 - `num_model_requests: number`

164 

165 The count of requests made to the model.

166 

167 - `object: "organization.usage.moderations.result"`

168 

169 - `api_key_id: optional string`

170 

171 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

172 

173 - `model: optional string`

174 

175 When `group_by=model`, this field provides the model name of the grouped usage result.

176 

177 - `project_id: optional string`

178 

179 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

180 

181 - `user_id: optional string`

182 

183 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

184 

185 - `organization.usage.images.result: object { images, num_model_requests, object, 6 more }`

186 

187 The aggregated images usage details of the specific time bucket.

188 

189 - `images: number`

190 

191 The number of images processed.

192 

193 - `num_model_requests: number`

194 

195 The count of requests made to the model.

196 

197 - `object: "organization.usage.images.result"`

198 

199 - `api_key_id: optional string`

200 

201 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

202 

203 - `model: optional string`

204 

205 When `group_by=model`, this field provides the model name of the grouped usage result.

206 

207 - `project_id: optional string`

208 

209 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

210 

211 - `size: optional string`

212 

213 When `group_by=size`, this field provides the image size of the grouped usage result.

214 

215 - `source: optional string`

216 

217 When `group_by=source`, this field provides the source of the grouped usage result, possible values are `image.generation`, `image.edit`, `image.variation`.

218 

219 - `user_id: optional string`

220 

221 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

222 

223 - `organization.usage.audio_speeches.result: object { characters, num_model_requests, object, 4 more }`

224 

225 The aggregated audio speeches usage details of the specific time bucket.

226 

227 - `characters: number`

228 

229 The number of characters processed.

230 

231 - `num_model_requests: number`

232 

233 The count of requests made to the model.

234 

235 - `object: "organization.usage.audio_speeches.result"`

236 

237 - `api_key_id: optional string`

238 

239 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

240 

241 - `model: optional string`

242 

243 When `group_by=model`, this field provides the model name of the grouped usage result.

244 

245 - `project_id: optional string`

246 

247 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

248 

249 - `user_id: optional string`

250 

251 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

252 

253 - `organization.usage.audio_transcriptions.result: object { num_model_requests, object, seconds, 4 more }`

254 

255 The aggregated audio transcriptions usage details of the specific time bucket.

256 

257 - `num_model_requests: number`

258 

259 The count of requests made to the model.

260 

261 - `object: "organization.usage.audio_transcriptions.result"`

262 

263 - `seconds: number`

264 

265 The number of seconds processed.

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 - `organization.usage.vector_stores.result: object { object, usage_bytes, project_id }`

284 

285 The aggregated vector stores usage details of the specific time bucket.

286 

287 - `object: "organization.usage.vector_stores.result"`

288 

289 - `usage_bytes: number`

290 

291 The vector stores usage in bytes.

292 

293 - `project_id: optional string`

294 

295 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

296 

297 - `organization.usage.code_interpreter_sessions.result: object { num_sessions, object, project_id }`

298 

299 The aggregated code interpreter sessions usage details of the specific time bucket.

300 

301 - `num_sessions: number`

302 

303 The number of code interpreter sessions.

304 

305 - `object: "organization.usage.code_interpreter_sessions.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 - `organization.usage.file_searches.result: object { num_requests, object, api_key_id, 3 more }`

312 

313 The aggregated file search calls usage details of the specific time bucket.

314 

315 - `num_requests: number`

316 

317 The count of file search calls.

318 

319 - `object: "organization.usage.file_searches.result"`

320 

321 - `api_key_id: optional string`

322 

323 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

324 

325 - `project_id: optional string`

326 

327 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

328 

329 - `user_id: optional string`

330 

331 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

332 

333 - `vector_store_id: optional string`

334 

335 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

336 

337 - `organization.usage.web_searches.result: object { num_model_requests, num_requests, object, 5 more }`

338 

339 The aggregated web search calls usage details of the specific time bucket.

340 

341 - `num_model_requests: number`

342 

343 The count of model requests.

344 

345 - `num_requests: number`

346 

347 The count of web search calls.

348 

349 - `object: "organization.usage.web_searches.result"`

350 

351 - `api_key_id: optional string`

352 

353 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

354 

355 - `context_level: optional string`

356 

357 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

358 

359 - `model: optional string`

360 

361 When `group_by=model`, this field provides the model name 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 - `organization.costs.result: object { object, amount, api_key_id, 3 more }`

372 

373 The aggregated costs details of the specific time bucket.

374 

375 - `object: "organization.costs.result"`

376 

377 - `amount: optional object { currency, value }`

378 

379 The monetary value in its associated currency.

380 

381 - `currency: optional string`

382 

383 Lowercase ISO-4217 currency e.g. "usd"

384 

385 - `value: optional number`

386 

387 The numeric value of the cost.

388 

389 - `api_key_id: optional string`

390 

391 When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result.

392 

393 - `line_item: optional string`

394 

395 When `group_by=line_item`, this field provides the line item of the grouped costs result.

396 

397 - `project_id: optional string`

398 

399 When `group_by=project_id`, this field provides the project ID of the grouped costs result.

400 

401 - `quantity: optional number`

402 

403 When `group_by=line_item`, this field provides the quantity of the grouped costs result.

404 

405 - `start_time: number`

406 

407 - `has_more: boolean`

408 

409 - `next_page: string`

410 

411 - `object: "page"`

412 

413### Example

414 

415```cli

416openai admin:organization:usage web-search-calls \

417 --admin-api-key 'My Admin API Key' \

418 --start-time 0

419```

420 

421#### Response

422 

423```json

424{

425 "data": [

426 {

427 "end_time": 0,

428 "object": "bucket",

429 "results": [

430 {

431 "input_tokens": 0,

432 "num_model_requests": 0,

433 "object": "organization.usage.completions.result",

434 "output_tokens": 0,

435 "api_key_id": "api_key_id",

436 "batch": true,

437 "input_audio_tokens": 0,

438 "input_cached_tokens": 0,

439 "model": "model",

440 "output_audio_tokens": 0,

441 "project_id": "project_id",

442 "service_tier": "service_tier",

443 "user_id": "user_id"

444 }

445 ],

446 "start_time": 0

447 }

448 ],

449 "has_more": true,

450 "next_page": "next_page",

451 "object": "page"

452}

453```

Details

2890 2890 

2891 The namespace of the custom tool being called.2891 The namespace of the custom tool being called.

2892 2892 

2893 - `compaction_trigger: object { type }`

2894 

2895 Compacts the current context. Must be the final input item.

2896 

2893 - `item_reference: object { id, type }`2897 - `item_reference: object { id, type }`

2894 2898 

2895 An internal identifier for an item to reference.2899 An internal identifier for an item to reference.

Details

3086 3086 

3087 The namespace of the custom tool being called.3087 The namespace of the custom tool being called.

3088 3088 

3089 - `compaction_trigger: object { type }`

3090 

3091 Compacts the current context. Must be the final input item.

3092 

3089 - `item_reference: object { id, type }`3093 - `item_reference: object { id, type }`

3090 3094 

3091 An internal identifier for an item to reference.3095 An internal identifier for an item to reference.

Details

2907 2907 

2908 The namespace of the custom tool being called.2908 The namespace of the custom tool being called.

2909 2909 

2910 - `compaction_trigger: object { type }`

2911 

2912 Compacts the current context. Must be the final input item.

2913 

2910 - `item_reference: object { id, type }`2914 - `item_reference: object { id, type }`

2911 2915 

2912 An internal identifier for an item to reference.2916 An internal identifier for an item to reference.

Details

24 24 

25 - `Projects param.Field[[]AdminOrganizationInviteNewParamsProject]`25 - `Projects param.Field[[]AdminOrganizationInviteNewParamsProject]`

26 26 

27 An array of projects to which membership is granted at the same time the org invite is accepted. If omitted, the user will be invited to the default project for compatibility with legacy behavior.27 An array of projects to which membership is granted at the same time the org invite is accepted. If omitted, the user will be invited to the default project for compatibility with legacy behavior. If empty list is passed, the user will not be invited to any projects, including the default one.

28 28 

29 - `ID string`29 - `ID string`

30 30 

Details

1## Retrieve project hosted tool permissions

2 

3`client.Admin.Organization.Projects.HostedToolPermissions.Get(ctx, projectID) (*ProjectHostedToolPermissions, error)`

4 

5**get** `/organization/projects/{project_id}/hosted_tool_permissions`

6 

7Returns hosted tool permissions for a project.

8 

9### Parameters

10 

11- `projectID string`

12 

13### Returns

14 

15- `type ProjectHostedToolPermissions struct{…}`

16 

17 Represents hosted tool permissions for a project.

18 

19 - `CodeInterpreter ProjectHostedToolPermissionsCodeInterpreter`

20 

21 Permission state for a single hosted tool on a project.

22 

23 - `Enabled bool`

24 

25 Whether the hosted tool is enabled for the project.

26 

27 - `FileSearch ProjectHostedToolPermissionsFileSearch`

28 

29 Permission state for a single hosted tool on a project.

30 

31 - `Enabled bool`

32 

33 Whether the hosted tool is enabled for the project.

34 

35 - `ImageGeneration ProjectHostedToolPermissionsImageGeneration`

36 

37 Permission state for a single hosted tool on a project.

38 

39 - `Enabled bool`

40 

41 Whether the hosted tool is enabled for the project.

42 

43 - `Mcp ProjectHostedToolPermissionsMcp`

44 

45 Permission state for a single hosted tool on a project.

46 

47 - `Enabled bool`

48 

49 Whether the hosted tool is enabled for the project.

50 

51 - `WebSearch ProjectHostedToolPermissionsWebSearch`

52 

53 Permission state for a single hosted tool on a project.

54 

55 - `Enabled bool`

56 

57 Whether the hosted tool is enabled for the project.

58 

59### Example

60 

61```go

62package main

63 

64import (

65 "context"

66 "fmt"

67 

68 "github.com/openai/openai-go"

69 "github.com/openai/openai-go/option"

70)

71 

72func main() {

73 client := openai.NewClient(

74 option.WithAdminAPIKey("My Admin API Key"),

75 )

76 projectHostedToolPermissions, err := client.Admin.Organization.Projects.HostedToolPermissions.Get(context.TODO(), "project_id")

77 if err != nil {

78 panic(err.Error())

79 }

80 fmt.Printf("%+v\n", projectHostedToolPermissions.CodeInterpreter)

81}

82```

83 

84#### Response

85 

86```json

87{

88 "code_interpreter": {

89 "enabled": true

90 },

91 "file_search": {

92 "enabled": true

93 },

94 "image_generation": {

95 "enabled": true

96 },

97 "mcp": {

98 "enabled": true

99 },

100 "web_search": {

101 "enabled": true

102 }

103}

104```

Details

1## Modify project hosted tool permissions

2 

3`client.Admin.Organization.Projects.HostedToolPermissions.Update(ctx, projectID, body) (*ProjectHostedToolPermissions, error)`

4 

5**post** `/organization/projects/{project_id}/hosted_tool_permissions`

6 

7Updates hosted tool permissions for a project.

8 

9### Parameters

10 

11- `projectID string`

12 

13- `body AdminOrganizationProjectHostedToolPermissionUpdateParams`

14 

15 - `CodeInterpreter param.Field[AdminOrganizationProjectHostedToolPermissionUpdateParamsCodeInterpreter]`

16 

17 The code interpreter permission update.

18 

19 - `Enabled bool`

20 

21 Whether to enable the hosted tool for the project.

22 

23 - `FileSearch param.Field[AdminOrganizationProjectHostedToolPermissionUpdateParamsFileSearch]`

24 

25 The file search permission update.

26 

27 - `Enabled bool`

28 

29 Whether to enable the hosted tool for the project.

30 

31 - `ImageGeneration param.Field[AdminOrganizationProjectHostedToolPermissionUpdateParamsImageGeneration]`

32 

33 The image generation permission update.

34 

35 - `Enabled bool`

36 

37 Whether to enable the hosted tool for the project.

38 

39 - `Mcp param.Field[AdminOrganizationProjectHostedToolPermissionUpdateParamsMcp]`

40 

41 The MCP permission update.

42 

43 - `Enabled bool`

44 

45 Whether to enable the hosted tool for the project.

46 

47 - `WebSearch param.Field[AdminOrganizationProjectHostedToolPermissionUpdateParamsWebSearch]`

48 

49 The web search permission update.

50 

51 - `Enabled bool`

52 

53 Whether to enable the hosted tool for the project.

54 

55### Returns

56 

57- `type ProjectHostedToolPermissions struct{…}`

58 

59 Represents hosted tool permissions for a project.

60 

61 - `CodeInterpreter ProjectHostedToolPermissionsCodeInterpreter`

62 

63 Permission state for a single hosted tool on a project.

64 

65 - `Enabled bool`

66 

67 Whether the hosted tool is enabled for the project.

68 

69 - `FileSearch ProjectHostedToolPermissionsFileSearch`

70 

71 Permission state for a single hosted tool on a project.

72 

73 - `Enabled bool`

74 

75 Whether the hosted tool is enabled for the project.

76 

77 - `ImageGeneration ProjectHostedToolPermissionsImageGeneration`

78 

79 Permission state for a single hosted tool on a project.

80 

81 - `Enabled bool`

82 

83 Whether the hosted tool is enabled for the project.

84 

85 - `Mcp ProjectHostedToolPermissionsMcp`

86 

87 Permission state for a single hosted tool on a project.

88 

89 - `Enabled bool`

90 

91 Whether the hosted tool is enabled for the project.

92 

93 - `WebSearch ProjectHostedToolPermissionsWebSearch`

94 

95 Permission state for a single hosted tool on a project.

96 

97 - `Enabled bool`

98 

99 Whether the hosted tool is enabled for the project.

100 

101### Example

102 

103```go

104package main

105 

106import (

107 "context"

108 "fmt"

109 

110 "github.com/openai/openai-go"

111 "github.com/openai/openai-go/option"

112)

113 

114func main() {

115 client := openai.NewClient(

116 option.WithAdminAPIKey("My Admin API Key"),

117 )

118 projectHostedToolPermissions, err := client.Admin.Organization.Projects.HostedToolPermissions.Update(

119 context.TODO(),

120 "project_id",

121 openai.AdminOrganizationProjectHostedToolPermissionUpdateParams{

122 

123 },

124 )

125 if err != nil {

126 panic(err.Error())

127 }

128 fmt.Printf("%+v\n", projectHostedToolPermissions.CodeInterpreter)

129}

130```

131 

132#### Response

133 

134```json

135{

136 "code_interpreter": {

137 "enabled": true

138 },

139 "file_search": {

140 "enabled": true

141 },

142 "image_generation": {

143 "enabled": true

144 },

145 "mcp": {

146 "enabled": true

147 },

148 "web_search": {

149 "enabled": true

150 }

151}

152```

Details

1## Delete project model permissions

2 

3`client.Admin.Organization.Projects.ModelPermissions.Delete(ctx, projectID) (*ProjectModelPermissionsDeleted, error)`

4 

5**delete** `/organization/projects/{project_id}/model_permissions`

6 

7Deletes model permissions for a project.

8 

9### Parameters

10 

11- `projectID string`

12 

13### Returns

14 

15- `type ProjectModelPermissionsDeleted struct{…}`

16 

17 Confirmation payload returned after deleting project model permissions.

18 

19 - `Deleted bool`

20 

21 Whether the project model permissions were deleted.

22 

23 - `Object ProjectModelPermissionsDeleted`

24 

25 The object type, which is always `project.model_permissions.deleted`.

26 

27 - `const ProjectModelPermissionsDeletedProjectModelPermissionsDeleted ProjectModelPermissionsDeleted = "project.model_permissions.deleted"`

28 

29### Example

30 

31```go

32package main

33 

34import (

35 "context"

36 "fmt"

37 

38 "github.com/openai/openai-go"

39 "github.com/openai/openai-go/option"

40)

41 

42func main() {

43 client := openai.NewClient(

44 option.WithAdminAPIKey("My Admin API Key"),

45 )

46 projectModelPermissionsDeleted, err := client.Admin.Organization.Projects.ModelPermissions.Delete(context.TODO(), "project_id")

47 if err != nil {

48 panic(err.Error())

49 }

50 fmt.Printf("%+v\n", projectModelPermissionsDeleted.Deleted)

51}

52```

53 

54#### Response

55 

56```json

57{

58 "deleted": true,

59 "object": "project.model_permissions.deleted"

60}

61```

Details

1## Retrieve project model permissions

2 

3`client.Admin.Organization.Projects.ModelPermissions.Get(ctx, projectID) (*ProjectModelPermissions, error)`

4 

5**get** `/organization/projects/{project_id}/model_permissions`

6 

7Returns model permissions for a project.

8 

9### Parameters

10 

11- `projectID string`

12 

13### Returns

14 

15- `type ProjectModelPermissions struct{…}`

16 

17 Represents the model allowlist or denylist policy for a project.

18 

19 - `Mode ProjectModelPermissionsMode`

20 

21 Whether the project uses an allowlist or a denylist.

22 

23 - `const ProjectModelPermissionsModeAllowList ProjectModelPermissionsMode = "allow_list"`

24 

25 - `const ProjectModelPermissionsModeDenyList ProjectModelPermissionsMode = "deny_list"`

26 

27 - `ModelIDs []string`

28 

29 The model IDs included in the model permissions policy.

30 

31 - `Object ProjectModelPermissions`

32 

33 The object type, which is always `project.model_permissions`.

34 

35 - `const ProjectModelPermissionsProjectModelPermissions ProjectModelPermissions = "project.model_permissions"`

36 

37### Example

38 

39```go

40package main

41 

42import (

43 "context"

44 "fmt"

45 

46 "github.com/openai/openai-go"

47 "github.com/openai/openai-go/option"

48)

49 

50func main() {

51 client := openai.NewClient(

52 option.WithAdminAPIKey("My Admin API Key"),

53 )

54 projectModelPermissions, err := client.Admin.Organization.Projects.ModelPermissions.Get(context.TODO(), "project_id")

55 if err != nil {

56 panic(err.Error())

57 }

58 fmt.Printf("%+v\n", projectModelPermissions.ModelIDs)

59}

60```

61 

62#### Response

63 

64```json

65{

66 "mode": "allow_list",

67 "model_ids": [

68 "string"

69 ],

70 "object": "project.model_permissions"

71}

72```

Details

1## Modify project model permissions

2 

3`client.Admin.Organization.Projects.ModelPermissions.Update(ctx, projectID, body) (*ProjectModelPermissions, error)`

4 

5**post** `/organization/projects/{project_id}/model_permissions`

6 

7Updates model permissions for a project.

8 

9### Parameters

10 

11- `projectID string`

12 

13- `body AdminOrganizationProjectModelPermissionUpdateParams`

14 

15 - `Mode param.Field[AdminOrganizationProjectModelPermissionUpdateParamsMode]`

16 

17 The model permissions mode to apply.

18 

19 - `const AdminOrganizationProjectModelPermissionUpdateParamsModeAllowList AdminOrganizationProjectModelPermissionUpdateParamsMode = "allow_list"`

20 

21 - `const AdminOrganizationProjectModelPermissionUpdateParamsModeDenyList AdminOrganizationProjectModelPermissionUpdateParamsMode = "deny_list"`

22 

23 - `ModelIDs param.Field[[]string]`

24 

25 The model IDs included in this permissions policy.

26 

27### Returns

28 

29- `type ProjectModelPermissions struct{…}`

30 

31 Represents the model allowlist or denylist policy for a project.

32 

33 - `Mode ProjectModelPermissionsMode`

34 

35 Whether the project uses an allowlist or a denylist.

36 

37 - `const ProjectModelPermissionsModeAllowList ProjectModelPermissionsMode = "allow_list"`

38 

39 - `const ProjectModelPermissionsModeDenyList ProjectModelPermissionsMode = "deny_list"`

40 

41 - `ModelIDs []string`

42 

43 The model IDs included in the model permissions policy.

44 

45 - `Object ProjectModelPermissions`

46 

47 The object type, which is always `project.model_permissions`.

48 

49 - `const ProjectModelPermissionsProjectModelPermissions ProjectModelPermissions = "project.model_permissions"`

50 

51### Example

52 

53```go

54package main

55 

56import (

57 "context"

58 "fmt"

59 

60 "github.com/openai/openai-go"

61 "github.com/openai/openai-go/option"

62)

63 

64func main() {

65 client := openai.NewClient(

66 option.WithAdminAPIKey("My Admin API Key"),

67 )

68 projectModelPermissions, err := client.Admin.Organization.Projects.ModelPermissions.Update(

69 context.TODO(),

70 "project_id",

71 openai.AdminOrganizationProjectModelPermissionUpdateParams{

72 Mode: openai.AdminOrganizationProjectModelPermissionUpdateParamsModeAllowList,

73 ModelIDs: []string{"string"},

74 },

75 )

76 if err != nil {

77 panic(err.Error())

78 }

79 fmt.Printf("%+v\n", projectModelPermissions.ModelIDs)

80}

81```

82 

83#### Response

84 

85```json

86{

87 "mode": "allow_list",

88 "model_ids": [

89 "string"

90 ],

91 "object": "project.model_permissions"

92}

93```

Details

338 338 

339 When `group_by=project_id`, this field provides the project ID of the grouped usage result.339 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

340 340 

341 - `type AdminOrganizationUsageAudioSpeechesResponseDataResultOrganizationUsageFileSearchesResult struct{…}`

342 

343 The aggregated file search calls usage details of the specific time bucket.

344 

345 - `NumRequests int64`

346 

347 The count of file search calls.

348 

349 - `Object OrganizationUsageFileSearchesResult`

350 

351 - `const OrganizationUsageFileSearchesResultOrganizationUsageFileSearchesResult OrganizationUsageFileSearchesResult = "organization.usage.file_searches.result"`

352 

353 - `APIKeyID string`

354 

355 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

356 

357 - `ProjectID string`

358 

359 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

360 

361 - `UserID string`

362 

363 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

364 

365 - `VectorStoreID string`

366 

367 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

368 

369 - `type AdminOrganizationUsageAudioSpeechesResponseDataResultOrganizationUsageWebSearchesResult struct{…}`

370 

371 The aggregated web search calls usage details of the specific time bucket.

372 

373 - `NumModelRequests int64`

374 

375 The count of model requests.

376 

377 - `NumRequests int64`

378 

379 The count of web search calls.

380 

381 - `Object OrganizationUsageWebSearchesResult`

382 

383 - `const OrganizationUsageWebSearchesResultOrganizationUsageWebSearchesResult OrganizationUsageWebSearchesResult = "organization.usage.web_searches.result"`

384 

385 - `APIKeyID string`

386 

387 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

388 

389 - `ContextLevel string`

390 

391 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

392 

393 - `Model string`

394 

395 When `group_by=model`, this field provides the model name of the grouped usage result.

396 

397 - `ProjectID string`

398 

399 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

400 

401 - `UserID string`

402 

403 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

404 

341 - `type AdminOrganizationUsageAudioSpeechesResponseDataResultOrganizationCostsResult struct{…}`405 - `type AdminOrganizationUsageAudioSpeechesResponseDataResultOrganizationCostsResult struct{…}`

342 406 

343 The aggregated costs details of the specific time bucket.407 The aggregated costs details of the specific time bucket.

Details

338 338 

339 When `group_by=project_id`, this field provides the project ID of the grouped usage result.339 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

340 340 

341 - `type AdminOrganizationUsageAudioTranscriptionsResponseDataResultOrganizationUsageFileSearchesResult struct{…}`

342 

343 The aggregated file search calls usage details of the specific time bucket.

344 

345 - `NumRequests int64`

346 

347 The count of file search calls.

348 

349 - `Object OrganizationUsageFileSearchesResult`

350 

351 - `const OrganizationUsageFileSearchesResultOrganizationUsageFileSearchesResult OrganizationUsageFileSearchesResult = "organization.usage.file_searches.result"`

352 

353 - `APIKeyID string`

354 

355 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

356 

357 - `ProjectID string`

358 

359 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

360 

361 - `UserID string`

362 

363 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

364 

365 - `VectorStoreID string`

366 

367 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

368 

369 - `type AdminOrganizationUsageAudioTranscriptionsResponseDataResultOrganizationUsageWebSearchesResult struct{…}`

370 

371 The aggregated web search calls usage details of the specific time bucket.

372 

373 - `NumModelRequests int64`

374 

375 The count of model requests.

376 

377 - `NumRequests int64`

378 

379 The count of web search calls.

380 

381 - `Object OrganizationUsageWebSearchesResult`

382 

383 - `const OrganizationUsageWebSearchesResultOrganizationUsageWebSearchesResult OrganizationUsageWebSearchesResult = "organization.usage.web_searches.result"`

384 

385 - `APIKeyID string`

386 

387 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

388 

389 - `ContextLevel string`

390 

391 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

392 

393 - `Model string`

394 

395 When `group_by=model`, this field provides the model name of the grouped usage result.

396 

397 - `ProjectID string`

398 

399 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

400 

401 - `UserID string`

402 

403 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

404 

341 - `type AdminOrganizationUsageAudioTranscriptionsResponseDataResultOrganizationCostsResult struct{…}`405 - `type AdminOrganizationUsageAudioTranscriptionsResponseDataResultOrganizationCostsResult struct{…}`

342 406 

343 The aggregated costs details of the specific time bucket.407 The aggregated costs details of the specific time bucket.

Details

320 320 

321 When `group_by=project_id`, this field provides the project ID of the grouped usage result.321 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

322 322 

323 - `type AdminOrganizationUsageCodeInterpreterSessionsResponseDataResultOrganizationUsageFileSearchesResult struct{…}`

324 

325 The aggregated file search calls usage details of the specific time bucket.

326 

327 - `NumRequests int64`

328 

329 The count of file search calls.

330 

331 - `Object OrganizationUsageFileSearchesResult`

332 

333 - `const OrganizationUsageFileSearchesResultOrganizationUsageFileSearchesResult OrganizationUsageFileSearchesResult = "organization.usage.file_searches.result"`

334 

335 - `APIKeyID string`

336 

337 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

338 

339 - `ProjectID string`

340 

341 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

342 

343 - `UserID string`

344 

345 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

346 

347 - `VectorStoreID string`

348 

349 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

350 

351 - `type AdminOrganizationUsageCodeInterpreterSessionsResponseDataResultOrganizationUsageWebSearchesResult struct{…}`

352 

353 The aggregated web search calls usage details of the specific time bucket.

354 

355 - `NumModelRequests int64`

356 

357 The count of model requests.

358 

359 - `NumRequests int64`

360 

361 The count of web search calls.

362 

363 - `Object OrganizationUsageWebSearchesResult`

364 

365 - `const OrganizationUsageWebSearchesResultOrganizationUsageWebSearchesResult OrganizationUsageWebSearchesResult = "organization.usage.web_searches.result"`

366 

367 - `APIKeyID string`

368 

369 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

370 

371 - `ContextLevel string`

372 

373 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

374 

375 - `Model string`

376 

377 When `group_by=model`, this field provides the model name of the grouped usage result.

378 

379 - `ProjectID string`

380 

381 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

382 

383 - `UserID string`

384 

385 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

386 

323 - `type AdminOrganizationUsageCodeInterpreterSessionsResponseDataResultOrganizationCostsResult struct{…}`387 - `type AdminOrganizationUsageCodeInterpreterSessionsResponseDataResultOrganizationCostsResult struct{…}`

324 388 

325 The aggregated costs details of the specific time bucket.389 The aggregated costs details of the specific time bucket.

Details

346 346 

347 When `group_by=project_id`, this field provides the project ID of the grouped usage result.347 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

348 348 

349 - `type AdminOrganizationUsageCompletionsResponseDataResultOrganizationUsageFileSearchesResult struct{…}`

350 

351 The aggregated file search calls usage details of the specific time bucket.

352 

353 - `NumRequests int64`

354 

355 The count of file search calls.

356 

357 - `Object OrganizationUsageFileSearchesResult`

358 

359 - `const OrganizationUsageFileSearchesResultOrganizationUsageFileSearchesResult OrganizationUsageFileSearchesResult = "organization.usage.file_searches.result"`

360 

361 - `APIKeyID string`

362 

363 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

364 

365 - `ProjectID string`

366 

367 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

368 

369 - `UserID string`

370 

371 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

372 

373 - `VectorStoreID string`

374 

375 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

376 

377 - `type AdminOrganizationUsageCompletionsResponseDataResultOrganizationUsageWebSearchesResult struct{…}`

378 

379 The aggregated web search calls usage details of the specific time bucket.

380 

381 - `NumModelRequests int64`

382 

383 The count of model requests.

384 

385 - `NumRequests int64`

386 

387 The count of web search calls.

388 

389 - `Object OrganizationUsageWebSearchesResult`

390 

391 - `const OrganizationUsageWebSearchesResultOrganizationUsageWebSearchesResult OrganizationUsageWebSearchesResult = "organization.usage.web_searches.result"`

392 

393 - `APIKeyID string`

394 

395 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

396 

397 - `ContextLevel string`

398 

399 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

400 

401 - `Model string`

402 

403 When `group_by=model`, this field provides the model name of the grouped usage result.

404 

405 - `ProjectID string`

406 

407 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

408 

409 - `UserID string`

410 

411 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

412 

349 - `type AdminOrganizationUsageCompletionsResponseDataResultOrganizationCostsResult struct{…}`413 - `type AdminOrganizationUsageCompletionsResponseDataResultOrganizationCostsResult struct{…}`

350 414 

351 The aggregated costs details of the specific time bucket.415 The aggregated costs details of the specific time bucket.

Details

320 320 

321 When `group_by=project_id`, this field provides the project ID of the grouped usage result.321 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

322 322 

323 - `type AdminOrganizationUsageCostsResponseDataResultOrganizationUsageFileSearchesResult struct{…}`

324 

325 The aggregated file search calls usage details of the specific time bucket.

326 

327 - `NumRequests int64`

328 

329 The count of file search calls.

330 

331 - `Object OrganizationUsageFileSearchesResult`

332 

333 - `const OrganizationUsageFileSearchesResultOrganizationUsageFileSearchesResult OrganizationUsageFileSearchesResult = "organization.usage.file_searches.result"`

334 

335 - `APIKeyID string`

336 

337 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

338 

339 - `ProjectID string`

340 

341 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

342 

343 - `UserID string`

344 

345 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

346 

347 - `VectorStoreID string`

348 

349 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

350 

351 - `type AdminOrganizationUsageCostsResponseDataResultOrganizationUsageWebSearchesResult struct{…}`

352 

353 The aggregated web search calls usage details of the specific time bucket.

354 

355 - `NumModelRequests int64`

356 

357 The count of model requests.

358 

359 - `NumRequests int64`

360 

361 The count of web search calls.

362 

363 - `Object OrganizationUsageWebSearchesResult`

364 

365 - `const OrganizationUsageWebSearchesResultOrganizationUsageWebSearchesResult OrganizationUsageWebSearchesResult = "organization.usage.web_searches.result"`

366 

367 - `APIKeyID string`

368 

369 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

370 

371 - `ContextLevel string`

372 

373 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

374 

375 - `Model string`

376 

377 When `group_by=model`, this field provides the model name of the grouped usage result.

378 

379 - `ProjectID string`

380 

381 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

382 

383 - `UserID string`

384 

385 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

386 

323 - `type AdminOrganizationUsageCostsResponseDataResultOrganizationCostsResult struct{…}`387 - `type AdminOrganizationUsageCostsResponseDataResultOrganizationCostsResult struct{…}`

324 388 

325 The aggregated costs details of the specific time bucket.389 The aggregated costs details of the specific time bucket.

Details

338 338 

339 When `group_by=project_id`, this field provides the project ID of the grouped usage result.339 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

340 340 

341 - `type AdminOrganizationUsageEmbeddingsResponseDataResultOrganizationUsageFileSearchesResult struct{…}`

342 

343 The aggregated file search calls usage details of the specific time bucket.

344 

345 - `NumRequests int64`

346 

347 The count of file search calls.

348 

349 - `Object OrganizationUsageFileSearchesResult`

350 

351 - `const OrganizationUsageFileSearchesResultOrganizationUsageFileSearchesResult OrganizationUsageFileSearchesResult = "organization.usage.file_searches.result"`

352 

353 - `APIKeyID string`

354 

355 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

356 

357 - `ProjectID string`

358 

359 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

360 

361 - `UserID string`

362 

363 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

364 

365 - `VectorStoreID string`

366 

367 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

368 

369 - `type AdminOrganizationUsageEmbeddingsResponseDataResultOrganizationUsageWebSearchesResult struct{…}`

370 

371 The aggregated web search calls usage details of the specific time bucket.

372 

373 - `NumModelRequests int64`

374 

375 The count of model requests.

376 

377 - `NumRequests int64`

378 

379 The count of web search calls.

380 

381 - `Object OrganizationUsageWebSearchesResult`

382 

383 - `const OrganizationUsageWebSearchesResultOrganizationUsageWebSearchesResult OrganizationUsageWebSearchesResult = "organization.usage.web_searches.result"`

384 

385 - `APIKeyID string`

386 

387 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

388 

389 - `ContextLevel string`

390 

391 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

392 

393 - `Model string`

394 

395 When `group_by=model`, this field provides the model name of the grouped usage result.

396 

397 - `ProjectID string`

398 

399 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

400 

401 - `UserID string`

402 

403 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

404 

341 - `type AdminOrganizationUsageEmbeddingsResponseDataResultOrganizationCostsResult struct{…}`405 - `type AdminOrganizationUsageEmbeddingsResponseDataResultOrganizationCostsResult struct{…}`

342 406 

343 The aggregated costs details of the specific time bucket.407 The aggregated costs details of the specific time bucket.

Details

1## File search calls

2 

3`client.Admin.Organization.Usage.FileSearchCalls(ctx, query) (*AdminOrganizationUsageFileSearchCallsResponse, error)`

4 

5**get** `/organization/usage/file_search_calls`

6 

7Get file search calls usage details for the organization.

8 

9### Parameters

10 

11- `query AdminOrganizationUsageFileSearchCallsParams`

12 

13 - `StartTime param.Field[int64]`

14 

15 Start time (Unix seconds) of the query time range, inclusive.

16 

17 - `APIKeyIDs param.Field[[]string]`

18 

19 Return only usage for these API keys.

20 

21 - `BucketWidth param.Field[AdminOrganizationUsageFileSearchCallsParamsBucketWidth]`

22 

23 Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`.

24 

25 - `const AdminOrganizationUsageFileSearchCallsParamsBucketWidth1m AdminOrganizationUsageFileSearchCallsParamsBucketWidth = "1m"`

26 

27 - `const AdminOrganizationUsageFileSearchCallsParamsBucketWidth1h AdminOrganizationUsageFileSearchCallsParamsBucketWidth = "1h"`

28 

29 - `const AdminOrganizationUsageFileSearchCallsParamsBucketWidth1d AdminOrganizationUsageFileSearchCallsParamsBucketWidth = "1d"`

30 

31 - `EndTime param.Field[int64]`

32 

33 End time (Unix seconds) of the query time range, exclusive.

34 

35 - `GroupBy param.Field[[]string]`

36 

37 Group the usage data by the specified fields. Support fields include `project_id`, `user_id`, `api_key_id`, `vector_store_id` or any combination of them.

38 

39 - `const AdminOrganizationUsageFileSearchCallsParamsGroupByProjectID AdminOrganizationUsageFileSearchCallsParamsGroupBy = "project_id"`

40 

41 - `const AdminOrganizationUsageFileSearchCallsParamsGroupByUserID AdminOrganizationUsageFileSearchCallsParamsGroupBy = "user_id"`

42 

43 - `const AdminOrganizationUsageFileSearchCallsParamsGroupByAPIKeyID AdminOrganizationUsageFileSearchCallsParamsGroupBy = "api_key_id"`

44 

45 - `const AdminOrganizationUsageFileSearchCallsParamsGroupByVectorStoreID AdminOrganizationUsageFileSearchCallsParamsGroupBy = "vector_store_id"`

46 

47 - `Limit param.Field[int64]`

48 

49 Specifies the number of buckets to return.

50 

51 - `bucket_width=1d`: default: 7, max: 31

52 - `bucket_width=1h`: default: 24, max: 168

53 - `bucket_width=1m`: default: 60, max: 1440

54 

55 - `Page param.Field[string]`

56 

57 A cursor for use in pagination. Corresponding to the `next_page` field from the previous response.

58 

59 - `ProjectIDs param.Field[[]string]`

60 

61 Return only usage for these projects.

62 

63 - `UserIDs param.Field[[]string]`

64 

65 Return only usage for these users.

66 

67 - `VectorStoreIDs param.Field[[]string]`

68 

69 Return only usage for these vector stores.

70 

71### Returns

72 

73- `type AdminOrganizationUsageFileSearchCallsResponse struct{…}`

74 

75 - `Data []AdminOrganizationUsageFileSearchCallsResponseData`

76 

77 - `EndTime int64`

78 

79 - `Object Bucket`

80 

81 - `const BucketBucket Bucket = "bucket"`

82 

83 - `Results []AdminOrganizationUsageFileSearchCallsResponseDataResultUnion`

84 

85 - `type AdminOrganizationUsageFileSearchCallsResponseDataResultOrganizationUsageCompletionsResult struct{…}`

86 

87 The aggregated completions usage details of the specific time bucket.

88 

89 - `InputTokens int64`

90 

91 The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.

92 

93 - `NumModelRequests int64`

94 

95 The count of requests made to the model.

96 

97 - `Object OrganizationUsageCompletionsResult`

98 

99 - `const OrganizationUsageCompletionsResultOrganizationUsageCompletionsResult OrganizationUsageCompletionsResult = "organization.usage.completions.result"`

100 

101 - `OutputTokens int64`

102 

103 The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.

104 

105 - `APIKeyID string`

106 

107 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

108 

109 - `Batch bool`

110 

111 When `group_by=batch`, this field tells whether the grouped usage result is batch or not.

112 

113 - `InputAudioTokens int64`

114 

115 The aggregated number of audio input tokens used, including cached tokens.

116 

117 - `InputCachedTokens int64`

118 

119 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.

120 

121 - `Model string`

122 

123 When `group_by=model`, this field provides the model name of the grouped usage result.

124 

125 - `OutputAudioTokens int64`

126 

127 The aggregated number of audio output tokens used.

128 

129 - `ProjectID string`

130 

131 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

132 

133 - `ServiceTier string`

134 

135 When `group_by=service_tier`, this field provides the service tier of the grouped usage result.

136 

137 - `UserID string`

138 

139 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

140 

141 - `type AdminOrganizationUsageFileSearchCallsResponseDataResultOrganizationUsageEmbeddingsResult struct{…}`

142 

143 The aggregated embeddings usage details of the specific time bucket.

144 

145 - `InputTokens int64`

146 

147 The aggregated number of input tokens used.

148 

149 - `NumModelRequests int64`

150 

151 The count of requests made to the model.

152 

153 - `Object OrganizationUsageEmbeddingsResult`

154 

155 - `const OrganizationUsageEmbeddingsResultOrganizationUsageEmbeddingsResult OrganizationUsageEmbeddingsResult = "organization.usage.embeddings.result"`

156 

157 - `APIKeyID string`

158 

159 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

160 

161 - `Model string`

162 

163 When `group_by=model`, this field provides the model name of the grouped usage result.

164 

165 - `ProjectID string`

166 

167 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

168 

169 - `UserID string`

170 

171 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

172 

173 - `type AdminOrganizationUsageFileSearchCallsResponseDataResultOrganizationUsageModerationsResult struct{…}`

174 

175 The aggregated moderations usage details of the specific time bucket.

176 

177 - `InputTokens int64`

178 

179 The aggregated number of input tokens used.

180 

181 - `NumModelRequests int64`

182 

183 The count of requests made to the model.

184 

185 - `Object OrganizationUsageModerationsResult`

186 

187 - `const OrganizationUsageModerationsResultOrganizationUsageModerationsResult OrganizationUsageModerationsResult = "organization.usage.moderations.result"`

188 

189 - `APIKeyID string`

190 

191 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

192 

193 - `Model string`

194 

195 When `group_by=model`, this field provides the model name of the grouped usage result.

196 

197 - `ProjectID string`

198 

199 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

200 

201 - `UserID string`

202 

203 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

204 

205 - `type AdminOrganizationUsageFileSearchCallsResponseDataResultOrganizationUsageImagesResult struct{…}`

206 

207 The aggregated images usage details of the specific time bucket.

208 

209 - `Images int64`

210 

211 The number of images processed.

212 

213 - `NumModelRequests int64`

214 

215 The count of requests made to the model.

216 

217 - `Object OrganizationUsageImagesResult`

218 

219 - `const OrganizationUsageImagesResultOrganizationUsageImagesResult OrganizationUsageImagesResult = "organization.usage.images.result"`

220 

221 - `APIKeyID string`

222 

223 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

224 

225 - `Model string`

226 

227 When `group_by=model`, this field provides the model name of the grouped usage result.

228 

229 - `ProjectID string`

230 

231 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

232 

233 - `Size string`

234 

235 When `group_by=size`, this field provides the image size of the grouped usage result.

236 

237 - `Source string`

238 

239 When `group_by=source`, this field provides the source of the grouped usage result, possible values are `image.generation`, `image.edit`, `image.variation`.

240 

241 - `UserID string`

242 

243 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

244 

245 - `type AdminOrganizationUsageFileSearchCallsResponseDataResultOrganizationUsageAudioSpeechesResult struct{…}`

246 

247 The aggregated audio speeches usage details of the specific time bucket.

248 

249 - `Characters int64`

250 

251 The number of characters processed.

252 

253 - `NumModelRequests int64`

254 

255 The count of requests made to the model.

256 

257 - `Object OrganizationUsageAudioSpeechesResult`

258 

259 - `const OrganizationUsageAudioSpeechesResultOrganizationUsageAudioSpeechesResult OrganizationUsageAudioSpeechesResult = "organization.usage.audio_speeches.result"`

260 

261 - `APIKeyID string`

262 

263 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

264 

265 - `Model string`

266 

267 When `group_by=model`, this field provides the model name of the grouped usage result.

268 

269 - `ProjectID string`

270 

271 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

272 

273 - `UserID string`

274 

275 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

276 

277 - `type AdminOrganizationUsageFileSearchCallsResponseDataResultOrganizationUsageAudioTranscriptionsResult struct{…}`

278 

279 The aggregated audio transcriptions usage details of the specific time bucket.

280 

281 - `NumModelRequests int64`

282 

283 The count of requests made to the model.

284 

285 - `Object OrganizationUsageAudioTranscriptionsResult`

286 

287 - `const OrganizationUsageAudioTranscriptionsResultOrganizationUsageAudioTranscriptionsResult OrganizationUsageAudioTranscriptionsResult = "organization.usage.audio_transcriptions.result"`

288 

289 - `Seconds int64`

290 

291 The number of seconds processed.

292 

293 - `APIKeyID string`

294 

295 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

296 

297 - `Model string`

298 

299 When `group_by=model`, this field provides the model name of the grouped usage result.

300 

301 - `ProjectID string`

302 

303 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

304 

305 - `UserID string`

306 

307 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

308 

309 - `type AdminOrganizationUsageFileSearchCallsResponseDataResultOrganizationUsageVectorStoresResult struct{…}`

310 

311 The aggregated vector stores usage details of the specific time bucket.

312 

313 - `Object OrganizationUsageVectorStoresResult`

314 

315 - `const OrganizationUsageVectorStoresResultOrganizationUsageVectorStoresResult OrganizationUsageVectorStoresResult = "organization.usage.vector_stores.result"`

316 

317 - `UsageBytes int64`

318 

319 The vector stores usage in bytes.

320 

321 - `ProjectID string`

322 

323 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

324 

325 - `type AdminOrganizationUsageFileSearchCallsResponseDataResultOrganizationUsageCodeInterpreterSessionsResult struct{…}`

326 

327 The aggregated code interpreter sessions usage details of the specific time bucket.

328 

329 - `NumSessions int64`

330 

331 The number of code interpreter sessions.

332 

333 - `Object OrganizationUsageCodeInterpreterSessionsResult`

334 

335 - `const OrganizationUsageCodeInterpreterSessionsResultOrganizationUsageCodeInterpreterSessionsResult OrganizationUsageCodeInterpreterSessionsResult = "organization.usage.code_interpreter_sessions.result"`

336 

337 - `ProjectID string`

338 

339 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

340 

341 - `type AdminOrganizationUsageFileSearchCallsResponseDataResultOrganizationUsageFileSearchesResult struct{…}`

342 

343 The aggregated file search calls usage details of the specific time bucket.

344 

345 - `NumRequests int64`

346 

347 The count of file search calls.

348 

349 - `Object OrganizationUsageFileSearchesResult`

350 

351 - `const OrganizationUsageFileSearchesResultOrganizationUsageFileSearchesResult OrganizationUsageFileSearchesResult = "organization.usage.file_searches.result"`

352 

353 - `APIKeyID string`

354 

355 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

356 

357 - `ProjectID string`

358 

359 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

360 

361 - `UserID string`

362 

363 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

364 

365 - `VectorStoreID string`

366 

367 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

368 

369 - `type AdminOrganizationUsageFileSearchCallsResponseDataResultOrganizationUsageWebSearchesResult struct{…}`

370 

371 The aggregated web search calls usage details of the specific time bucket.

372 

373 - `NumModelRequests int64`

374 

375 The count of model requests.

376 

377 - `NumRequests int64`

378 

379 The count of web search calls.

380 

381 - `Object OrganizationUsageWebSearchesResult`

382 

383 - `const OrganizationUsageWebSearchesResultOrganizationUsageWebSearchesResult OrganizationUsageWebSearchesResult = "organization.usage.web_searches.result"`

384 

385 - `APIKeyID string`

386 

387 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

388 

389 - `ContextLevel string`

390 

391 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

392 

393 - `Model string`

394 

395 When `group_by=model`, this field provides the model name of the grouped usage result.

396 

397 - `ProjectID string`

398 

399 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

400 

401 - `UserID string`

402 

403 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

404 

405 - `type AdminOrganizationUsageFileSearchCallsResponseDataResultOrganizationCostsResult struct{…}`

406 

407 The aggregated costs details of the specific time bucket.

408 

409 - `Object OrganizationCostsResult`

410 

411 - `const OrganizationCostsResultOrganizationCostsResult OrganizationCostsResult = "organization.costs.result"`

412 

413 - `Amount AdminOrganizationUsageFileSearchCallsResponseDataResultOrganizationCostsResultAmount`

414 

415 The monetary value in its associated currency.

416 

417 - `Currency string`

418 

419 Lowercase ISO-4217 currency e.g. "usd"

420 

421 - `Value float64`

422 

423 The numeric value of the cost.

424 

425 - `APIKeyID string`

426 

427 When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result.

428 

429 - `LineItem string`

430 

431 When `group_by=line_item`, this field provides the line item of the grouped costs result.

432 

433 - `ProjectID string`

434 

435 When `group_by=project_id`, this field provides the project ID of the grouped costs result.

436 

437 - `Quantity float64`

438 

439 When `group_by=line_item`, this field provides the quantity of the grouped costs result.

440 

441 - `StartTime int64`

442 

443 - `HasMore bool`

444 

445 - `NextPage string`

446 

447 - `Object Page`

448 

449 - `const PagePage Page = "page"`

450 

451### Example

452 

453```go

454package main

455 

456import (

457 "context"

458 "fmt"

459 

460 "github.com/openai/openai-go"

461 "github.com/openai/openai-go/option"

462)

463 

464func main() {

465 client := openai.NewClient(

466 option.WithAdminAPIKey("My Admin API Key"),

467 )

468 response, err := client.Admin.Organization.Usage.FileSearchCalls(context.TODO(), openai.AdminOrganizationUsageFileSearchCallsParams{

469 StartTime: 0,

470 })

471 if err != nil {

472 panic(err.Error())

473 }

474 fmt.Printf("%+v\n", response.Data)

475}

476```

477 

478#### Response

479 

480```json

481{

482 "data": [

483 {

484 "end_time": 0,

485 "object": "bucket",

486 "results": [

487 {

488 "input_tokens": 0,

489 "num_model_requests": 0,

490 "object": "organization.usage.completions.result",

491 "output_tokens": 0,

492 "api_key_id": "api_key_id",

493 "batch": true,

494 "input_audio_tokens": 0,

495 "input_cached_tokens": 0,

496 "model": "model",

497 "output_audio_tokens": 0,

498 "project_id": "project_id",

499 "service_tier": "service_tier",

500 "user_id": "user_id"

501 }

502 ],

503 "start_time": 0

504 }

505 ],

506 "has_more": true,

507 "next_page": "next_page",

508 "object": "page"

509}

510```

Details

366 366 

367 When `group_by=project_id`, this field provides the project ID of the grouped usage result.367 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

368 368 

369 - `type AdminOrganizationUsageImagesResponseDataResultOrganizationUsageFileSearchesResult struct{…}`

370 

371 The aggregated file search calls usage details of the specific time bucket.

372 

373 - `NumRequests int64`

374 

375 The count of file search calls.

376 

377 - `Object OrganizationUsageFileSearchesResult`

378 

379 - `const OrganizationUsageFileSearchesResultOrganizationUsageFileSearchesResult OrganizationUsageFileSearchesResult = "organization.usage.file_searches.result"`

380 

381 - `APIKeyID string`

382 

383 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

384 

385 - `ProjectID string`

386 

387 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

388 

389 - `UserID string`

390 

391 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

392 

393 - `VectorStoreID string`

394 

395 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

396 

397 - `type AdminOrganizationUsageImagesResponseDataResultOrganizationUsageWebSearchesResult struct{…}`

398 

399 The aggregated web search calls usage details of the specific time bucket.

400 

401 - `NumModelRequests int64`

402 

403 The count of model requests.

404 

405 - `NumRequests int64`

406 

407 The count of web search calls.

408 

409 - `Object OrganizationUsageWebSearchesResult`

410 

411 - `const OrganizationUsageWebSearchesResultOrganizationUsageWebSearchesResult OrganizationUsageWebSearchesResult = "organization.usage.web_searches.result"`

412 

413 - `APIKeyID string`

414 

415 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

416 

417 - `ContextLevel string`

418 

419 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

420 

421 - `Model string`

422 

423 When `group_by=model`, this field provides the model name of the grouped usage result.

424 

425 - `ProjectID string`

426 

427 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

428 

429 - `UserID string`

430 

431 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

432 

369 - `type AdminOrganizationUsageImagesResponseDataResultOrganizationCostsResult struct{…}`433 - `type AdminOrganizationUsageImagesResponseDataResultOrganizationCostsResult struct{…}`

370 434 

371 The aggregated costs details of the specific time bucket.435 The aggregated costs details of the specific time bucket.

Details

338 338 

339 When `group_by=project_id`, this field provides the project ID of the grouped usage result.339 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

340 340 

341 - `type AdminOrganizationUsageModerationsResponseDataResultOrganizationUsageFileSearchesResult struct{…}`

342 

343 The aggregated file search calls usage details of the specific time bucket.

344 

345 - `NumRequests int64`

346 

347 The count of file search calls.

348 

349 - `Object OrganizationUsageFileSearchesResult`

350 

351 - `const OrganizationUsageFileSearchesResultOrganizationUsageFileSearchesResult OrganizationUsageFileSearchesResult = "organization.usage.file_searches.result"`

352 

353 - `APIKeyID string`

354 

355 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

356 

357 - `ProjectID string`

358 

359 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

360 

361 - `UserID string`

362 

363 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

364 

365 - `VectorStoreID string`

366 

367 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

368 

369 - `type AdminOrganizationUsageModerationsResponseDataResultOrganizationUsageWebSearchesResult struct{…}`

370 

371 The aggregated web search calls usage details of the specific time bucket.

372 

373 - `NumModelRequests int64`

374 

375 The count of model requests.

376 

377 - `NumRequests int64`

378 

379 The count of web search calls.

380 

381 - `Object OrganizationUsageWebSearchesResult`

382 

383 - `const OrganizationUsageWebSearchesResultOrganizationUsageWebSearchesResult OrganizationUsageWebSearchesResult = "organization.usage.web_searches.result"`

384 

385 - `APIKeyID string`

386 

387 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

388 

389 - `ContextLevel string`

390 

391 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

392 

393 - `Model string`

394 

395 When `group_by=model`, this field provides the model name of the grouped usage result.

396 

397 - `ProjectID string`

398 

399 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

400 

401 - `UserID string`

402 

403 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

404 

341 - `type AdminOrganizationUsageModerationsResponseDataResultOrganizationCostsResult struct{…}`405 - `type AdminOrganizationUsageModerationsResponseDataResultOrganizationCostsResult struct{…}`

342 406 

343 The aggregated costs details of the specific time bucket.407 The aggregated costs details of the specific time bucket.

Details

320 320 

321 When `group_by=project_id`, this field provides the project ID of the grouped usage result.321 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

322 322 

323 - `type AdminOrganizationUsageVectorStoresResponseDataResultOrganizationUsageFileSearchesResult struct{…}`

324 

325 The aggregated file search calls usage details of the specific time bucket.

326 

327 - `NumRequests int64`

328 

329 The count of file search calls.

330 

331 - `Object OrganizationUsageFileSearchesResult`

332 

333 - `const OrganizationUsageFileSearchesResultOrganizationUsageFileSearchesResult OrganizationUsageFileSearchesResult = "organization.usage.file_searches.result"`

334 

335 - `APIKeyID string`

336 

337 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

338 

339 - `ProjectID string`

340 

341 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

342 

343 - `UserID string`

344 

345 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

346 

347 - `VectorStoreID string`

348 

349 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

350 

351 - `type AdminOrganizationUsageVectorStoresResponseDataResultOrganizationUsageWebSearchesResult struct{…}`

352 

353 The aggregated web search calls usage details of the specific time bucket.

354 

355 - `NumModelRequests int64`

356 

357 The count of model requests.

358 

359 - `NumRequests int64`

360 

361 The count of web search calls.

362 

363 - `Object OrganizationUsageWebSearchesResult`

364 

365 - `const OrganizationUsageWebSearchesResultOrganizationUsageWebSearchesResult OrganizationUsageWebSearchesResult = "organization.usage.web_searches.result"`

366 

367 - `APIKeyID string`

368 

369 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

370 

371 - `ContextLevel string`

372 

373 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

374 

375 - `Model string`

376 

377 When `group_by=model`, this field provides the model name of the grouped usage result.

378 

379 - `ProjectID string`

380 

381 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

382 

383 - `UserID string`

384 

385 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

386 

323 - `type AdminOrganizationUsageVectorStoresResponseDataResultOrganizationCostsResult struct{…}`387 - `type AdminOrganizationUsageVectorStoresResponseDataResultOrganizationCostsResult struct{…}`

324 388 

325 The aggregated costs details of the specific time bucket.389 The aggregated costs details of the specific time bucket.

Details

1## Web search calls

2 

3`client.Admin.Organization.Usage.WebSearchCalls(ctx, query) (*AdminOrganizationUsageWebSearchCallsResponse, error)`

4 

5**get** `/organization/usage/web_search_calls`

6 

7Get web search calls usage details for the organization.

8 

9### Parameters

10 

11- `query AdminOrganizationUsageWebSearchCallsParams`

12 

13 - `StartTime param.Field[int64]`

14 

15 Start time (Unix seconds) of the query time range, inclusive.

16 

17 - `APIKeyIDs param.Field[[]string]`

18 

19 Return only usage for these API keys.

20 

21 - `BucketWidth param.Field[AdminOrganizationUsageWebSearchCallsParamsBucketWidth]`

22 

23 Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`.

24 

25 - `const AdminOrganizationUsageWebSearchCallsParamsBucketWidth1m AdminOrganizationUsageWebSearchCallsParamsBucketWidth = "1m"`

26 

27 - `const AdminOrganizationUsageWebSearchCallsParamsBucketWidth1h AdminOrganizationUsageWebSearchCallsParamsBucketWidth = "1h"`

28 

29 - `const AdminOrganizationUsageWebSearchCallsParamsBucketWidth1d AdminOrganizationUsageWebSearchCallsParamsBucketWidth = "1d"`

30 

31 - `ContextLevels param.Field[[]string]`

32 

33 Return only web search usage for these context levels.

34 

35 - `const AdminOrganizationUsageWebSearchCallsParamsContextLevelLow AdminOrganizationUsageWebSearchCallsParamsContextLevel = "low"`

36 

37 - `const AdminOrganizationUsageWebSearchCallsParamsContextLevelMedium AdminOrganizationUsageWebSearchCallsParamsContextLevel = "medium"`

38 

39 - `const AdminOrganizationUsageWebSearchCallsParamsContextLevelHigh AdminOrganizationUsageWebSearchCallsParamsContextLevel = "high"`

40 

41 - `EndTime param.Field[int64]`

42 

43 End time (Unix seconds) of the query time range, exclusive.

44 

45 - `GroupBy param.Field[[]string]`

46 

47 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.

48 

49 - `const AdminOrganizationUsageWebSearchCallsParamsGroupByProjectID AdminOrganizationUsageWebSearchCallsParamsGroupBy = "project_id"`

50 

51 - `const AdminOrganizationUsageWebSearchCallsParamsGroupByUserID AdminOrganizationUsageWebSearchCallsParamsGroupBy = "user_id"`

52 

53 - `const AdminOrganizationUsageWebSearchCallsParamsGroupByAPIKeyID AdminOrganizationUsageWebSearchCallsParamsGroupBy = "api_key_id"`

54 

55 - `const AdminOrganizationUsageWebSearchCallsParamsGroupByModel AdminOrganizationUsageWebSearchCallsParamsGroupBy = "model"`

56 

57 - `const AdminOrganizationUsageWebSearchCallsParamsGroupByContextLevel AdminOrganizationUsageWebSearchCallsParamsGroupBy = "context_level"`

58 

59 - `Limit param.Field[int64]`

60 

61 Specifies the number of buckets to return.

62 

63 - `bucket_width=1d`: default: 7, max: 31

64 - `bucket_width=1h`: default: 24, max: 168

65 - `bucket_width=1m`: default: 60, max: 1440

66 

67 - `Models param.Field[[]string]`

68 

69 Return only usage for these models.

70 

71 - `Page param.Field[string]`

72 

73 A cursor for use in pagination. Corresponding to the `next_page` field from the previous response.

74 

75 - `ProjectIDs param.Field[[]string]`

76 

77 Return only usage for these projects.

78 

79 - `UserIDs param.Field[[]string]`

80 

81 Return only usage for these users.

82 

83### Returns

84 

85- `type AdminOrganizationUsageWebSearchCallsResponse struct{…}`

86 

87 - `Data []AdminOrganizationUsageWebSearchCallsResponseData`

88 

89 - `EndTime int64`

90 

91 - `Object Bucket`

92 

93 - `const BucketBucket Bucket = "bucket"`

94 

95 - `Results []AdminOrganizationUsageWebSearchCallsResponseDataResultUnion`

96 

97 - `type AdminOrganizationUsageWebSearchCallsResponseDataResultOrganizationUsageCompletionsResult struct{…}`

98 

99 The aggregated completions usage details of the specific time bucket.

100 

101 - `InputTokens int64`

102 

103 The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.

104 

105 - `NumModelRequests int64`

106 

107 The count of requests made to the model.

108 

109 - `Object OrganizationUsageCompletionsResult`

110 

111 - `const OrganizationUsageCompletionsResultOrganizationUsageCompletionsResult OrganizationUsageCompletionsResult = "organization.usage.completions.result"`

112 

113 - `OutputTokens int64`

114 

115 The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.

116 

117 - `APIKeyID string`

118 

119 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

120 

121 - `Batch bool`

122 

123 When `group_by=batch`, this field tells whether the grouped usage result is batch or not.

124 

125 - `InputAudioTokens int64`

126 

127 The aggregated number of audio input tokens used, including cached tokens.

128 

129 - `InputCachedTokens int64`

130 

131 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.

132 

133 - `Model string`

134 

135 When `group_by=model`, this field provides the model name of the grouped usage result.

136 

137 - `OutputAudioTokens int64`

138 

139 The aggregated number of audio output tokens used.

140 

141 - `ProjectID string`

142 

143 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

144 

145 - `ServiceTier string`

146 

147 When `group_by=service_tier`, this field provides the service tier of the grouped usage result.

148 

149 - `UserID string`

150 

151 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

152 

153 - `type AdminOrganizationUsageWebSearchCallsResponseDataResultOrganizationUsageEmbeddingsResult struct{…}`

154 

155 The aggregated embeddings usage details of the specific time bucket.

156 

157 - `InputTokens int64`

158 

159 The aggregated number of input tokens used.

160 

161 - `NumModelRequests int64`

162 

163 The count of requests made to the model.

164 

165 - `Object OrganizationUsageEmbeddingsResult`

166 

167 - `const OrganizationUsageEmbeddingsResultOrganizationUsageEmbeddingsResult OrganizationUsageEmbeddingsResult = "organization.usage.embeddings.result"`

168 

169 - `APIKeyID string`

170 

171 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

172 

173 - `Model string`

174 

175 When `group_by=model`, this field provides the model name of the grouped usage result.

176 

177 - `ProjectID string`

178 

179 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

180 

181 - `UserID string`

182 

183 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

184 

185 - `type AdminOrganizationUsageWebSearchCallsResponseDataResultOrganizationUsageModerationsResult struct{…}`

186 

187 The aggregated moderations usage details of the specific time bucket.

188 

189 - `InputTokens int64`

190 

191 The aggregated number of input tokens used.

192 

193 - `NumModelRequests int64`

194 

195 The count of requests made to the model.

196 

197 - `Object OrganizationUsageModerationsResult`

198 

199 - `const OrganizationUsageModerationsResultOrganizationUsageModerationsResult OrganizationUsageModerationsResult = "organization.usage.moderations.result"`

200 

201 - `APIKeyID string`

202 

203 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

204 

205 - `Model string`

206 

207 When `group_by=model`, this field provides the model name of the grouped usage result.

208 

209 - `ProjectID string`

210 

211 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

212 

213 - `UserID string`

214 

215 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

216 

217 - `type AdminOrganizationUsageWebSearchCallsResponseDataResultOrganizationUsageImagesResult struct{…}`

218 

219 The aggregated images usage details of the specific time bucket.

220 

221 - `Images int64`

222 

223 The number of images processed.

224 

225 - `NumModelRequests int64`

226 

227 The count of requests made to the model.

228 

229 - `Object OrganizationUsageImagesResult`

230 

231 - `const OrganizationUsageImagesResultOrganizationUsageImagesResult OrganizationUsageImagesResult = "organization.usage.images.result"`

232 

233 - `APIKeyID string`

234 

235 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

236 

237 - `Model string`

238 

239 When `group_by=model`, this field provides the model name of the grouped usage result.

240 

241 - `ProjectID string`

242 

243 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

244 

245 - `Size string`

246 

247 When `group_by=size`, this field provides the image size of the grouped usage result.

248 

249 - `Source string`

250 

251 When `group_by=source`, this field provides the source of the grouped usage result, possible values are `image.generation`, `image.edit`, `image.variation`.

252 

253 - `UserID string`

254 

255 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

256 

257 - `type AdminOrganizationUsageWebSearchCallsResponseDataResultOrganizationUsageAudioSpeechesResult struct{…}`

258 

259 The aggregated audio speeches usage details of the specific time bucket.

260 

261 - `Characters int64`

262 

263 The number of characters processed.

264 

265 - `NumModelRequests int64`

266 

267 The count of requests made to the model.

268 

269 - `Object OrganizationUsageAudioSpeechesResult`

270 

271 - `const OrganizationUsageAudioSpeechesResultOrganizationUsageAudioSpeechesResult OrganizationUsageAudioSpeechesResult = "organization.usage.audio_speeches.result"`

272 

273 - `APIKeyID string`

274 

275 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

276 

277 - `Model string`

278 

279 When `group_by=model`, this field provides the model name of the grouped usage result.

280 

281 - `ProjectID string`

282 

283 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

284 

285 - `UserID string`

286 

287 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

288 

289 - `type AdminOrganizationUsageWebSearchCallsResponseDataResultOrganizationUsageAudioTranscriptionsResult struct{…}`

290 

291 The aggregated audio transcriptions usage details of the specific time bucket.

292 

293 - `NumModelRequests int64`

294 

295 The count of requests made to the model.

296 

297 - `Object OrganizationUsageAudioTranscriptionsResult`

298 

299 - `const OrganizationUsageAudioTranscriptionsResultOrganizationUsageAudioTranscriptionsResult OrganizationUsageAudioTranscriptionsResult = "organization.usage.audio_transcriptions.result"`

300 

301 - `Seconds int64`

302 

303 The number of seconds processed.

304 

305 - `APIKeyID string`

306 

307 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

308 

309 - `Model string`

310 

311 When `group_by=model`, this field provides the model name of the grouped usage result.

312 

313 - `ProjectID string`

314 

315 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

316 

317 - `UserID string`

318 

319 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

320 

321 - `type AdminOrganizationUsageWebSearchCallsResponseDataResultOrganizationUsageVectorStoresResult struct{…}`

322 

323 The aggregated vector stores usage details of the specific time bucket.

324 

325 - `Object OrganizationUsageVectorStoresResult`

326 

327 - `const OrganizationUsageVectorStoresResultOrganizationUsageVectorStoresResult OrganizationUsageVectorStoresResult = "organization.usage.vector_stores.result"`

328 

329 - `UsageBytes int64`

330 

331 The vector stores usage in bytes.

332 

333 - `ProjectID string`

334 

335 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

336 

337 - `type AdminOrganizationUsageWebSearchCallsResponseDataResultOrganizationUsageCodeInterpreterSessionsResult struct{…}`

338 

339 The aggregated code interpreter sessions usage details of the specific time bucket.

340 

341 - `NumSessions int64`

342 

343 The number of code interpreter sessions.

344 

345 - `Object OrganizationUsageCodeInterpreterSessionsResult`

346 

347 - `const OrganizationUsageCodeInterpreterSessionsResultOrganizationUsageCodeInterpreterSessionsResult OrganizationUsageCodeInterpreterSessionsResult = "organization.usage.code_interpreter_sessions.result"`

348 

349 - `ProjectID string`

350 

351 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

352 

353 - `type AdminOrganizationUsageWebSearchCallsResponseDataResultOrganizationUsageFileSearchesResult struct{…}`

354 

355 The aggregated file search calls usage details of the specific time bucket.

356 

357 - `NumRequests int64`

358 

359 The count of file search calls.

360 

361 - `Object OrganizationUsageFileSearchesResult`

362 

363 - `const OrganizationUsageFileSearchesResultOrganizationUsageFileSearchesResult OrganizationUsageFileSearchesResult = "organization.usage.file_searches.result"`

364 

365 - `APIKeyID string`

366 

367 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

368 

369 - `ProjectID string`

370 

371 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

372 

373 - `UserID string`

374 

375 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

376 

377 - `VectorStoreID string`

378 

379 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

380 

381 - `type AdminOrganizationUsageWebSearchCallsResponseDataResultOrganizationUsageWebSearchesResult struct{…}`

382 

383 The aggregated web search calls usage details of the specific time bucket.

384 

385 - `NumModelRequests int64`

386 

387 The count of model requests.

388 

389 - `NumRequests int64`

390 

391 The count of web search calls.

392 

393 - `Object OrganizationUsageWebSearchesResult`

394 

395 - `const OrganizationUsageWebSearchesResultOrganizationUsageWebSearchesResult OrganizationUsageWebSearchesResult = "organization.usage.web_searches.result"`

396 

397 - `APIKeyID string`

398 

399 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

400 

401 - `ContextLevel string`

402 

403 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

404 

405 - `Model string`

406 

407 When `group_by=model`, this field provides the model name of the grouped usage result.

408 

409 - `ProjectID string`

410 

411 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

412 

413 - `UserID string`

414 

415 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

416 

417 - `type AdminOrganizationUsageWebSearchCallsResponseDataResultOrganizationCostsResult struct{…}`

418 

419 The aggregated costs details of the specific time bucket.

420 

421 - `Object OrganizationCostsResult`

422 

423 - `const OrganizationCostsResultOrganizationCostsResult OrganizationCostsResult = "organization.costs.result"`

424 

425 - `Amount AdminOrganizationUsageWebSearchCallsResponseDataResultOrganizationCostsResultAmount`

426 

427 The monetary value in its associated currency.

428 

429 - `Currency string`

430 

431 Lowercase ISO-4217 currency e.g. "usd"

432 

433 - `Value float64`

434 

435 The numeric value of the cost.

436 

437 - `APIKeyID string`

438 

439 When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result.

440 

441 - `LineItem string`

442 

443 When `group_by=line_item`, this field provides the line item of the grouped costs result.

444 

445 - `ProjectID string`

446 

447 When `group_by=project_id`, this field provides the project ID of the grouped costs result.

448 

449 - `Quantity float64`

450 

451 When `group_by=line_item`, this field provides the quantity of the grouped costs result.

452 

453 - `StartTime int64`

454 

455 - `HasMore bool`

456 

457 - `NextPage string`

458 

459 - `Object Page`

460 

461 - `const PagePage Page = "page"`

462 

463### Example

464 

465```go

466package main

467 

468import (

469 "context"

470 "fmt"

471 

472 "github.com/openai/openai-go"

473 "github.com/openai/openai-go/option"

474)

475 

476func main() {

477 client := openai.NewClient(

478 option.WithAdminAPIKey("My Admin API Key"),

479 )

480 response, err := client.Admin.Organization.Usage.WebSearchCalls(context.TODO(), openai.AdminOrganizationUsageWebSearchCallsParams{

481 StartTime: 0,

482 })

483 if err != nil {

484 panic(err.Error())

485 }

486 fmt.Printf("%+v\n", response.Data)

487}

488```

489 

490#### Response

491 

492```json

493{

494 "data": [

495 {

496 "end_time": 0,

497 "object": "bucket",

498 "results": [

499 {

500 "input_tokens": 0,

501 "num_model_requests": 0,

502 "object": "organization.usage.completions.result",

503 "output_tokens": 0,

504 "api_key_id": "api_key_id",

505 "batch": true,

506 "input_audio_tokens": 0,

507 "input_cached_tokens": 0,

508 "model": "model",

509 "output_audio_tokens": 0,

510 "project_id": "project_id",

511 "service_tier": "service_tier",

512 "user_id": "user_id"

513 }

514 ],

515 "start_time": 0

516 }

517 ],

518 "has_more": true,

519 "next_page": "next_page",

520 "object": "page"

521}

522```

Details

2940 2940 

2941 The namespace of the custom tool being called.2941 The namespace of the custom tool being called.

2942 2942 

2943 - `type ResponseInputItemCompactionTrigger struct{…}`

2944 

2945 Compacts the current context. Must be the final input item.

2946 

2947 - `Type CompactionTrigger`

2948 

2949 The type of the item. Always `compaction_trigger`.

2950 

2951 - `const CompactionTriggerCompactionTrigger CompactionTrigger = "compaction_trigger"`

2952 

2943 - `type ResponseInputItemItemReference struct{…}`2953 - `type ResponseInputItemItemReference struct{…}`

2944 2954 

2945 An internal identifier for an item to reference.2955 An internal identifier for an item to reference.

Details

2942 2942 

2943 The namespace of the custom tool being called.2943 The namespace of the custom tool being called.

2944 2944 

2945 - `type ResponseInputItemCompactionTrigger struct{…}`

2946 

2947 Compacts the current context. Must be the final input item.

2948 

2949 - `Type CompactionTrigger`

2950 

2951 The type of the item. Always `compaction_trigger`.

2952 

2953 - `const CompactionTriggerCompactionTrigger CompactionTrigger = "compaction_trigger"`

2954 

2945 - `type ResponseInputItemItemReference struct{…}`2955 - `type ResponseInputItemItemReference struct{…}`

2946 2956 

2947 An internal identifier for an item to reference.2957 An internal identifier for an item to reference.

Details

3025 3025 

3026 The namespace of the custom tool being called.3026 The namespace of the custom tool being called.

3027 3027 

3028 - `type ResponseInputItemCompactionTrigger struct{…}`

3029 

3030 Compacts the current context. Must be the final input item.

3031 

3032 - `Type CompactionTrigger`

3033 

3034 The type of the item. Always `compaction_trigger`.

3035 

3036 - `const CompactionTriggerCompactionTrigger CompactionTrigger = "compaction_trigger"`

3037 

3028 - `type ResponseInputItemItemReference struct{…}`3038 - `type ResponseInputItemItemReference struct{…}`

3029 3039 

3030 An internal identifier for an item to reference.3040 An internal identifier for an item to reference.

Details

3142 3142 

3143 The namespace of the custom tool being called.3143 The namespace of the custom tool being called.

3144 3144 

3145 - `type ResponseInputItemCompactionTrigger struct{…}`

3146 

3147 Compacts the current context. Must be the final input item.

3148 

3149 - `Type CompactionTrigger`

3150 

3151 The type of the item. Always `compaction_trigger`.

3152 

3153 - `const CompactionTriggerCompactionTrigger CompactionTrigger = "compaction_trigger"`

3154 

3145 - `type ResponseInputItemItemReference struct{…}`3155 - `type ResponseInputItemItemReference struct{…}`

3146 3156 

3147 An internal identifier for an item to reference.3157 An internal identifier for an item to reference.

Details

3021 3021 

3022 The namespace of the custom tool being called.3022 The namespace of the custom tool being called.

3023 3023 

3024 - `type ResponseInputItemCompactionTrigger struct{…}`

3025 

3026 Compacts the current context. Must be the final input item.

3027 

3028 - `Type CompactionTrigger`

3029 

3030 The type of the item. Always `compaction_trigger`.

3031 

3032 - `const CompactionTriggerCompactionTrigger CompactionTrigger = "compaction_trigger"`

3033 

3024 - `type ResponseInputItemItemReference struct{…}`3034 - `type ResponseInputItemItemReference struct{…}`

3025 3035 

3026 An internal identifier for an item to reference.3036 An internal identifier for an item to reference.


6454 6464 

6455 The namespace of the custom tool being called.6465 The namespace of the custom tool being called.

6456 6466 

6467 - `type ResponseInputItemCompactionTrigger struct{…}`

6468 

6469 Compacts the current context. Must be the final input item.

6470 

6471 - `Type CompactionTrigger`

6472 

6473 The type of the item. Always `compaction_trigger`.

6474 

6475 - `const CompactionTriggerCompactionTrigger CompactionTrigger = "compaction_trigger"`

6476 

6457 - `type ResponseInputItemItemReference struct{…}`6477 - `type ResponseInputItemItemReference struct{…}`

6458 6478 

6459 An internal identifier for an item to reference.6479 An internal identifier for an item to reference.

Details

3062 3062 

3063 The namespace of the custom tool being called.3063 The namespace of the custom tool being called.

3064 3064 

3065 - `type ResponseInputItemCompactionTrigger struct{…}`

3066 

3067 Compacts the current context. Must be the final input item.

3068 

3069 - `Type CompactionTrigger`

3070 

3071 The type of the item. Always `compaction_trigger`.

3072 

3073 - `const CompactionTriggerCompactionTrigger CompactionTrigger = "compaction_trigger"`

3074 

3065 - `type ResponseInputItemItemReference struct{…}`3075 - `type ResponseInputItemItemReference struct{…}`

3066 3076 

3067 An internal identifier for an item to reference.3077 An internal identifier for an item to reference.

Details

2963 2963 

2964 The namespace of the custom tool being called.2964 The namespace of the custom tool being called.

2965 2965 

2966 - `type ResponseInputItemCompactionTrigger struct{…}`

2967 

2968 Compacts the current context. Must be the final input item.

2969 

2970 - `Type CompactionTrigger`

2971 

2972 The type of the item. Always `compaction_trigger`.

2973 

2974 - `const CompactionTriggerCompactionTrigger CompactionTrigger = "compaction_trigger"`

2975 

2966 - `type ResponseInputItemItemReference struct{…}`2976 - `type ResponseInputItemItemReference struct{…}`

2967 2977 

2968 An internal identifier for an item to reference.2978 An internal identifier for an item to reference.

Details

24 24 

25 - `Optional<List<Project>> projects`25 - `Optional<List<Project>> projects`

26 26 

27 An array of projects to which membership is granted at the same time the org invite is accepted. If omitted, the user will be invited to the default project for compatibility with legacy behavior.27 An array of projects to which membership is granted at the same time the org invite is accepted. If omitted, the user will be invited to the default project for compatibility with legacy behavior. If empty list is passed, the user will not be invited to any projects, including the default one.

28 28 

29 - `String id`29 - `String id`

30 30 

Details

1## Retrieve project hosted tool permissions

2 

3`ProjectHostedToolPermissions admin().organization().projects().hostedToolPermissions().retrieve(HostedToolPermissionRetrieveParamsparams = HostedToolPermissionRetrieveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())`

4 

5**get** `/organization/projects/{project_id}/hosted_tool_permissions`

6 

7Returns hosted tool permissions for a project.

8 

9### Parameters

10 

11- `HostedToolPermissionRetrieveParams params`

12 

13 - `Optional<String> projectId`

14 

15### Returns

16 

17- `class ProjectHostedToolPermissions:`

18 

19 Represents hosted tool permissions for a project.

20 

21 - `CodeInterpreter codeInterpreter`

22 

23 Permission state for a single hosted tool on a project.

24 

25 - `boolean enabled`

26 

27 Whether the hosted tool is enabled for the project.

28 

29 - `FileSearch fileSearch`

30 

31 Permission state for a single hosted tool on a project.

32 

33 - `boolean enabled`

34 

35 Whether the hosted tool is enabled for the project.

36 

37 - `ImageGeneration imageGeneration`

38 

39 Permission state for a single hosted tool on a project.

40 

41 - `boolean enabled`

42 

43 Whether the hosted tool is enabled for the project.

44 

45 - `Mcp mcp`

46 

47 Permission state for a single hosted tool on a project.

48 

49 - `boolean enabled`

50 

51 Whether the hosted tool is enabled for the project.

52 

53 - `WebSearch webSearch`

54 

55 Permission state for a single hosted tool on a project.

56 

57 - `boolean enabled`

58 

59 Whether the hosted tool is enabled for the project.

60 

61### Example

62 

63```java

64package com.openai.example;

65 

66import com.openai.client.OpenAIClient;

67import com.openai.client.okhttp.OpenAIOkHttpClient;

68import com.openai.models.admin.organization.projects.hostedtoolpermissions.HostedToolPermissionRetrieveParams;

69import com.openai.models.admin.organization.projects.hostedtoolpermissions.ProjectHostedToolPermissions;

70 

71public final class Main {

72 private Main() {}

73 

74 public static void main(String[] args) {

75 OpenAIClient client = OpenAIOkHttpClient.fromEnv();

76 

77 ProjectHostedToolPermissions projectHostedToolPermissions = client.admin().organization().projects().hostedToolPermissions().retrieve("project_id");

78 }

79}

80```

81 

82#### Response

83 

84```json

85{

86 "code_interpreter": {

87 "enabled": true

88 },

89 "file_search": {

90 "enabled": true

91 },

92 "image_generation": {

93 "enabled": true

94 },

95 "mcp": {

96 "enabled": true

97 },

98 "web_search": {

99 "enabled": true

100 }

101}

102```

Details

1## Modify project hosted tool permissions

2 

3`ProjectHostedToolPermissions admin().organization().projects().hostedToolPermissions().update(HostedToolPermissionUpdateParamsparams = HostedToolPermissionUpdateParams.none(), RequestOptionsrequestOptions = RequestOptions.none())`

4 

5**post** `/organization/projects/{project_id}/hosted_tool_permissions`

6 

7Updates hosted tool permissions for a project.

8 

9### Parameters

10 

11- `HostedToolPermissionUpdateParams params`

12 

13 - `Optional<String> projectId`

14 

15 - `Optional<CodeInterpreter> codeInterpreter`

16 

17 The code interpreter permission update.

18 

19 - `boolean enabled`

20 

21 Whether to enable the hosted tool for the project.

22 

23 - `Optional<FileSearch> fileSearch`

24 

25 The file search permission update.

26 

27 - `boolean enabled`

28 

29 Whether to enable the hosted tool for the project.

30 

31 - `Optional<ImageGeneration> imageGeneration`

32 

33 The image generation permission update.

34 

35 - `boolean enabled`

36 

37 Whether to enable the hosted tool for the project.

38 

39 - `Optional<Mcp> mcp`

40 

41 The MCP permission update.

42 

43 - `boolean enabled`

44 

45 Whether to enable the hosted tool for the project.

46 

47 - `Optional<WebSearch> webSearch`

48 

49 The web search permission update.

50 

51 - `boolean enabled`

52 

53 Whether to enable the hosted tool for the project.

54 

55### Returns

56 

57- `class ProjectHostedToolPermissions:`

58 

59 Represents hosted tool permissions for a project.

60 

61 - `CodeInterpreter codeInterpreter`

62 

63 Permission state for a single hosted tool on a project.

64 

65 - `boolean enabled`

66 

67 Whether the hosted tool is enabled for the project.

68 

69 - `FileSearch fileSearch`

70 

71 Permission state for a single hosted tool on a project.

72 

73 - `boolean enabled`

74 

75 Whether the hosted tool is enabled for the project.

76 

77 - `ImageGeneration imageGeneration`

78 

79 Permission state for a single hosted tool on a project.

80 

81 - `boolean enabled`

82 

83 Whether the hosted tool is enabled for the project.

84 

85 - `Mcp mcp`

86 

87 Permission state for a single hosted tool on a project.

88 

89 - `boolean enabled`

90 

91 Whether the hosted tool is enabled for the project.

92 

93 - `WebSearch webSearch`

94 

95 Permission state for a single hosted tool on a project.

96 

97 - `boolean enabled`

98 

99 Whether the hosted tool is enabled for the project.

100 

101### Example

102 

103```java

104package com.openai.example;

105 

106import com.openai.client.OpenAIClient;

107import com.openai.client.okhttp.OpenAIOkHttpClient;

108import com.openai.models.admin.organization.projects.hostedtoolpermissions.HostedToolPermissionUpdateParams;

109import com.openai.models.admin.organization.projects.hostedtoolpermissions.ProjectHostedToolPermissions;

110 

111public final class Main {

112 private Main() {}

113 

114 public static void main(String[] args) {

115 OpenAIClient client = OpenAIOkHttpClient.fromEnv();

116 

117 ProjectHostedToolPermissions projectHostedToolPermissions = client.admin().organization().projects().hostedToolPermissions().update("project_id");

118 }

119}

120```

121 

122#### Response

123 

124```json

125{

126 "code_interpreter": {

127 "enabled": true

128 },

129 "file_search": {

130 "enabled": true

131 },

132 "image_generation": {

133 "enabled": true

134 },

135 "mcp": {

136 "enabled": true

137 },

138 "web_search": {

139 "enabled": true

140 }

141}

142```

Details

1## Delete project model permissions

2 

3`ProjectModelPermissionsDeleted admin().organization().projects().modelPermissions().delete(ModelPermissionDeleteParamsparams = ModelPermissionDeleteParams.none(), RequestOptionsrequestOptions = RequestOptions.none())`

4 

5**delete** `/organization/projects/{project_id}/model_permissions`

6 

7Deletes model permissions for a project.

8 

9### Parameters

10 

11- `ModelPermissionDeleteParams params`

12 

13 - `Optional<String> projectId`

14 

15### Returns

16 

17- `class ProjectModelPermissionsDeleted:`

18 

19 Confirmation payload returned after deleting project model permissions.

20 

21 - `boolean deleted`

22 

23 Whether the project model permissions were deleted.

24 

25 - `JsonValue; object_ "project.model_permissions.deleted"constant`

26 

27 The object type, which is always `project.model_permissions.deleted`.

28 

29 - `PROJECT_MODEL_PERMISSIONS_DELETED("project.model_permissions.deleted")`

30 

31### Example

32 

33```java

34package com.openai.example;

35 

36import com.openai.client.OpenAIClient;

37import com.openai.client.okhttp.OpenAIOkHttpClient;

38import com.openai.models.admin.organization.projects.modelpermissions.ModelPermissionDeleteParams;

39import com.openai.models.admin.organization.projects.modelpermissions.ProjectModelPermissionsDeleted;

40 

41public final class Main {

42 private Main() {}

43 

44 public static void main(String[] args) {

45 OpenAIClient client = OpenAIOkHttpClient.fromEnv();

46 

47 ProjectModelPermissionsDeleted projectModelPermissionsDeleted = client.admin().organization().projects().modelPermissions().delete("project_id");

48 }

49}

50```

51 

52#### Response

53 

54```json

55{

56 "deleted": true,

57 "object": "project.model_permissions.deleted"

58}

59```

Details

1## Retrieve project model permissions

2 

3`ProjectModelPermissions admin().organization().projects().modelPermissions().retrieve(ModelPermissionRetrieveParamsparams = ModelPermissionRetrieveParams.none(), RequestOptionsrequestOptions = RequestOptions.none())`

4 

5**get** `/organization/projects/{project_id}/model_permissions`

6 

7Returns model permissions for a project.

8 

9### Parameters

10 

11- `ModelPermissionRetrieveParams params`

12 

13 - `Optional<String> projectId`

14 

15### Returns

16 

17- `class ProjectModelPermissions:`

18 

19 Represents the model allowlist or denylist policy for a project.

20 

21 - `Mode mode`

22 

23 Whether the project uses an allowlist or a denylist.

24 

25 - `ALLOW_LIST("allow_list")`

26 

27 - `DENY_LIST("deny_list")`

28 

29 - `List<String> modelIds`

30 

31 The model IDs included in the model permissions policy.

32 

33 - `JsonValue; object_ "project.model_permissions"constant`

34 

35 The object type, which is always `project.model_permissions`.

36 

37 - `PROJECT_MODEL_PERMISSIONS("project.model_permissions")`

38 

39### Example

40 

41```java

42package com.openai.example;

43 

44import com.openai.client.OpenAIClient;

45import com.openai.client.okhttp.OpenAIOkHttpClient;

46import com.openai.models.admin.organization.projects.modelpermissions.ModelPermissionRetrieveParams;

47import com.openai.models.admin.organization.projects.modelpermissions.ProjectModelPermissions;

48 

49public final class Main {

50 private Main() {}

51 

52 public static void main(String[] args) {

53 OpenAIClient client = OpenAIOkHttpClient.fromEnv();

54 

55 ProjectModelPermissions projectModelPermissions = client.admin().organization().projects().modelPermissions().retrieve("project_id");

56 }

57}

58```

59 

60#### Response

61 

62```json

63{

64 "mode": "allow_list",

65 "model_ids": [

66 "string"

67 ],

68 "object": "project.model_permissions"

69}

70```

Details

1## Modify project model permissions

2 

3`ProjectModelPermissions admin().organization().projects().modelPermissions().update(ModelPermissionUpdateParamsparams, RequestOptionsrequestOptions = RequestOptions.none())`

4 

5**post** `/organization/projects/{project_id}/model_permissions`

6 

7Updates model permissions for a project.

8 

9### Parameters

10 

11- `ModelPermissionUpdateParams params`

12 

13 - `Optional<String> projectId`

14 

15 - `Mode mode`

16 

17 The model permissions mode to apply.

18 

19 - `ALLOW_LIST("allow_list")`

20 

21 - `DENY_LIST("deny_list")`

22 

23 - `List<String> modelIds`

24 

25 The model IDs included in this permissions policy.

26 

27### Returns

28 

29- `class ProjectModelPermissions:`

30 

31 Represents the model allowlist or denylist policy for a project.

32 

33 - `Mode mode`

34 

35 Whether the project uses an allowlist or a denylist.

36 

37 - `ALLOW_LIST("allow_list")`

38 

39 - `DENY_LIST("deny_list")`

40 

41 - `List<String> modelIds`

42 

43 The model IDs included in the model permissions policy.

44 

45 - `JsonValue; object_ "project.model_permissions"constant`

46 

47 The object type, which is always `project.model_permissions`.

48 

49 - `PROJECT_MODEL_PERMISSIONS("project.model_permissions")`

50 

51### Example

52 

53```java

54package com.openai.example;

55 

56import com.openai.client.OpenAIClient;

57import com.openai.client.okhttp.OpenAIOkHttpClient;

58import com.openai.models.admin.organization.projects.modelpermissions.ModelPermissionUpdateParams;

59import com.openai.models.admin.organization.projects.modelpermissions.ProjectModelPermissions;

60 

61public final class Main {

62 private Main() {}

63 

64 public static void main(String[] args) {

65 OpenAIClient client = OpenAIOkHttpClient.fromEnv();

66 

67 ModelPermissionUpdateParams params = ModelPermissionUpdateParams.builder()

68 .projectId("project_id")

69 .mode(ModelPermissionUpdateParams.Mode.ALLOW_LIST)

70 .addModelId("string")

71 .build();

72 ProjectModelPermissions projectModelPermissions = client.admin().organization().projects().modelPermissions().update(params);

73 }

74}

75```

76 

77#### Response

78 

79```json

80{

81 "mode": "allow_list",

82 "model_ids": [

83 "string"

84 ],

85 "object": "project.model_permissions"

86}

87```

Details

338 338 

339 When `group_by=project_id`, this field provides the project ID of the grouped usage result.339 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

340 340 

341 - `class OrganizationUsageFileSearchesResult:`

342 

343 The aggregated file search calls usage details of the specific time bucket.

344 

345 - `long numRequests`

346 

347 The count of file search calls.

348 

349 - `JsonValue; object_ "organization.usage.file_searches.result"constant`

350 

351 - `ORGANIZATION_USAGE_FILE_SEARCHES_RESULT("organization.usage.file_searches.result")`

352 

353 - `Optional<String> apiKeyId`

354 

355 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

356 

357 - `Optional<String> projectId`

358 

359 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

360 

361 - `Optional<String> userId`

362 

363 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

364 

365 - `Optional<String> vectorStoreId`

366 

367 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

368 

369 - `class OrganizationUsageWebSearchesResult:`

370 

371 The aggregated web search calls usage details of the specific time bucket.

372 

373 - `long numModelRequests`

374 

375 The count of model requests.

376 

377 - `long numRequests`

378 

379 The count of web search calls.

380 

381 - `JsonValue; object_ "organization.usage.web_searches.result"constant`

382 

383 - `ORGANIZATION_USAGE_WEB_SEARCHES_RESULT("organization.usage.web_searches.result")`

384 

385 - `Optional<String> apiKeyId`

386 

387 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

388 

389 - `Optional<String> contextLevel`

390 

391 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

392 

393 - `Optional<String> model`

394 

395 When `group_by=model`, this field provides the model name of the grouped usage result.

396 

397 - `Optional<String> projectId`

398 

399 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

400 

401 - `Optional<String> userId`

402 

403 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

404 

341 - `class OrganizationCostsResult:`405 - `class OrganizationCostsResult:`

342 406 

343 The aggregated costs details of the specific time bucket.407 The aggregated costs details of the specific time bucket.

Details

338 338 

339 When `group_by=project_id`, this field provides the project ID of the grouped usage result.339 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

340 340 

341 - `class OrganizationUsageFileSearchesResult:`

342 

343 The aggregated file search calls usage details of the specific time bucket.

344 

345 - `long numRequests`

346 

347 The count of file search calls.

348 

349 - `JsonValue; object_ "organization.usage.file_searches.result"constant`

350 

351 - `ORGANIZATION_USAGE_FILE_SEARCHES_RESULT("organization.usage.file_searches.result")`

352 

353 - `Optional<String> apiKeyId`

354 

355 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

356 

357 - `Optional<String> projectId`

358 

359 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

360 

361 - `Optional<String> userId`

362 

363 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

364 

365 - `Optional<String> vectorStoreId`

366 

367 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

368 

369 - `class OrganizationUsageWebSearchesResult:`

370 

371 The aggregated web search calls usage details of the specific time bucket.

372 

373 - `long numModelRequests`

374 

375 The count of model requests.

376 

377 - `long numRequests`

378 

379 The count of web search calls.

380 

381 - `JsonValue; object_ "organization.usage.web_searches.result"constant`

382 

383 - `ORGANIZATION_USAGE_WEB_SEARCHES_RESULT("organization.usage.web_searches.result")`

384 

385 - `Optional<String> apiKeyId`

386 

387 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

388 

389 - `Optional<String> contextLevel`

390 

391 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

392 

393 - `Optional<String> model`

394 

395 When `group_by=model`, this field provides the model name of the grouped usage result.

396 

397 - `Optional<String> projectId`

398 

399 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

400 

401 - `Optional<String> userId`

402 

403 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

404 

341 - `class OrganizationCostsResult:`405 - `class OrganizationCostsResult:`

342 406 

343 The aggregated costs details of the specific time bucket.407 The aggregated costs details of the specific time bucket.

Details

320 320 

321 When `group_by=project_id`, this field provides the project ID of the grouped usage result.321 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

322 322 

323 - `class OrganizationUsageFileSearchesResult:`

324 

325 The aggregated file search calls usage details of the specific time bucket.

326 

327 - `long numRequests`

328 

329 The count of file search calls.

330 

331 - `JsonValue; object_ "organization.usage.file_searches.result"constant`

332 

333 - `ORGANIZATION_USAGE_FILE_SEARCHES_RESULT("organization.usage.file_searches.result")`

334 

335 - `Optional<String> apiKeyId`

336 

337 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

338 

339 - `Optional<String> projectId`

340 

341 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

342 

343 - `Optional<String> userId`

344 

345 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

346 

347 - `Optional<String> vectorStoreId`

348 

349 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

350 

351 - `class OrganizationUsageWebSearchesResult:`

352 

353 The aggregated web search calls usage details of the specific time bucket.

354 

355 - `long numModelRequests`

356 

357 The count of model requests.

358 

359 - `long numRequests`

360 

361 The count of web search calls.

362 

363 - `JsonValue; object_ "organization.usage.web_searches.result"constant`

364 

365 - `ORGANIZATION_USAGE_WEB_SEARCHES_RESULT("organization.usage.web_searches.result")`

366 

367 - `Optional<String> apiKeyId`

368 

369 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

370 

371 - `Optional<String> contextLevel`

372 

373 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

374 

375 - `Optional<String> model`

376 

377 When `group_by=model`, this field provides the model name of the grouped usage result.

378 

379 - `Optional<String> projectId`

380 

381 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

382 

383 - `Optional<String> userId`

384 

385 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

386 

323 - `class OrganizationCostsResult:`387 - `class OrganizationCostsResult:`

324 388 

325 The aggregated costs details of the specific time bucket.389 The aggregated costs details of the specific time bucket.

Details

346 346 

347 When `group_by=project_id`, this field provides the project ID of the grouped usage result.347 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

348 348 

349 - `class OrganizationUsageFileSearchesResult:`

350 

351 The aggregated file search calls usage details of the specific time bucket.

352 

353 - `long numRequests`

354 

355 The count of file search calls.

356 

357 - `JsonValue; object_ "organization.usage.file_searches.result"constant`

358 

359 - `ORGANIZATION_USAGE_FILE_SEARCHES_RESULT("organization.usage.file_searches.result")`

360 

361 - `Optional<String> apiKeyId`

362 

363 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

364 

365 - `Optional<String> projectId`

366 

367 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

368 

369 - `Optional<String> userId`

370 

371 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

372 

373 - `Optional<String> vectorStoreId`

374 

375 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

376 

377 - `class OrganizationUsageWebSearchesResult:`

378 

379 The aggregated web search calls usage details of the specific time bucket.

380 

381 - `long numModelRequests`

382 

383 The count of model requests.

384 

385 - `long numRequests`

386 

387 The count of web search calls.

388 

389 - `JsonValue; object_ "organization.usage.web_searches.result"constant`

390 

391 - `ORGANIZATION_USAGE_WEB_SEARCHES_RESULT("organization.usage.web_searches.result")`

392 

393 - `Optional<String> apiKeyId`

394 

395 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

396 

397 - `Optional<String> contextLevel`

398 

399 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

400 

401 - `Optional<String> model`

402 

403 When `group_by=model`, this field provides the model name of the grouped usage result.

404 

405 - `Optional<String> projectId`

406 

407 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

408 

409 - `Optional<String> userId`

410 

411 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

412 

349 - `class OrganizationCostsResult:`413 - `class OrganizationCostsResult:`

350 414 

351 The aggregated costs details of the specific time bucket.415 The aggregated costs details of the specific time bucket.

Details

320 320 

321 When `group_by=project_id`, this field provides the project ID of the grouped usage result.321 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

322 322 

323 - `class OrganizationUsageFileSearchesResult:`

324 

325 The aggregated file search calls usage details of the specific time bucket.

326 

327 - `long numRequests`

328 

329 The count of file search calls.

330 

331 - `JsonValue; object_ "organization.usage.file_searches.result"constant`

332 

333 - `ORGANIZATION_USAGE_FILE_SEARCHES_RESULT("organization.usage.file_searches.result")`

334 

335 - `Optional<String> apiKeyId`

336 

337 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

338 

339 - `Optional<String> projectId`

340 

341 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

342 

343 - `Optional<String> userId`

344 

345 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

346 

347 - `Optional<String> vectorStoreId`

348 

349 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

350 

351 - `class OrganizationUsageWebSearchesResult:`

352 

353 The aggregated web search calls usage details of the specific time bucket.

354 

355 - `long numModelRequests`

356 

357 The count of model requests.

358 

359 - `long numRequests`

360 

361 The count of web search calls.

362 

363 - `JsonValue; object_ "organization.usage.web_searches.result"constant`

364 

365 - `ORGANIZATION_USAGE_WEB_SEARCHES_RESULT("organization.usage.web_searches.result")`

366 

367 - `Optional<String> apiKeyId`

368 

369 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

370 

371 - `Optional<String> contextLevel`

372 

373 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

374 

375 - `Optional<String> model`

376 

377 When `group_by=model`, this field provides the model name of the grouped usage result.

378 

379 - `Optional<String> projectId`

380 

381 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

382 

383 - `Optional<String> userId`

384 

385 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

386 

323 - `class OrganizationCostsResult:`387 - `class OrganizationCostsResult:`

324 388 

325 The aggregated costs details of the specific time bucket.389 The aggregated costs details of the specific time bucket.

Details

338 338 

339 When `group_by=project_id`, this field provides the project ID of the grouped usage result.339 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

340 340 

341 - `class OrganizationUsageFileSearchesResult:`

342 

343 The aggregated file search calls usage details of the specific time bucket.

344 

345 - `long numRequests`

346 

347 The count of file search calls.

348 

349 - `JsonValue; object_ "organization.usage.file_searches.result"constant`

350 

351 - `ORGANIZATION_USAGE_FILE_SEARCHES_RESULT("organization.usage.file_searches.result")`

352 

353 - `Optional<String> apiKeyId`

354 

355 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

356 

357 - `Optional<String> projectId`

358 

359 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

360 

361 - `Optional<String> userId`

362 

363 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

364 

365 - `Optional<String> vectorStoreId`

366 

367 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

368 

369 - `class OrganizationUsageWebSearchesResult:`

370 

371 The aggregated web search calls usage details of the specific time bucket.

372 

373 - `long numModelRequests`

374 

375 The count of model requests.

376 

377 - `long numRequests`

378 

379 The count of web search calls.

380 

381 - `JsonValue; object_ "organization.usage.web_searches.result"constant`

382 

383 - `ORGANIZATION_USAGE_WEB_SEARCHES_RESULT("organization.usage.web_searches.result")`

384 

385 - `Optional<String> apiKeyId`

386 

387 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

388 

389 - `Optional<String> contextLevel`

390 

391 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

392 

393 - `Optional<String> model`

394 

395 When `group_by=model`, this field provides the model name of the grouped usage result.

396 

397 - `Optional<String> projectId`

398 

399 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

400 

401 - `Optional<String> userId`

402 

403 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

404 

341 - `class OrganizationCostsResult:`405 - `class OrganizationCostsResult:`

342 406 

343 The aggregated costs details of the specific time bucket.407 The aggregated costs details of the specific time bucket.

Details

1## File search calls

2 

3`UsageFileSearchCallsResponse admin().organization().usage().fileSearchCalls(UsageFileSearchCallsParamsparams, RequestOptionsrequestOptions = RequestOptions.none())`

4 

5**get** `/organization/usage/file_search_calls`

6 

7Get file search calls usage details for the organization.

8 

9### Parameters

10 

11- `UsageFileSearchCallsParams params`

12 

13 - `long startTime`

14 

15 Start time (Unix seconds) of the query time range, inclusive.

16 

17 - `Optional<List<String>> apiKeyIds`

18 

19 Return only usage for these API keys.

20 

21 - `Optional<BucketWidth> bucketWidth`

22 

23 Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`.

24 

25 - `_1M("1m")`

26 

27 - `_1H("1h")`

28 

29 - `_1D("1d")`

30 

31 - `Optional<Long> endTime`

32 

33 End time (Unix seconds) of the query time range, exclusive.

34 

35 - `Optional<List<GroupBy>> groupBy`

36 

37 Group the usage data by the specified fields. Support fields include `project_id`, `user_id`, `api_key_id`, `vector_store_id` or any combination of them.

38 

39 - `PROJECT_ID("project_id")`

40 

41 - `USER_ID("user_id")`

42 

43 - `API_KEY_ID("api_key_id")`

44 

45 - `VECTOR_STORE_ID("vector_store_id")`

46 

47 - `Optional<Long> limit`

48 

49 Specifies the number of buckets to return.

50 

51 - `bucket_width=1d`: default: 7, max: 31

52 - `bucket_width=1h`: default: 24, max: 168

53 - `bucket_width=1m`: default: 60, max: 1440

54 

55 - `Optional<String> page`

56 

57 A cursor for use in pagination. Corresponding to the `next_page` field from the previous response.

58 

59 - `Optional<List<String>> projectIds`

60 

61 Return only usage for these projects.

62 

63 - `Optional<List<String>> userIds`

64 

65 Return only usage for these users.

66 

67 - `Optional<List<String>> vectorStoreIds`

68 

69 Return only usage for these vector stores.

70 

71### Returns

72 

73- `class UsageFileSearchCallsResponse:`

74 

75 - `List<Data> data`

76 

77 - `long endTime`

78 

79 - `JsonValue; object_ "bucket"constant`

80 

81 - `BUCKET("bucket")`

82 

83 - `List<Result> results`

84 

85 - `class OrganizationUsageCompletionsResult:`

86 

87 The aggregated completions usage details of the specific time bucket.

88 

89 - `long inputTokens`

90 

91 The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.

92 

93 - `long numModelRequests`

94 

95 The count of requests made to the model.

96 

97 - `JsonValue; object_ "organization.usage.completions.result"constant`

98 

99 - `ORGANIZATION_USAGE_COMPLETIONS_RESULT("organization.usage.completions.result")`

100 

101 - `long outputTokens`

102 

103 The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.

104 

105 - `Optional<String> apiKeyId`

106 

107 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

108 

109 - `Optional<Boolean> batch`

110 

111 When `group_by=batch`, this field tells whether the grouped usage result is batch or not.

112 

113 - `Optional<Long> inputAudioTokens`

114 

115 The aggregated number of audio input tokens used, including cached tokens.

116 

117 - `Optional<Long> inputCachedTokens`

118 

119 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.

120 

121 - `Optional<String> model`

122 

123 When `group_by=model`, this field provides the model name of the grouped usage result.

124 

125 - `Optional<Long> outputAudioTokens`

126 

127 The aggregated number of audio output tokens used.

128 

129 - `Optional<String> projectId`

130 

131 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

132 

133 - `Optional<String> serviceTier`

134 

135 When `group_by=service_tier`, this field provides the service tier of the grouped usage result.

136 

137 - `Optional<String> userId`

138 

139 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

140 

141 - `class OrganizationUsageEmbeddingsResult:`

142 

143 The aggregated embeddings usage details of the specific time bucket.

144 

145 - `long inputTokens`

146 

147 The aggregated number of input tokens used.

148 

149 - `long numModelRequests`

150 

151 The count of requests made to the model.

152 

153 - `JsonValue; object_ "organization.usage.embeddings.result"constant`

154 

155 - `ORGANIZATION_USAGE_EMBEDDINGS_RESULT("organization.usage.embeddings.result")`

156 

157 - `Optional<String> apiKeyId`

158 

159 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

160 

161 - `Optional<String> model`

162 

163 When `group_by=model`, this field provides the model name of the grouped usage result.

164 

165 - `Optional<String> projectId`

166 

167 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

168 

169 - `Optional<String> userId`

170 

171 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

172 

173 - `class OrganizationUsageModerationsResult:`

174 

175 The aggregated moderations usage details of the specific time bucket.

176 

177 - `long inputTokens`

178 

179 The aggregated number of input tokens used.

180 

181 - `long numModelRequests`

182 

183 The count of requests made to the model.

184 

185 - `JsonValue; object_ "organization.usage.moderations.result"constant`

186 

187 - `ORGANIZATION_USAGE_MODERATIONS_RESULT("organization.usage.moderations.result")`

188 

189 - `Optional<String> apiKeyId`

190 

191 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

192 

193 - `Optional<String> model`

194 

195 When `group_by=model`, this field provides the model name of the grouped usage result.

196 

197 - `Optional<String> projectId`

198 

199 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

200 

201 - `Optional<String> userId`

202 

203 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

204 

205 - `class OrganizationUsageImagesResult:`

206 

207 The aggregated images usage details of the specific time bucket.

208 

209 - `long images`

210 

211 The number of images processed.

212 

213 - `long numModelRequests`

214 

215 The count of requests made to the model.

216 

217 - `JsonValue; object_ "organization.usage.images.result"constant`

218 

219 - `ORGANIZATION_USAGE_IMAGES_RESULT("organization.usage.images.result")`

220 

221 - `Optional<String> apiKeyId`

222 

223 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

224 

225 - `Optional<String> model`

226 

227 When `group_by=model`, this field provides the model name of the grouped usage result.

228 

229 - `Optional<String> projectId`

230 

231 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

232 

233 - `Optional<String> size`

234 

235 When `group_by=size`, this field provides the image size of the grouped usage result.

236 

237 - `Optional<String> source`

238 

239 When `group_by=source`, this field provides the source of the grouped usage result, possible values are `image.generation`, `image.edit`, `image.variation`.

240 

241 - `Optional<String> userId`

242 

243 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

244 

245 - `class OrganizationUsageAudioSpeechesResult:`

246 

247 The aggregated audio speeches usage details of the specific time bucket.

248 

249 - `long characters`

250 

251 The number of characters processed.

252 

253 - `long numModelRequests`

254 

255 The count of requests made to the model.

256 

257 - `JsonValue; object_ "organization.usage.audio_speeches.result"constant`

258 

259 - `ORGANIZATION_USAGE_AUDIO_SPEECHES_RESULT("organization.usage.audio_speeches.result")`

260 

261 - `Optional<String> apiKeyId`

262 

263 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

264 

265 - `Optional<String> model`

266 

267 When `group_by=model`, this field provides the model name of the grouped usage result.

268 

269 - `Optional<String> projectId`

270 

271 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

272 

273 - `Optional<String> userId`

274 

275 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

276 

277 - `class OrganizationUsageAudioTranscriptionsResult:`

278 

279 The aggregated audio transcriptions usage details of the specific time bucket.

280 

281 - `long numModelRequests`

282 

283 The count of requests made to the model.

284 

285 - `JsonValue; object_ "organization.usage.audio_transcriptions.result"constant`

286 

287 - `ORGANIZATION_USAGE_AUDIO_TRANSCRIPTIONS_RESULT("organization.usage.audio_transcriptions.result")`

288 

289 - `long seconds`

290 

291 The number of seconds processed.

292 

293 - `Optional<String> apiKeyId`

294 

295 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

296 

297 - `Optional<String> model`

298 

299 When `group_by=model`, this field provides the model name of the grouped usage result.

300 

301 - `Optional<String> projectId`

302 

303 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

304 

305 - `Optional<String> userId`

306 

307 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

308 

309 - `class OrganizationUsageVectorStoresResult:`

310 

311 The aggregated vector stores usage details of the specific time bucket.

312 

313 - `JsonValue; object_ "organization.usage.vector_stores.result"constant`

314 

315 - `ORGANIZATION_USAGE_VECTOR_STORES_RESULT("organization.usage.vector_stores.result")`

316 

317 - `long usageBytes`

318 

319 The vector stores usage in bytes.

320 

321 - `Optional<String> projectId`

322 

323 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

324 

325 - `class OrganizationUsageCodeInterpreterSessionsResult:`

326 

327 The aggregated code interpreter sessions usage details of the specific time bucket.

328 

329 - `long numSessions`

330 

331 The number of code interpreter sessions.

332 

333 - `JsonValue; object_ "organization.usage.code_interpreter_sessions.result"constant`

334 

335 - `ORGANIZATION_USAGE_CODE_INTERPRETER_SESSIONS_RESULT("organization.usage.code_interpreter_sessions.result")`

336 

337 - `Optional<String> projectId`

338 

339 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

340 

341 - `class OrganizationUsageFileSearchesResult:`

342 

343 The aggregated file search calls usage details of the specific time bucket.

344 

345 - `long numRequests`

346 

347 The count of file search calls.

348 

349 - `JsonValue; object_ "organization.usage.file_searches.result"constant`

350 

351 - `ORGANIZATION_USAGE_FILE_SEARCHES_RESULT("organization.usage.file_searches.result")`

352 

353 - `Optional<String> apiKeyId`

354 

355 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

356 

357 - `Optional<String> projectId`

358 

359 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

360 

361 - `Optional<String> userId`

362 

363 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

364 

365 - `Optional<String> vectorStoreId`

366 

367 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

368 

369 - `class OrganizationUsageWebSearchesResult:`

370 

371 The aggregated web search calls usage details of the specific time bucket.

372 

373 - `long numModelRequests`

374 

375 The count of model requests.

376 

377 - `long numRequests`

378 

379 The count of web search calls.

380 

381 - `JsonValue; object_ "organization.usage.web_searches.result"constant`

382 

383 - `ORGANIZATION_USAGE_WEB_SEARCHES_RESULT("organization.usage.web_searches.result")`

384 

385 - `Optional<String> apiKeyId`

386 

387 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

388 

389 - `Optional<String> contextLevel`

390 

391 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

392 

393 - `Optional<String> model`

394 

395 When `group_by=model`, this field provides the model name of the grouped usage result.

396 

397 - `Optional<String> projectId`

398 

399 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

400 

401 - `Optional<String> userId`

402 

403 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

404 

405 - `class OrganizationCostsResult:`

406 

407 The aggregated costs details of the specific time bucket.

408 

409 - `JsonValue; object_ "organization.costs.result"constant`

410 

411 - `ORGANIZATION_COSTS_RESULT("organization.costs.result")`

412 

413 - `Optional<Amount> amount`

414 

415 The monetary value in its associated currency.

416 

417 - `Optional<String> currency`

418 

419 Lowercase ISO-4217 currency e.g. "usd"

420 

421 - `Optional<Double> value`

422 

423 The numeric value of the cost.

424 

425 - `Optional<String> apiKeyId`

426 

427 When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result.

428 

429 - `Optional<String> lineItem`

430 

431 When `group_by=line_item`, this field provides the line item of the grouped costs result.

432 

433 - `Optional<String> projectId`

434 

435 When `group_by=project_id`, this field provides the project ID of the grouped costs result.

436 

437 - `Optional<Double> quantity`

438 

439 When `group_by=line_item`, this field provides the quantity of the grouped costs result.

440 

441 - `long startTime`

442 

443 - `boolean hasMore`

444 

445 - `Optional<String> nextPage`

446 

447 - `JsonValue; object_ "page"constant`

448 

449 - `PAGE("page")`

450 

451### Example

452 

453```java

454package com.openai.example;

455 

456import com.openai.client.OpenAIClient;

457import com.openai.client.okhttp.OpenAIOkHttpClient;

458import com.openai.models.admin.organization.usage.UsageFileSearchCallsParams;

459import com.openai.models.admin.organization.usage.UsageFileSearchCallsResponse;

460 

461public final class Main {

462 private Main() {}

463 

464 public static void main(String[] args) {

465 OpenAIClient client = OpenAIOkHttpClient.fromEnv();

466 

467 UsageFileSearchCallsParams params = UsageFileSearchCallsParams.builder()

468 .startTime(0L)

469 .build();

470 UsageFileSearchCallsResponse response = client.admin().organization().usage().fileSearchCalls(params);

471 }

472}

473```

474 

475#### Response

476 

477```json

478{

479 "data": [

480 {

481 "end_time": 0,

482 "object": "bucket",

483 "results": [

484 {

485 "input_tokens": 0,

486 "num_model_requests": 0,

487 "object": "organization.usage.completions.result",

488 "output_tokens": 0,

489 "api_key_id": "api_key_id",

490 "batch": true,

491 "input_audio_tokens": 0,

492 "input_cached_tokens": 0,

493 "model": "model",

494 "output_audio_tokens": 0,

495 "project_id": "project_id",

496 "service_tier": "service_tier",

497 "user_id": "user_id"

498 }

499 ],

500 "start_time": 0

501 }

502 ],

503 "has_more": true,

504 "next_page": "next_page",

505 "object": "page"

506}

507```

Details

366 366 

367 When `group_by=project_id`, this field provides the project ID of the grouped usage result.367 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

368 368 

369 - `class OrganizationUsageFileSearchesResult:`

370 

371 The aggregated file search calls usage details of the specific time bucket.

372 

373 - `long numRequests`

374 

375 The count of file search calls.

376 

377 - `JsonValue; object_ "organization.usage.file_searches.result"constant`

378 

379 - `ORGANIZATION_USAGE_FILE_SEARCHES_RESULT("organization.usage.file_searches.result")`

380 

381 - `Optional<String> apiKeyId`

382 

383 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

384 

385 - `Optional<String> projectId`

386 

387 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

388 

389 - `Optional<String> userId`

390 

391 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

392 

393 - `Optional<String> vectorStoreId`

394 

395 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

396 

397 - `class OrganizationUsageWebSearchesResult:`

398 

399 The aggregated web search calls usage details of the specific time bucket.

400 

401 - `long numModelRequests`

402 

403 The count of model requests.

404 

405 - `long numRequests`

406 

407 The count of web search calls.

408 

409 - `JsonValue; object_ "organization.usage.web_searches.result"constant`

410 

411 - `ORGANIZATION_USAGE_WEB_SEARCHES_RESULT("organization.usage.web_searches.result")`

412 

413 - `Optional<String> apiKeyId`

414 

415 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

416 

417 - `Optional<String> contextLevel`

418 

419 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

420 

421 - `Optional<String> model`

422 

423 When `group_by=model`, this field provides the model name of the grouped usage result.

424 

425 - `Optional<String> projectId`

426 

427 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

428 

429 - `Optional<String> userId`

430 

431 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

432 

369 - `class OrganizationCostsResult:`433 - `class OrganizationCostsResult:`

370 434 

371 The aggregated costs details of the specific time bucket.435 The aggregated costs details of the specific time bucket.

Details

338 338 

339 When `group_by=project_id`, this field provides the project ID of the grouped usage result.339 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

340 340 

341 - `class OrganizationUsageFileSearchesResult:`

342 

343 The aggregated file search calls usage details of the specific time bucket.

344 

345 - `long numRequests`

346 

347 The count of file search calls.

348 

349 - `JsonValue; object_ "organization.usage.file_searches.result"constant`

350 

351 - `ORGANIZATION_USAGE_FILE_SEARCHES_RESULT("organization.usage.file_searches.result")`

352 

353 - `Optional<String> apiKeyId`

354 

355 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

356 

357 - `Optional<String> projectId`

358 

359 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

360 

361 - `Optional<String> userId`

362 

363 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

364 

365 - `Optional<String> vectorStoreId`

366 

367 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

368 

369 - `class OrganizationUsageWebSearchesResult:`

370 

371 The aggregated web search calls usage details of the specific time bucket.

372 

373 - `long numModelRequests`

374 

375 The count of model requests.

376 

377 - `long numRequests`

378 

379 The count of web search calls.

380 

381 - `JsonValue; object_ "organization.usage.web_searches.result"constant`

382 

383 - `ORGANIZATION_USAGE_WEB_SEARCHES_RESULT("organization.usage.web_searches.result")`

384 

385 - `Optional<String> apiKeyId`

386 

387 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

388 

389 - `Optional<String> contextLevel`

390 

391 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

392 

393 - `Optional<String> model`

394 

395 When `group_by=model`, this field provides the model name of the grouped usage result.

396 

397 - `Optional<String> projectId`

398 

399 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

400 

401 - `Optional<String> userId`

402 

403 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

404 

341 - `class OrganizationCostsResult:`405 - `class OrganizationCostsResult:`

342 406 

343 The aggregated costs details of the specific time bucket.407 The aggregated costs details of the specific time bucket.

Details

320 320 

321 When `group_by=project_id`, this field provides the project ID of the grouped usage result.321 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

322 322 

323 - `class OrganizationUsageFileSearchesResult:`

324 

325 The aggregated file search calls usage details of the specific time bucket.

326 

327 - `long numRequests`

328 

329 The count of file search calls.

330 

331 - `JsonValue; object_ "organization.usage.file_searches.result"constant`

332 

333 - `ORGANIZATION_USAGE_FILE_SEARCHES_RESULT("organization.usage.file_searches.result")`

334 

335 - `Optional<String> apiKeyId`

336 

337 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

338 

339 - `Optional<String> projectId`

340 

341 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

342 

343 - `Optional<String> userId`

344 

345 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

346 

347 - `Optional<String> vectorStoreId`

348 

349 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

350 

351 - `class OrganizationUsageWebSearchesResult:`

352 

353 The aggregated web search calls usage details of the specific time bucket.

354 

355 - `long numModelRequests`

356 

357 The count of model requests.

358 

359 - `long numRequests`

360 

361 The count of web search calls.

362 

363 - `JsonValue; object_ "organization.usage.web_searches.result"constant`

364 

365 - `ORGANIZATION_USAGE_WEB_SEARCHES_RESULT("organization.usage.web_searches.result")`

366 

367 - `Optional<String> apiKeyId`

368 

369 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

370 

371 - `Optional<String> contextLevel`

372 

373 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

374 

375 - `Optional<String> model`

376 

377 When `group_by=model`, this field provides the model name of the grouped usage result.

378 

379 - `Optional<String> projectId`

380 

381 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

382 

383 - `Optional<String> userId`

384 

385 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

386 

323 - `class OrganizationCostsResult:`387 - `class OrganizationCostsResult:`

324 388 

325 The aggregated costs details of the specific time bucket.389 The aggregated costs details of the specific time bucket.

Details

1## Web search calls

2 

3`UsageWebSearchCallsResponse admin().organization().usage().webSearchCalls(UsageWebSearchCallsParamsparams, RequestOptionsrequestOptions = RequestOptions.none())`

4 

5**get** `/organization/usage/web_search_calls`

6 

7Get web search calls usage details for the organization.

8 

9### Parameters

10 

11- `UsageWebSearchCallsParams params`

12 

13 - `long startTime`

14 

15 Start time (Unix seconds) of the query time range, inclusive.

16 

17 - `Optional<List<String>> apiKeyIds`

18 

19 Return only usage for these API keys.

20 

21 - `Optional<BucketWidth> bucketWidth`

22 

23 Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`.

24 

25 - `_1M("1m")`

26 

27 - `_1H("1h")`

28 

29 - `_1D("1d")`

30 

31 - `Optional<List<ContextLevel>> contextLevels`

32 

33 Return only web search usage for these context levels.

34 

35 - `LOW("low")`

36 

37 - `MEDIUM("medium")`

38 

39 - `HIGH("high")`

40 

41 - `Optional<Long> endTime`

42 

43 End time (Unix seconds) of the query time range, exclusive.

44 

45 - `Optional<List<GroupBy>> groupBy`

46 

47 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.

48 

49 - `PROJECT_ID("project_id")`

50 

51 - `USER_ID("user_id")`

52 

53 - `API_KEY_ID("api_key_id")`

54 

55 - `MODEL("model")`

56 

57 - `CONTEXT_LEVEL("context_level")`

58 

59 - `Optional<Long> limit`

60 

61 Specifies the number of buckets to return.

62 

63 - `bucket_width=1d`: default: 7, max: 31

64 - `bucket_width=1h`: default: 24, max: 168

65 - `bucket_width=1m`: default: 60, max: 1440

66 

67 - `Optional<List<String>> models`

68 

69 Return only usage for these models.

70 

71 - `Optional<String> page`

72 

73 A cursor for use in pagination. Corresponding to the `next_page` field from the previous response.

74 

75 - `Optional<List<String>> projectIds`

76 

77 Return only usage for these projects.

78 

79 - `Optional<List<String>> userIds`

80 

81 Return only usage for these users.

82 

83### Returns

84 

85- `class UsageWebSearchCallsResponse:`

86 

87 - `List<Data> data`

88 

89 - `long endTime`

90 

91 - `JsonValue; object_ "bucket"constant`

92 

93 - `BUCKET("bucket")`

94 

95 - `List<Result> results`

96 

97 - `class OrganizationUsageCompletionsResult:`

98 

99 The aggregated completions usage details of the specific time bucket.

100 

101 - `long inputTokens`

102 

103 The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.

104 

105 - `long numModelRequests`

106 

107 The count of requests made to the model.

108 

109 - `JsonValue; object_ "organization.usage.completions.result"constant`

110 

111 - `ORGANIZATION_USAGE_COMPLETIONS_RESULT("organization.usage.completions.result")`

112 

113 - `long outputTokens`

114 

115 The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.

116 

117 - `Optional<String> apiKeyId`

118 

119 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

120 

121 - `Optional<Boolean> batch`

122 

123 When `group_by=batch`, this field tells whether the grouped usage result is batch or not.

124 

125 - `Optional<Long> inputAudioTokens`

126 

127 The aggregated number of audio input tokens used, including cached tokens.

128 

129 - `Optional<Long> inputCachedTokens`

130 

131 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.

132 

133 - `Optional<String> model`

134 

135 When `group_by=model`, this field provides the model name of the grouped usage result.

136 

137 - `Optional<Long> outputAudioTokens`

138 

139 The aggregated number of audio output tokens used.

140 

141 - `Optional<String> projectId`

142 

143 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

144 

145 - `Optional<String> serviceTier`

146 

147 When `group_by=service_tier`, this field provides the service tier of the grouped usage result.

148 

149 - `Optional<String> userId`

150 

151 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

152 

153 - `class OrganizationUsageEmbeddingsResult:`

154 

155 The aggregated embeddings usage details of the specific time bucket.

156 

157 - `long inputTokens`

158 

159 The aggregated number of input tokens used.

160 

161 - `long numModelRequests`

162 

163 The count of requests made to the model.

164 

165 - `JsonValue; object_ "organization.usage.embeddings.result"constant`

166 

167 - `ORGANIZATION_USAGE_EMBEDDINGS_RESULT("organization.usage.embeddings.result")`

168 

169 - `Optional<String> apiKeyId`

170 

171 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

172 

173 - `Optional<String> model`

174 

175 When `group_by=model`, this field provides the model name of the grouped usage result.

176 

177 - `Optional<String> projectId`

178 

179 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

180 

181 - `Optional<String> userId`

182 

183 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

184 

185 - `class OrganizationUsageModerationsResult:`

186 

187 The aggregated moderations usage details of the specific time bucket.

188 

189 - `long inputTokens`

190 

191 The aggregated number of input tokens used.

192 

193 - `long numModelRequests`

194 

195 The count of requests made to the model.

196 

197 - `JsonValue; object_ "organization.usage.moderations.result"constant`

198 

199 - `ORGANIZATION_USAGE_MODERATIONS_RESULT("organization.usage.moderations.result")`

200 

201 - `Optional<String> apiKeyId`

202 

203 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

204 

205 - `Optional<String> model`

206 

207 When `group_by=model`, this field provides the model name of the grouped usage result.

208 

209 - `Optional<String> projectId`

210 

211 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

212 

213 - `Optional<String> userId`

214 

215 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

216 

217 - `class OrganizationUsageImagesResult:`

218 

219 The aggregated images usage details of the specific time bucket.

220 

221 - `long images`

222 

223 The number of images processed.

224 

225 - `long numModelRequests`

226 

227 The count of requests made to the model.

228 

229 - `JsonValue; object_ "organization.usage.images.result"constant`

230 

231 - `ORGANIZATION_USAGE_IMAGES_RESULT("organization.usage.images.result")`

232 

233 - `Optional<String> apiKeyId`

234 

235 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

236 

237 - `Optional<String> model`

238 

239 When `group_by=model`, this field provides the model name of the grouped usage result.

240 

241 - `Optional<String> projectId`

242 

243 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

244 

245 - `Optional<String> size`

246 

247 When `group_by=size`, this field provides the image size of the grouped usage result.

248 

249 - `Optional<String> source`

250 

251 When `group_by=source`, this field provides the source of the grouped usage result, possible values are `image.generation`, `image.edit`, `image.variation`.

252 

253 - `Optional<String> userId`

254 

255 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

256 

257 - `class OrganizationUsageAudioSpeechesResult:`

258 

259 The aggregated audio speeches usage details of the specific time bucket.

260 

261 - `long characters`

262 

263 The number of characters processed.

264 

265 - `long numModelRequests`

266 

267 The count of requests made to the model.

268 

269 - `JsonValue; object_ "organization.usage.audio_speeches.result"constant`

270 

271 - `ORGANIZATION_USAGE_AUDIO_SPEECHES_RESULT("organization.usage.audio_speeches.result")`

272 

273 - `Optional<String> apiKeyId`

274 

275 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

276 

277 - `Optional<String> model`

278 

279 When `group_by=model`, this field provides the model name of the grouped usage result.

280 

281 - `Optional<String> projectId`

282 

283 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

284 

285 - `Optional<String> userId`

286 

287 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

288 

289 - `class OrganizationUsageAudioTranscriptionsResult:`

290 

291 The aggregated audio transcriptions usage details of the specific time bucket.

292 

293 - `long numModelRequests`

294 

295 The count of requests made to the model.

296 

297 - `JsonValue; object_ "organization.usage.audio_transcriptions.result"constant`

298 

299 - `ORGANIZATION_USAGE_AUDIO_TRANSCRIPTIONS_RESULT("organization.usage.audio_transcriptions.result")`

300 

301 - `long seconds`

302 

303 The number of seconds processed.

304 

305 - `Optional<String> apiKeyId`

306 

307 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

308 

309 - `Optional<String> model`

310 

311 When `group_by=model`, this field provides the model name of the grouped usage result.

312 

313 - `Optional<String> projectId`

314 

315 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

316 

317 - `Optional<String> userId`

318 

319 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

320 

321 - `class OrganizationUsageVectorStoresResult:`

322 

323 The aggregated vector stores usage details of the specific time bucket.

324 

325 - `JsonValue; object_ "organization.usage.vector_stores.result"constant`

326 

327 - `ORGANIZATION_USAGE_VECTOR_STORES_RESULT("organization.usage.vector_stores.result")`

328 

329 - `long usageBytes`

330 

331 The vector stores usage in bytes.

332 

333 - `Optional<String> projectId`

334 

335 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

336 

337 - `class OrganizationUsageCodeInterpreterSessionsResult:`

338 

339 The aggregated code interpreter sessions usage details of the specific time bucket.

340 

341 - `long numSessions`

342 

343 The number of code interpreter sessions.

344 

345 - `JsonValue; object_ "organization.usage.code_interpreter_sessions.result"constant`

346 

347 - `ORGANIZATION_USAGE_CODE_INTERPRETER_SESSIONS_RESULT("organization.usage.code_interpreter_sessions.result")`

348 

349 - `Optional<String> projectId`

350 

351 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

352 

353 - `class OrganizationUsageFileSearchesResult:`

354 

355 The aggregated file search calls usage details of the specific time bucket.

356 

357 - `long numRequests`

358 

359 The count of file search calls.

360 

361 - `JsonValue; object_ "organization.usage.file_searches.result"constant`

362 

363 - `ORGANIZATION_USAGE_FILE_SEARCHES_RESULT("organization.usage.file_searches.result")`

364 

365 - `Optional<String> apiKeyId`

366 

367 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

368 

369 - `Optional<String> projectId`

370 

371 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

372 

373 - `Optional<String> userId`

374 

375 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

376 

377 - `Optional<String> vectorStoreId`

378 

379 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

380 

381 - `class OrganizationUsageWebSearchesResult:`

382 

383 The aggregated web search calls usage details of the specific time bucket.

384 

385 - `long numModelRequests`

386 

387 The count of model requests.

388 

389 - `long numRequests`

390 

391 The count of web search calls.

392 

393 - `JsonValue; object_ "organization.usage.web_searches.result"constant`

394 

395 - `ORGANIZATION_USAGE_WEB_SEARCHES_RESULT("organization.usage.web_searches.result")`

396 

397 - `Optional<String> apiKeyId`

398 

399 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

400 

401 - `Optional<String> contextLevel`

402 

403 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

404 

405 - `Optional<String> model`

406 

407 When `group_by=model`, this field provides the model name of the grouped usage result.

408 

409 - `Optional<String> projectId`

410 

411 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

412 

413 - `Optional<String> userId`

414 

415 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

416 

417 - `class OrganizationCostsResult:`

418 

419 The aggregated costs details of the specific time bucket.

420 

421 - `JsonValue; object_ "organization.costs.result"constant`

422 

423 - `ORGANIZATION_COSTS_RESULT("organization.costs.result")`

424 

425 - `Optional<Amount> amount`

426 

427 The monetary value in its associated currency.

428 

429 - `Optional<String> currency`

430 

431 Lowercase ISO-4217 currency e.g. "usd"

432 

433 - `Optional<Double> value`

434 

435 The numeric value of the cost.

436 

437 - `Optional<String> apiKeyId`

438 

439 When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result.

440 

441 - `Optional<String> lineItem`

442 

443 When `group_by=line_item`, this field provides the line item of the grouped costs result.

444 

445 - `Optional<String> projectId`

446 

447 When `group_by=project_id`, this field provides the project ID of the grouped costs result.

448 

449 - `Optional<Double> quantity`

450 

451 When `group_by=line_item`, this field provides the quantity of the grouped costs result.

452 

453 - `long startTime`

454 

455 - `boolean hasMore`

456 

457 - `Optional<String> nextPage`

458 

459 - `JsonValue; object_ "page"constant`

460 

461 - `PAGE("page")`

462 

463### Example

464 

465```java

466package com.openai.example;

467 

468import com.openai.client.OpenAIClient;

469import com.openai.client.okhttp.OpenAIOkHttpClient;

470import com.openai.models.admin.organization.usage.UsageWebSearchCallsParams;

471import com.openai.models.admin.organization.usage.UsageWebSearchCallsResponse;

472 

473public final class Main {

474 private Main() {}

475 

476 public static void main(String[] args) {

477 OpenAIClient client = OpenAIOkHttpClient.fromEnv();

478 

479 UsageWebSearchCallsParams params = UsageWebSearchCallsParams.builder()

480 .startTime(0L)

481 .build();

482 UsageWebSearchCallsResponse response = client.admin().organization().usage().webSearchCalls(params);

483 }

484}

485```

486 

487#### Response

488 

489```json

490{

491 "data": [

492 {

493 "end_time": 0,

494 "object": "bucket",

495 "results": [

496 {

497 "input_tokens": 0,

498 "num_model_requests": 0,

499 "object": "organization.usage.completions.result",

500 "output_tokens": 0,

501 "api_key_id": "api_key_id",

502 "batch": true,

503 "input_audio_tokens": 0,

504 "input_cached_tokens": 0,

505 "model": "model",

506 "output_audio_tokens": 0,

507 "project_id": "project_id",

508 "service_tier": "service_tier",

509 "user_id": "user_id"

510 }

511 ],

512 "start_time": 0

513 }

514 ],

515 "has_more": true,

516 "next_page": "next_page",

517 "object": "page"

518}

519```

Details

2870 2870 

2871 The namespace of the custom tool being called.2871 The namespace of the custom tool being called.

2872 2872 

2873 - `JsonValue;`

2874 

2875 - `JsonValue; type "compaction_trigger"constant`

2876 

2877 The type of the item. Always `compaction_trigger`.

2878 

2879 - `COMPACTION_TRIGGER("compaction_trigger")`

2880 

2873 - `ItemReference`2881 - `ItemReference`

2874 2882 

2875 - `String id`2883 - `String id`

Details

2893 2893 

2894 The namespace of the custom tool being called.2894 The namespace of the custom tool being called.

2895 2895 

2896 - `JsonValue;`

2897 

2898 - `JsonValue; type "compaction_trigger"constant`

2899 

2900 The type of the item. Always `compaction_trigger`.

2901 

2902 - `COMPACTION_TRIGGER("compaction_trigger")`

2903 

2896 - `ItemReference`2904 - `ItemReference`

2897 2905 

2898 - `String id`2906 - `String id`

Details

2954 2954 

2955 The namespace of the custom tool being called.2955 The namespace of the custom tool being called.

2956 2956 

2957 - `JsonValue;`

2958 

2959 - `JsonValue; type "compaction_trigger"constant`

2960 

2961 The type of the item. Always `compaction_trigger`.

2962 

2963 - `COMPACTION_TRIGGER("compaction_trigger")`

2964 

2957 - `ItemReference`2965 - `ItemReference`

2958 2966 

2959 - `String id`2967 - `String id`

Details

3064 3064 

3065 The namespace of the custom tool being called.3065 The namespace of the custom tool being called.

3066 3066 

3067 - `JsonValue;`

3068 

3069 - `JsonValue; type "compaction_trigger"constant`

3070 

3071 The type of the item. Always `compaction_trigger`.

3072 

3073 - `COMPACTION_TRIGGER("compaction_trigger")`

3074 

3067 - `ItemReference`3075 - `ItemReference`

3068 3076 

3069 - `String id`3077 - `String id`

Details

2948 2948 

2949 The namespace of the custom tool being called.2949 The namespace of the custom tool being called.

2950 2950 

2951 - `JsonValue;`

2952 

2953 - `JsonValue; type "compaction_trigger"constant`

2954 

2955 The type of the item. Always `compaction_trigger`.

2956 

2957 - `COMPACTION_TRIGGER("compaction_trigger")`

2958 

2951 - `ItemReference`2959 - `ItemReference`

2952 2960 

2953 - `String id`2961 - `String id`


6295 6303 

6296 The namespace of the custom tool being called.6304 The namespace of the custom tool being called.

6297 6305 

6306 - `JsonValue;`

6307 

6308 - `JsonValue; type "compaction_trigger"constant`

6309 

6310 The type of the item. Always `compaction_trigger`.

6311 

6312 - `COMPACTION_TRIGGER("compaction_trigger")`

6313 

6298 - `ItemReference`6314 - `ItemReference`

6299 6315 

6300 - `String id`6316 - `String id`

Details

2987 2987 

2988 The namespace of the custom tool being called.2988 The namespace of the custom tool being called.

2989 2989 

2990 - `JsonValue;`

2991 

2992 - `JsonValue; type "compaction_trigger"constant`

2993 

2994 The type of the item. Always `compaction_trigger`.

2995 

2996 - `COMPACTION_TRIGGER("compaction_trigger")`

2997 

2990 - `ItemReference`2998 - `ItemReference`

2991 2999 

2992 - `String id`3000 - `String id`

Details

2891 2891 

2892 The namespace of the custom tool being called.2892 The namespace of the custom tool being called.

2893 2893 

2894 - `JsonValue;`

2895 

2896 - `JsonValue; type "compaction_trigger"constant`

2897 

2898 The type of the item. Always `compaction_trigger`.

2899 

2900 - `COMPACTION_TRIGGER("compaction_trigger")`

2901 

2894 - `ItemReference`2902 - `ItemReference`

2895 2903 

2896 - `String id`2904 - `String id`

Details

22 22 

23- `projects: Optional[Iterable[Project]]`23- `projects: Optional[Iterable[Project]]`

24 24 

25 An array of projects to which membership is granted at the same time the org invite is accepted. If omitted, the user will be invited to the default project for compatibility with legacy behavior.25 An array of projects to which membership is granted at the same time the org invite is accepted. If omitted, the user will be invited to the default project for compatibility with legacy behavior. If empty list is passed, the user will not be invited to any projects, including the default one.

26 26 

27 - `id: str`27 - `id: str`

28 28 

Details

1## Retrieve project hosted tool permissions

2 

3`admin.organization.projects.hosted_tool_permissions.retrieve(strproject_id) -> ProjectHostedToolPermissions`

4 

5**get** `/organization/projects/{project_id}/hosted_tool_permissions`

6 

7Returns hosted tool permissions for a project.

8 

9### Parameters

10 

11- `project_id: str`

12 

13### Returns

14 

15- `class ProjectHostedToolPermissions: …`

16 

17 Represents hosted tool permissions for a project.

18 

19 - `code_interpreter: CodeInterpreter`

20 

21 Permission state for a single hosted tool on a project.

22 

23 - `enabled: bool`

24 

25 Whether the hosted tool is enabled for the project.

26 

27 - `file_search: FileSearch`

28 

29 Permission state for a single hosted tool on a project.

30 

31 - `enabled: bool`

32 

33 Whether the hosted tool is enabled for the project.

34 

35 - `image_generation: ImageGeneration`

36 

37 Permission state for a single hosted tool on a project.

38 

39 - `enabled: bool`

40 

41 Whether the hosted tool is enabled for the project.

42 

43 - `mcp: Mcp`

44 

45 Permission state for a single hosted tool on a project.

46 

47 - `enabled: bool`

48 

49 Whether the hosted tool is enabled for the project.

50 

51 - `web_search: WebSearch`

52 

53 Permission state for a single hosted tool on a project.

54 

55 - `enabled: bool`

56 

57 Whether the hosted tool is enabled for the project.

58 

59### Example

60 

61```python

62import os

63from openai import OpenAI

64 

65client = OpenAI(

66 admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted

67)

68project_hosted_tool_permissions = client.admin.organization.projects.hosted_tool_permissions.retrieve(

69 "project_id",

70)

71print(project_hosted_tool_permissions.code_interpreter)

72```

73 

74#### Response

75 

76```json

77{

78 "code_interpreter": {

79 "enabled": true

80 },

81 "file_search": {

82 "enabled": true

83 },

84 "image_generation": {

85 "enabled": true

86 },

87 "mcp": {

88 "enabled": true

89 },

90 "web_search": {

91 "enabled": true

92 }

93}

94```

Details

1## Modify project hosted tool permissions

2 

3`admin.organization.projects.hosted_tool_permissions.update(strproject_id, HostedToolPermissionUpdateParams**kwargs) -> ProjectHostedToolPermissions`

4 

5**post** `/organization/projects/{project_id}/hosted_tool_permissions`

6 

7Updates hosted tool permissions for a project.

8 

9### Parameters

10 

11- `project_id: str`

12 

13- `code_interpreter: Optional[CodeInterpreter]`

14 

15 The code interpreter permission update.

16 

17 - `enabled: bool`

18 

19 Whether to enable the hosted tool for the project.

20 

21- `file_search: Optional[FileSearch]`

22 

23 The file search permission update.

24 

25 - `enabled: bool`

26 

27 Whether to enable the hosted tool for the project.

28 

29- `image_generation: Optional[ImageGeneration]`

30 

31 The image generation permission update.

32 

33 - `enabled: bool`

34 

35 Whether to enable the hosted tool for the project.

36 

37- `mcp: Optional[Mcp]`

38 

39 The MCP permission update.

40 

41 - `enabled: bool`

42 

43 Whether to enable the hosted tool for the project.

44 

45- `web_search: Optional[WebSearch]`

46 

47 The web search permission update.

48 

49 - `enabled: bool`

50 

51 Whether to enable the hosted tool for the project.

52 

53### Returns

54 

55- `class ProjectHostedToolPermissions: …`

56 

57 Represents hosted tool permissions for a project.

58 

59 - `code_interpreter: CodeInterpreter`

60 

61 Permission state for a single hosted tool on a project.

62 

63 - `enabled: bool`

64 

65 Whether the hosted tool is enabled for the project.

66 

67 - `file_search: FileSearch`

68 

69 Permission state for a single hosted tool on a project.

70 

71 - `enabled: bool`

72 

73 Whether the hosted tool is enabled for the project.

74 

75 - `image_generation: ImageGeneration`

76 

77 Permission state for a single hosted tool on a project.

78 

79 - `enabled: bool`

80 

81 Whether the hosted tool is enabled for the project.

82 

83 - `mcp: Mcp`

84 

85 Permission state for a single hosted tool on a project.

86 

87 - `enabled: bool`

88 

89 Whether the hosted tool is enabled for the project.

90 

91 - `web_search: WebSearch`

92 

93 Permission state for a single hosted tool on a project.

94 

95 - `enabled: bool`

96 

97 Whether the hosted tool is enabled for the project.

98 

99### Example

100 

101```python

102import os

103from openai import OpenAI

104 

105client = OpenAI(

106 admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted

107)

108project_hosted_tool_permissions = client.admin.organization.projects.hosted_tool_permissions.update(

109 project_id="project_id",

110)

111print(project_hosted_tool_permissions.code_interpreter)

112```

113 

114#### Response

115 

116```json

117{

118 "code_interpreter": {

119 "enabled": true

120 },

121 "file_search": {

122 "enabled": true

123 },

124 "image_generation": {

125 "enabled": true

126 },

127 "mcp": {

128 "enabled": true

129 },

130 "web_search": {

131 "enabled": true

132 }

133}

134```

Details

1## Delete project model permissions

2 

3`admin.organization.projects.model_permissions.delete(strproject_id) -> ProjectModelPermissionsDeleted`

4 

5**delete** `/organization/projects/{project_id}/model_permissions`

6 

7Deletes model permissions for a project.

8 

9### Parameters

10 

11- `project_id: str`

12 

13### Returns

14 

15- `class ProjectModelPermissionsDeleted: …`

16 

17 Confirmation payload returned after deleting project model permissions.

18 

19 - `deleted: bool`

20 

21 Whether the project model permissions were deleted.

22 

23 - `object: Literal["project.model_permissions.deleted"]`

24 

25 The object type, which is always `project.model_permissions.deleted`.

26 

27 - `"project.model_permissions.deleted"`

28 

29### Example

30 

31```python

32import os

33from openai import OpenAI

34 

35client = OpenAI(

36 admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted

37)

38project_model_permissions_deleted = client.admin.organization.projects.model_permissions.delete(

39 "project_id",

40)

41print(project_model_permissions_deleted.deleted)

42```

43 

44#### Response

45 

46```json

47{

48 "deleted": true,

49 "object": "project.model_permissions.deleted"

50}

51```

Details

1## Retrieve project model permissions

2 

3`admin.organization.projects.model_permissions.retrieve(strproject_id) -> ProjectModelPermissions`

4 

5**get** `/organization/projects/{project_id}/model_permissions`

6 

7Returns model permissions for a project.

8 

9### Parameters

10 

11- `project_id: str`

12 

13### Returns

14 

15- `class ProjectModelPermissions: …`

16 

17 Represents the model allowlist or denylist policy for a project.

18 

19 - `mode: Literal["allow_list", "deny_list"]`

20 

21 Whether the project uses an allowlist or a denylist.

22 

23 - `"allow_list"`

24 

25 - `"deny_list"`

26 

27 - `model_ids: List[str]`

28 

29 The model IDs included in the model permissions policy.

30 

31 - `object: Literal["project.model_permissions"]`

32 

33 The object type, which is always `project.model_permissions`.

34 

35 - `"project.model_permissions"`

36 

37### Example

38 

39```python

40import os

41from openai import OpenAI

42 

43client = OpenAI(

44 admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted

45)

46project_model_permissions = client.admin.organization.projects.model_permissions.retrieve(

47 "project_id",

48)

49print(project_model_permissions.model_ids)

50```

51 

52#### Response

53 

54```json

55{

56 "mode": "allow_list",

57 "model_ids": [

58 "string"

59 ],

60 "object": "project.model_permissions"

61}

62```

Details

1## Modify project model permissions

2 

3`admin.organization.projects.model_permissions.update(strproject_id, ModelPermissionUpdateParams**kwargs) -> ProjectModelPermissions`

4 

5**post** `/organization/projects/{project_id}/model_permissions`

6 

7Updates model permissions for a project.

8 

9### Parameters

10 

11- `project_id: str`

12 

13- `mode: Literal["allow_list", "deny_list"]`

14 

15 The model permissions mode to apply.

16 

17 - `"allow_list"`

18 

19 - `"deny_list"`

20 

21- `model_ids: Sequence[str]`

22 

23 The model IDs included in this permissions policy.

24 

25### Returns

26 

27- `class ProjectModelPermissions: …`

28 

29 Represents the model allowlist or denylist policy for a project.

30 

31 - `mode: Literal["allow_list", "deny_list"]`

32 

33 Whether the project uses an allowlist or a denylist.

34 

35 - `"allow_list"`

36 

37 - `"deny_list"`

38 

39 - `model_ids: List[str]`

40 

41 The model IDs included in the model permissions policy.

42 

43 - `object: Literal["project.model_permissions"]`

44 

45 The object type, which is always `project.model_permissions`.

46 

47 - `"project.model_permissions"`

48 

49### Example

50 

51```python

52import os

53from openai import OpenAI

54 

55client = OpenAI(

56 admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted

57)

58project_model_permissions = client.admin.organization.projects.model_permissions.update(

59 project_id="project_id",

60 mode="allow_list",

61 model_ids=["string"],

62)

63print(project_model_permissions.model_ids)

64```

65 

66#### Response

67 

68```json

69{

70 "mode": "allow_list",

71 "model_ids": [

72 "string"

73 ],

74 "object": "project.model_permissions"

75}

76```

Details

336 336 

337 When `group_by=project_id`, this field provides the project ID of the grouped usage result.337 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

338 338 

339 - `class DataResultOrganizationUsageFileSearchesResult: …`

340 

341 The aggregated file search calls usage details of the specific time bucket.

342 

343 - `num_requests: int`

344 

345 The count of file search calls.

346 

347 - `object: Literal["organization.usage.file_searches.result"]`

348 

349 - `"organization.usage.file_searches.result"`

350 

351 - `api_key_id: Optional[str]`

352 

353 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

354 

355 - `project_id: Optional[str]`

356 

357 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

358 

359 - `user_id: Optional[str]`

360 

361 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

362 

363 - `vector_store_id: Optional[str]`

364 

365 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

366 

367 - `class DataResultOrganizationUsageWebSearchesResult: …`

368 

369 The aggregated web search calls usage details of the specific time bucket.

370 

371 - `num_model_requests: int`

372 

373 The count of model requests.

374 

375 - `num_requests: int`

376 

377 The count of web search calls.

378 

379 - `object: Literal["organization.usage.web_searches.result"]`

380 

381 - `"organization.usage.web_searches.result"`

382 

383 - `api_key_id: Optional[str]`

384 

385 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

386 

387 - `context_level: Optional[str]`

388 

389 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

390 

391 - `model: Optional[str]`

392 

393 When `group_by=model`, this field provides the model name of the grouped usage result.

394 

395 - `project_id: Optional[str]`

396 

397 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

398 

399 - `user_id: Optional[str]`

400 

401 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

402 

339 - `class DataResultOrganizationCostsResult: …`403 - `class DataResultOrganizationCostsResult: …`

340 404 

341 The aggregated costs details of the specific time bucket.405 The aggregated costs details of the specific time bucket.

Details

336 336 

337 When `group_by=project_id`, this field provides the project ID of the grouped usage result.337 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

338 338 

339 - `class DataResultOrganizationUsageFileSearchesResult: …`

340 

341 The aggregated file search calls usage details of the specific time bucket.

342 

343 - `num_requests: int`

344 

345 The count of file search calls.

346 

347 - `object: Literal["organization.usage.file_searches.result"]`

348 

349 - `"organization.usage.file_searches.result"`

350 

351 - `api_key_id: Optional[str]`

352 

353 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

354 

355 - `project_id: Optional[str]`

356 

357 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

358 

359 - `user_id: Optional[str]`

360 

361 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

362 

363 - `vector_store_id: Optional[str]`

364 

365 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

366 

367 - `class DataResultOrganizationUsageWebSearchesResult: …`

368 

369 The aggregated web search calls usage details of the specific time bucket.

370 

371 - `num_model_requests: int`

372 

373 The count of model requests.

374 

375 - `num_requests: int`

376 

377 The count of web search calls.

378 

379 - `object: Literal["organization.usage.web_searches.result"]`

380 

381 - `"organization.usage.web_searches.result"`

382 

383 - `api_key_id: Optional[str]`

384 

385 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

386 

387 - `context_level: Optional[str]`

388 

389 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

390 

391 - `model: Optional[str]`

392 

393 When `group_by=model`, this field provides the model name of the grouped usage result.

394 

395 - `project_id: Optional[str]`

396 

397 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

398 

399 - `user_id: Optional[str]`

400 

401 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

402 

339 - `class DataResultOrganizationCostsResult: …`403 - `class DataResultOrganizationCostsResult: …`

340 404 

341 The aggregated costs details of the specific time bucket.405 The aggregated costs details of the specific time bucket.

Details

318 318 

319 When `group_by=project_id`, this field provides the project ID of the grouped usage result.319 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

320 320 

321 - `class DataResultOrganizationUsageFileSearchesResult: …`

322 

323 The aggregated file search calls usage details of the specific time bucket.

324 

325 - `num_requests: int`

326 

327 The count of file search calls.

328 

329 - `object: Literal["organization.usage.file_searches.result"]`

330 

331 - `"organization.usage.file_searches.result"`

332 

333 - `api_key_id: Optional[str]`

334 

335 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

336 

337 - `project_id: Optional[str]`

338 

339 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

340 

341 - `user_id: Optional[str]`

342 

343 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

344 

345 - `vector_store_id: Optional[str]`

346 

347 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

348 

349 - `class DataResultOrganizationUsageWebSearchesResult: …`

350 

351 The aggregated web search calls usage details of the specific time bucket.

352 

353 - `num_model_requests: int`

354 

355 The count of model requests.

356 

357 - `num_requests: int`

358 

359 The count of web search calls.

360 

361 - `object: Literal["organization.usage.web_searches.result"]`

362 

363 - `"organization.usage.web_searches.result"`

364 

365 - `api_key_id: Optional[str]`

366 

367 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

368 

369 - `context_level: Optional[str]`

370 

371 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

372 

373 - `model: Optional[str]`

374 

375 When `group_by=model`, this field provides the model name of the grouped usage result.

376 

377 - `project_id: Optional[str]`

378 

379 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

380 

381 - `user_id: Optional[str]`

382 

383 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

384 

321 - `class DataResultOrganizationCostsResult: …`385 - `class DataResultOrganizationCostsResult: …`

322 386 

323 The aggregated costs details of the specific time bucket.387 The aggregated costs details of the specific time bucket.

Details

344 344 

345 When `group_by=project_id`, this field provides the project ID of the grouped usage result.345 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

346 346 

347 - `class DataResultOrganizationUsageFileSearchesResult: …`

348 

349 The aggregated file search calls usage details of the specific time bucket.

350 

351 - `num_requests: int`

352 

353 The count of file search calls.

354 

355 - `object: Literal["organization.usage.file_searches.result"]`

356 

357 - `"organization.usage.file_searches.result"`

358 

359 - `api_key_id: Optional[str]`

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[str]`

364 

365 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

366 

367 - `user_id: Optional[str]`

368 

369 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

370 

371 - `vector_store_id: Optional[str]`

372 

373 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

374 

375 - `class DataResultOrganizationUsageWebSearchesResult: …`

376 

377 The aggregated web search calls usage details of the specific time bucket.

378 

379 - `num_model_requests: int`

380 

381 The count of model requests.

382 

383 - `num_requests: int`

384 

385 The count of web search calls.

386 

387 - `object: Literal["organization.usage.web_searches.result"]`

388 

389 - `"organization.usage.web_searches.result"`

390 

391 - `api_key_id: Optional[str]`

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[str]`

396 

397 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

398 

399 - `model: Optional[str]`

400 

401 When `group_by=model`, this field provides the model name of the grouped usage result.

402 

403 - `project_id: Optional[str]`

404 

405 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

406 

407 - `user_id: Optional[str]`

408 

409 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

410 

347 - `class DataResultOrganizationCostsResult: …`411 - `class DataResultOrganizationCostsResult: …`

348 412 

349 The aggregated costs details of the specific time bucket.413 The aggregated costs details of the specific time bucket.

Details

318 318 

319 When `group_by=project_id`, this field provides the project ID of the grouped usage result.319 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

320 320 

321 - `class DataResultOrganizationUsageFileSearchesResult: …`

322 

323 The aggregated file search calls usage details of the specific time bucket.

324 

325 - `num_requests: int`

326 

327 The count of file search calls.

328 

329 - `object: Literal["organization.usage.file_searches.result"]`

330 

331 - `"organization.usage.file_searches.result"`

332 

333 - `api_key_id: Optional[str]`

334 

335 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

336 

337 - `project_id: Optional[str]`

338 

339 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

340 

341 - `user_id: Optional[str]`

342 

343 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

344 

345 - `vector_store_id: Optional[str]`

346 

347 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

348 

349 - `class DataResultOrganizationUsageWebSearchesResult: …`

350 

351 The aggregated web search calls usage details of the specific time bucket.

352 

353 - `num_model_requests: int`

354 

355 The count of model requests.

356 

357 - `num_requests: int`

358 

359 The count of web search calls.

360 

361 - `object: Literal["organization.usage.web_searches.result"]`

362 

363 - `"organization.usage.web_searches.result"`

364 

365 - `api_key_id: Optional[str]`

366 

367 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

368 

369 - `context_level: Optional[str]`

370 

371 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

372 

373 - `model: Optional[str]`

374 

375 When `group_by=model`, this field provides the model name of the grouped usage result.

376 

377 - `project_id: Optional[str]`

378 

379 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

380 

381 - `user_id: Optional[str]`

382 

383 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

384 

321 - `class DataResultOrganizationCostsResult: …`385 - `class DataResultOrganizationCostsResult: …`

322 386 

323 The aggregated costs details of the specific time bucket.387 The aggregated costs details of the specific time bucket.

Details

336 336 

337 When `group_by=project_id`, this field provides the project ID of the grouped usage result.337 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

338 338 

339 - `class DataResultOrganizationUsageFileSearchesResult: …`

340 

341 The aggregated file search calls usage details of the specific time bucket.

342 

343 - `num_requests: int`

344 

345 The count of file search calls.

346 

347 - `object: Literal["organization.usage.file_searches.result"]`

348 

349 - `"organization.usage.file_searches.result"`

350 

351 - `api_key_id: Optional[str]`

352 

353 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

354 

355 - `project_id: Optional[str]`

356 

357 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

358 

359 - `user_id: Optional[str]`

360 

361 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

362 

363 - `vector_store_id: Optional[str]`

364 

365 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

366 

367 - `class DataResultOrganizationUsageWebSearchesResult: …`

368 

369 The aggregated web search calls usage details of the specific time bucket.

370 

371 - `num_model_requests: int`

372 

373 The count of model requests.

374 

375 - `num_requests: int`

376 

377 The count of web search calls.

378 

379 - `object: Literal["organization.usage.web_searches.result"]`

380 

381 - `"organization.usage.web_searches.result"`

382 

383 - `api_key_id: Optional[str]`

384 

385 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

386 

387 - `context_level: Optional[str]`

388 

389 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

390 

391 - `model: Optional[str]`

392 

393 When `group_by=model`, this field provides the model name of the grouped usage result.

394 

395 - `project_id: Optional[str]`

396 

397 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

398 

399 - `user_id: Optional[str]`

400 

401 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

402 

339 - `class DataResultOrganizationCostsResult: …`403 - `class DataResultOrganizationCostsResult: …`

340 404 

341 The aggregated costs details of the specific time bucket.405 The aggregated costs details of the specific time bucket.

Details

1## File search calls

2 

3`admin.organization.usage.file_search_calls(UsageFileSearchCallsParams**kwargs) -> UsageFileSearchCallsResponse`

4 

5**get** `/organization/usage/file_search_calls`

6 

7Get file search calls usage details for the organization.

8 

9### Parameters

10 

11- `start_time: int`

12 

13 Start time (Unix seconds) of the query time range, inclusive.

14 

15- `api_key_ids: Optional[Sequence[str]]`

16 

17 Return only usage for these API keys.

18 

19- `bucket_width: Optional[Literal["1m", "1h", "1d"]]`

20 

21 Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`.

22 

23 - `"1m"`

24 

25 - `"1h"`

26 

27 - `"1d"`

28 

29- `end_time: Optional[int]`

30 

31 End time (Unix seconds) of the query time range, exclusive.

32 

33- `group_by: Optional[List[Literal["project_id", "user_id", "api_key_id", "vector_store_id"]]]`

34 

35 Group the usage data by the specified fields. Support fields include `project_id`, `user_id`, `api_key_id`, `vector_store_id` or any combination of them.

36 

37 - `"project_id"`

38 

39 - `"user_id"`

40 

41 - `"api_key_id"`

42 

43 - `"vector_store_id"`

44 

45- `limit: Optional[int]`

46 

47 Specifies the number of buckets to return.

48 

49 - `bucket_width=1d`: default: 7, max: 31

50 - `bucket_width=1h`: default: 24, max: 168

51 - `bucket_width=1m`: default: 60, max: 1440

52 

53- `page: Optional[str]`

54 

55 A cursor for use in pagination. Corresponding to the `next_page` field from the previous response.

56 

57- `project_ids: Optional[Sequence[str]]`

58 

59 Return only usage for these projects.

60 

61- `user_ids: Optional[Sequence[str]]`

62 

63 Return only usage for these users.

64 

65- `vector_store_ids: Optional[Sequence[str]]`

66 

67 Return only usage for these vector stores.

68 

69### Returns

70 

71- `class UsageFileSearchCallsResponse: …`

72 

73 - `data: List[Data]`

74 

75 - `end_time: int`

76 

77 - `object: Literal["bucket"]`

78 

79 - `"bucket"`

80 

81 - `results: List[DataResult]`

82 

83 - `class DataResultOrganizationUsageCompletionsResult: …`

84 

85 The aggregated completions usage details of the specific time bucket.

86 

87 - `input_tokens: int`

88 

89 The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.

90 

91 - `num_model_requests: int`

92 

93 The count of requests made to the model.

94 

95 - `object: Literal["organization.usage.completions.result"]`

96 

97 - `"organization.usage.completions.result"`

98 

99 - `output_tokens: int`

100 

101 The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.

102 

103 - `api_key_id: Optional[str]`

104 

105 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

106 

107 - `batch: Optional[bool]`

108 

109 When `group_by=batch`, this field tells whether the grouped usage result is batch or not.

110 

111 - `input_audio_tokens: Optional[int]`

112 

113 The aggregated number of audio input tokens used, including cached tokens.

114 

115 - `input_cached_tokens: Optional[int]`

116 

117 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.

118 

119 - `model: Optional[str]`

120 

121 When `group_by=model`, this field provides the model name of the grouped usage result.

122 

123 - `output_audio_tokens: Optional[int]`

124 

125 The aggregated number of audio output tokens used.

126 

127 - `project_id: Optional[str]`

128 

129 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

130 

131 - `service_tier: Optional[str]`

132 

133 When `group_by=service_tier`, this field provides the service tier of the grouped usage result.

134 

135 - `user_id: Optional[str]`

136 

137 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

138 

139 - `class DataResultOrganizationUsageEmbeddingsResult: …`

140 

141 The aggregated embeddings usage details of the specific time bucket.

142 

143 - `input_tokens: int`

144 

145 The aggregated number of input tokens used.

146 

147 - `num_model_requests: int`

148 

149 The count of requests made to the model.

150 

151 - `object: Literal["organization.usage.embeddings.result"]`

152 

153 - `"organization.usage.embeddings.result"`

154 

155 - `api_key_id: Optional[str]`

156 

157 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

158 

159 - `model: Optional[str]`

160 

161 When `group_by=model`, this field provides the model name of the grouped usage result.

162 

163 - `project_id: Optional[str]`

164 

165 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

166 

167 - `user_id: Optional[str]`

168 

169 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

170 

171 - `class DataResultOrganizationUsageModerationsResult: …`

172 

173 The aggregated moderations usage details of the specific time bucket.

174 

175 - `input_tokens: int`

176 

177 The aggregated number of input tokens used.

178 

179 - `num_model_requests: int`

180 

181 The count of requests made to the model.

182 

183 - `object: Literal["organization.usage.moderations.result"]`

184 

185 - `"organization.usage.moderations.result"`

186 

187 - `api_key_id: Optional[str]`

188 

189 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

190 

191 - `model: Optional[str]`

192 

193 When `group_by=model`, this field provides the model name of the grouped usage result.

194 

195 - `project_id: Optional[str]`

196 

197 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

198 

199 - `user_id: Optional[str]`

200 

201 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

202 

203 - `class DataResultOrganizationUsageImagesResult: …`

204 

205 The aggregated images usage details of the specific time bucket.

206 

207 - `images: int`

208 

209 The number of images processed.

210 

211 - `num_model_requests: int`

212 

213 The count of requests made to the model.

214 

215 - `object: Literal["organization.usage.images.result"]`

216 

217 - `"organization.usage.images.result"`

218 

219 - `api_key_id: Optional[str]`

220 

221 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

222 

223 - `model: Optional[str]`

224 

225 When `group_by=model`, this field provides the model name of the grouped usage result.

226 

227 - `project_id: Optional[str]`

228 

229 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

230 

231 - `size: Optional[str]`

232 

233 When `group_by=size`, this field provides the image size of the grouped usage result.

234 

235 - `source: Optional[str]`

236 

237 When `group_by=source`, this field provides the source of the grouped usage result, possible values are `image.generation`, `image.edit`, `image.variation`.

238 

239 - `user_id: Optional[str]`

240 

241 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

242 

243 - `class DataResultOrganizationUsageAudioSpeechesResult: …`

244 

245 The aggregated audio speeches usage details of the specific time bucket.

246 

247 - `characters: int`

248 

249 The number of characters processed.

250 

251 - `num_model_requests: int`

252 

253 The count of requests made to the model.

254 

255 - `object: Literal["organization.usage.audio_speeches.result"]`

256 

257 - `"organization.usage.audio_speeches.result"`

258 

259 - `api_key_id: Optional[str]`

260 

261 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

262 

263 - `model: Optional[str]`

264 

265 When `group_by=model`, this field provides the model name of the grouped usage result.

266 

267 - `project_id: Optional[str]`

268 

269 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

270 

271 - `user_id: Optional[str]`

272 

273 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

274 

275 - `class DataResultOrganizationUsageAudioTranscriptionsResult: …`

276 

277 The aggregated audio transcriptions usage details of the specific time bucket.

278 

279 - `num_model_requests: int`

280 

281 The count of requests made to the model.

282 

283 - `object: Literal["organization.usage.audio_transcriptions.result"]`

284 

285 - `"organization.usage.audio_transcriptions.result"`

286 

287 - `seconds: int`

288 

289 The number of seconds processed.

290 

291 - `api_key_id: Optional[str]`

292 

293 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

294 

295 - `model: Optional[str]`

296 

297 When `group_by=model`, this field provides the model name of the grouped usage result.

298 

299 - `project_id: Optional[str]`

300 

301 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

302 

303 - `user_id: Optional[str]`

304 

305 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

306 

307 - `class DataResultOrganizationUsageVectorStoresResult: …`

308 

309 The aggregated vector stores usage details of the specific time bucket.

310 

311 - `object: Literal["organization.usage.vector_stores.result"]`

312 

313 - `"organization.usage.vector_stores.result"`

314 

315 - `usage_bytes: int`

316 

317 The vector stores usage in bytes.

318 

319 - `project_id: Optional[str]`

320 

321 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

322 

323 - `class DataResultOrganizationUsageCodeInterpreterSessionsResult: …`

324 

325 The aggregated code interpreter sessions usage details of the specific time bucket.

326 

327 - `num_sessions: int`

328 

329 The number of code interpreter sessions.

330 

331 - `object: Literal["organization.usage.code_interpreter_sessions.result"]`

332 

333 - `"organization.usage.code_interpreter_sessions.result"`

334 

335 - `project_id: Optional[str]`

336 

337 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

338 

339 - `class DataResultOrganizationUsageFileSearchesResult: …`

340 

341 The aggregated file search calls usage details of the specific time bucket.

342 

343 - `num_requests: int`

344 

345 The count of file search calls.

346 

347 - `object: Literal["organization.usage.file_searches.result"]`

348 

349 - `"organization.usage.file_searches.result"`

350 

351 - `api_key_id: Optional[str]`

352 

353 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

354 

355 - `project_id: Optional[str]`

356 

357 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

358 

359 - `user_id: Optional[str]`

360 

361 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

362 

363 - `vector_store_id: Optional[str]`

364 

365 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

366 

367 - `class DataResultOrganizationUsageWebSearchesResult: …`

368 

369 The aggregated web search calls usage details of the specific time bucket.

370 

371 - `num_model_requests: int`

372 

373 The count of model requests.

374 

375 - `num_requests: int`

376 

377 The count of web search calls.

378 

379 - `object: Literal["organization.usage.web_searches.result"]`

380 

381 - `"organization.usage.web_searches.result"`

382 

383 - `api_key_id: Optional[str]`

384 

385 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

386 

387 - `context_level: Optional[str]`

388 

389 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

390 

391 - `model: Optional[str]`

392 

393 When `group_by=model`, this field provides the model name of the grouped usage result.

394 

395 - `project_id: Optional[str]`

396 

397 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

398 

399 - `user_id: Optional[str]`

400 

401 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

402 

403 - `class DataResultOrganizationCostsResult: …`

404 

405 The aggregated costs details of the specific time bucket.

406 

407 - `object: Literal["organization.costs.result"]`

408 

409 - `"organization.costs.result"`

410 

411 - `amount: Optional[DataResultOrganizationCostsResultAmount]`

412 

413 The monetary value in its associated currency.

414 

415 - `currency: Optional[str]`

416 

417 Lowercase ISO-4217 currency e.g. "usd"

418 

419 - `value: Optional[float]`

420 

421 The numeric value of the cost.

422 

423 - `api_key_id: Optional[str]`

424 

425 When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result.

426 

427 - `line_item: Optional[str]`

428 

429 When `group_by=line_item`, this field provides the line item of the grouped costs result.

430 

431 - `project_id: Optional[str]`

432 

433 When `group_by=project_id`, this field provides the project ID of the grouped costs result.

434 

435 - `quantity: Optional[float]`

436 

437 When `group_by=line_item`, this field provides the quantity of the grouped costs result.

438 

439 - `start_time: int`

440 

441 - `has_more: bool`

442 

443 - `next_page: Optional[str]`

444 

445 - `object: Literal["page"]`

446 

447 - `"page"`

448 

449### Example

450 

451```python

452import os

453from openai import OpenAI

454 

455client = OpenAI(

456 admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted

457)

458response = client.admin.organization.usage.file_search_calls(

459 start_time=0,

460)

461print(response.data)

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```

Details

364 364 

365 When `group_by=project_id`, this field provides the project ID of the grouped usage result.365 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

366 366 

367 - `class DataResultOrganizationUsageFileSearchesResult: …`

368 

369 The aggregated file search calls usage details of the specific time bucket.

370 

371 - `num_requests: int`

372 

373 The count of file search calls.

374 

375 - `object: Literal["organization.usage.file_searches.result"]`

376 

377 - `"organization.usage.file_searches.result"`

378 

379 - `api_key_id: Optional[str]`

380 

381 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

382 

383 - `project_id: Optional[str]`

384 

385 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

386 

387 - `user_id: Optional[str]`

388 

389 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

390 

391 - `vector_store_id: Optional[str]`

392 

393 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

394 

395 - `class DataResultOrganizationUsageWebSearchesResult: …`

396 

397 The aggregated web search calls usage details of the specific time bucket.

398 

399 - `num_model_requests: int`

400 

401 The count of model requests.

402 

403 - `num_requests: int`

404 

405 The count of web search calls.

406 

407 - `object: Literal["organization.usage.web_searches.result"]`

408 

409 - `"organization.usage.web_searches.result"`

410 

411 - `api_key_id: Optional[str]`

412 

413 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

414 

415 - `context_level: Optional[str]`

416 

417 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

418 

419 - `model: Optional[str]`

420 

421 When `group_by=model`, this field provides the model name of the grouped usage result.

422 

423 - `project_id: Optional[str]`

424 

425 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

426 

427 - `user_id: Optional[str]`

428 

429 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

430 

367 - `class DataResultOrganizationCostsResult: …`431 - `class DataResultOrganizationCostsResult: …`

368 432 

369 The aggregated costs details of the specific time bucket.433 The aggregated costs details of the specific time bucket.

Details

336 336 

337 When `group_by=project_id`, this field provides the project ID of the grouped usage result.337 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

338 338 

339 - `class DataResultOrganizationUsageFileSearchesResult: …`

340 

341 The aggregated file search calls usage details of the specific time bucket.

342 

343 - `num_requests: int`

344 

345 The count of file search calls.

346 

347 - `object: Literal["organization.usage.file_searches.result"]`

348 

349 - `"organization.usage.file_searches.result"`

350 

351 - `api_key_id: Optional[str]`

352 

353 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

354 

355 - `project_id: Optional[str]`

356 

357 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

358 

359 - `user_id: Optional[str]`

360 

361 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

362 

363 - `vector_store_id: Optional[str]`

364 

365 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

366 

367 - `class DataResultOrganizationUsageWebSearchesResult: …`

368 

369 The aggregated web search calls usage details of the specific time bucket.

370 

371 - `num_model_requests: int`

372 

373 The count of model requests.

374 

375 - `num_requests: int`

376 

377 The count of web search calls.

378 

379 - `object: Literal["organization.usage.web_searches.result"]`

380 

381 - `"organization.usage.web_searches.result"`

382 

383 - `api_key_id: Optional[str]`

384 

385 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

386 

387 - `context_level: Optional[str]`

388 

389 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

390 

391 - `model: Optional[str]`

392 

393 When `group_by=model`, this field provides the model name of the grouped usage result.

394 

395 - `project_id: Optional[str]`

396 

397 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

398 

399 - `user_id: Optional[str]`

400 

401 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

402 

339 - `class DataResultOrganizationCostsResult: …`403 - `class DataResultOrganizationCostsResult: …`

340 404 

341 The aggregated costs details of the specific time bucket.405 The aggregated costs details of the specific time bucket.

Details

318 318 

319 When `group_by=project_id`, this field provides the project ID of the grouped usage result.319 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

320 320 

321 - `class DataResultOrganizationUsageFileSearchesResult: …`

322 

323 The aggregated file search calls usage details of the specific time bucket.

324 

325 - `num_requests: int`

326 

327 The count of file search calls.

328 

329 - `object: Literal["organization.usage.file_searches.result"]`

330 

331 - `"organization.usage.file_searches.result"`

332 

333 - `api_key_id: Optional[str]`

334 

335 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

336 

337 - `project_id: Optional[str]`

338 

339 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

340 

341 - `user_id: Optional[str]`

342 

343 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

344 

345 - `vector_store_id: Optional[str]`

346 

347 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

348 

349 - `class DataResultOrganizationUsageWebSearchesResult: …`

350 

351 The aggregated web search calls usage details of the specific time bucket.

352 

353 - `num_model_requests: int`

354 

355 The count of model requests.

356 

357 - `num_requests: int`

358 

359 The count of web search calls.

360 

361 - `object: Literal["organization.usage.web_searches.result"]`

362 

363 - `"organization.usage.web_searches.result"`

364 

365 - `api_key_id: Optional[str]`

366 

367 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

368 

369 - `context_level: Optional[str]`

370 

371 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

372 

373 - `model: Optional[str]`

374 

375 When `group_by=model`, this field provides the model name of the grouped usage result.

376 

377 - `project_id: Optional[str]`

378 

379 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

380 

381 - `user_id: Optional[str]`

382 

383 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

384 

321 - `class DataResultOrganizationCostsResult: …`385 - `class DataResultOrganizationCostsResult: …`

322 386 

323 The aggregated costs details of the specific time bucket.387 The aggregated costs details of the specific time bucket.

Details

1## Web search calls

2 

3`admin.organization.usage.web_search_calls(UsageWebSearchCallsParams**kwargs) -> UsageWebSearchCallsResponse`

4 

5**get** `/organization/usage/web_search_calls`

6 

7Get web search calls usage details for the organization.

8 

9### Parameters

10 

11- `start_time: int`

12 

13 Start time (Unix seconds) of the query time range, inclusive.

14 

15- `api_key_ids: Optional[Sequence[str]]`

16 

17 Return only usage for these API keys.

18 

19- `bucket_width: Optional[Literal["1m", "1h", "1d"]]`

20 

21 Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`.

22 

23 - `"1m"`

24 

25 - `"1h"`

26 

27 - `"1d"`

28 

29- `context_levels: Optional[List[Literal["low", "medium", "high"]]]`

30 

31 Return only web search usage for these context levels.

32 

33 - `"low"`

34 

35 - `"medium"`

36 

37 - `"high"`

38 

39- `end_time: Optional[int]`

40 

41 End time (Unix seconds) of the query time range, exclusive.

42 

43- `group_by: Optional[List[Literal["project_id", "user_id", "api_key_id", 2 more]]]`

44 

45 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.

46 

47 - `"project_id"`

48 

49 - `"user_id"`

50 

51 - `"api_key_id"`

52 

53 - `"model"`

54 

55 - `"context_level"`

56 

57- `limit: Optional[int]`

58 

59 Specifies the number of buckets to return.

60 

61 - `bucket_width=1d`: default: 7, max: 31

62 - `bucket_width=1h`: default: 24, max: 168

63 - `bucket_width=1m`: default: 60, max: 1440

64 

65- `models: Optional[Sequence[str]]`

66 

67 Return only usage for these models.

68 

69- `page: Optional[str]`

70 

71 A cursor for use in pagination. Corresponding to the `next_page` field from the previous response.

72 

73- `project_ids: Optional[Sequence[str]]`

74 

75 Return only usage for these projects.

76 

77- `user_ids: Optional[Sequence[str]]`

78 

79 Return only usage for these users.

80 

81### Returns

82 

83- `class UsageWebSearchCallsResponse: …`

84 

85 - `data: List[Data]`

86 

87 - `end_time: int`

88 

89 - `object: Literal["bucket"]`

90 

91 - `"bucket"`

92 

93 - `results: List[DataResult]`

94 

95 - `class DataResultOrganizationUsageCompletionsResult: …`

96 

97 The aggregated completions usage details of the specific time bucket.

98 

99 - `input_tokens: int`

100 

101 The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.

102 

103 - `num_model_requests: int`

104 

105 The count of requests made to the model.

106 

107 - `object: Literal["organization.usage.completions.result"]`

108 

109 - `"organization.usage.completions.result"`

110 

111 - `output_tokens: int`

112 

113 The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.

114 

115 - `api_key_id: Optional[str]`

116 

117 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

118 

119 - `batch: Optional[bool]`

120 

121 When `group_by=batch`, this field tells whether the grouped usage result is batch or not.

122 

123 - `input_audio_tokens: Optional[int]`

124 

125 The aggregated number of audio input tokens used, including cached tokens.

126 

127 - `input_cached_tokens: Optional[int]`

128 

129 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.

130 

131 - `model: Optional[str]`

132 

133 When `group_by=model`, this field provides the model name of the grouped usage result.

134 

135 - `output_audio_tokens: Optional[int]`

136 

137 The aggregated number of audio output tokens used.

138 

139 - `project_id: Optional[str]`

140 

141 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

142 

143 - `service_tier: Optional[str]`

144 

145 When `group_by=service_tier`, this field provides the service tier of the grouped usage result.

146 

147 - `user_id: Optional[str]`

148 

149 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

150 

151 - `class DataResultOrganizationUsageEmbeddingsResult: …`

152 

153 The aggregated embeddings usage details of the specific time bucket.

154 

155 - `input_tokens: int`

156 

157 The aggregated number of input tokens used.

158 

159 - `num_model_requests: int`

160 

161 The count of requests made to the model.

162 

163 - `object: Literal["organization.usage.embeddings.result"]`

164 

165 - `"organization.usage.embeddings.result"`

166 

167 - `api_key_id: Optional[str]`

168 

169 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

170 

171 - `model: Optional[str]`

172 

173 When `group_by=model`, this field provides the model name of the grouped usage result.

174 

175 - `project_id: Optional[str]`

176 

177 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

178 

179 - `user_id: Optional[str]`

180 

181 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

182 

183 - `class DataResultOrganizationUsageModerationsResult: …`

184 

185 The aggregated moderations usage details of the specific time bucket.

186 

187 - `input_tokens: int`

188 

189 The aggregated number of input tokens used.

190 

191 - `num_model_requests: int`

192 

193 The count of requests made to the model.

194 

195 - `object: Literal["organization.usage.moderations.result"]`

196 

197 - `"organization.usage.moderations.result"`

198 

199 - `api_key_id: Optional[str]`

200 

201 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

202 

203 - `model: Optional[str]`

204 

205 When `group_by=model`, this field provides the model name of the grouped usage result.

206 

207 - `project_id: Optional[str]`

208 

209 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

210 

211 - `user_id: Optional[str]`

212 

213 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

214 

215 - `class DataResultOrganizationUsageImagesResult: …`

216 

217 The aggregated images usage details of the specific time bucket.

218 

219 - `images: int`

220 

221 The number of images processed.

222 

223 - `num_model_requests: int`

224 

225 The count of requests made to the model.

226 

227 - `object: Literal["organization.usage.images.result"]`

228 

229 - `"organization.usage.images.result"`

230 

231 - `api_key_id: Optional[str]`

232 

233 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

234 

235 - `model: Optional[str]`

236 

237 When `group_by=model`, this field provides the model name of the grouped usage result.

238 

239 - `project_id: Optional[str]`

240 

241 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

242 

243 - `size: Optional[str]`

244 

245 When `group_by=size`, this field provides the image size of the grouped usage result.

246 

247 - `source: Optional[str]`

248 

249 When `group_by=source`, this field provides the source of the grouped usage result, possible values are `image.generation`, `image.edit`, `image.variation`.

250 

251 - `user_id: Optional[str]`

252 

253 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

254 

255 - `class DataResultOrganizationUsageAudioSpeechesResult: …`

256 

257 The aggregated audio speeches usage details of the specific time bucket.

258 

259 - `characters: int`

260 

261 The number of characters processed.

262 

263 - `num_model_requests: int`

264 

265 The count of requests made to the model.

266 

267 - `object: Literal["organization.usage.audio_speeches.result"]`

268 

269 - `"organization.usage.audio_speeches.result"`

270 

271 - `api_key_id: Optional[str]`

272 

273 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

274 

275 - `model: Optional[str]`

276 

277 When `group_by=model`, this field provides the model name of the grouped usage result.

278 

279 - `project_id: Optional[str]`

280 

281 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

282 

283 - `user_id: Optional[str]`

284 

285 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

286 

287 - `class DataResultOrganizationUsageAudioTranscriptionsResult: …`

288 

289 The aggregated audio transcriptions usage details of the specific time bucket.

290 

291 - `num_model_requests: int`

292 

293 The count of requests made to the model.

294 

295 - `object: Literal["organization.usage.audio_transcriptions.result"]`

296 

297 - `"organization.usage.audio_transcriptions.result"`

298 

299 - `seconds: int`

300 

301 The number of seconds processed.

302 

303 - `api_key_id: Optional[str]`

304 

305 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

306 

307 - `model: Optional[str]`

308 

309 When `group_by=model`, this field provides the model name of the grouped usage result.

310 

311 - `project_id: Optional[str]`

312 

313 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

314 

315 - `user_id: Optional[str]`

316 

317 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

318 

319 - `class DataResultOrganizationUsageVectorStoresResult: …`

320 

321 The aggregated vector stores usage details of the specific time bucket.

322 

323 - `object: Literal["organization.usage.vector_stores.result"]`

324 

325 - `"organization.usage.vector_stores.result"`

326 

327 - `usage_bytes: int`

328 

329 The vector stores usage in bytes.

330 

331 - `project_id: Optional[str]`

332 

333 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

334 

335 - `class DataResultOrganizationUsageCodeInterpreterSessionsResult: …`

336 

337 The aggregated code interpreter sessions usage details of the specific time bucket.

338 

339 - `num_sessions: int`

340 

341 The number of code interpreter sessions.

342 

343 - `object: Literal["organization.usage.code_interpreter_sessions.result"]`

344 

345 - `"organization.usage.code_interpreter_sessions.result"`

346 

347 - `project_id: Optional[str]`

348 

349 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

350 

351 - `class DataResultOrganizationUsageFileSearchesResult: …`

352 

353 The aggregated file search calls usage details of the specific time bucket.

354 

355 - `num_requests: int`

356 

357 The count of file search calls.

358 

359 - `object: Literal["organization.usage.file_searches.result"]`

360 

361 - `"organization.usage.file_searches.result"`

362 

363 - `api_key_id: Optional[str]`

364 

365 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

366 

367 - `project_id: Optional[str]`

368 

369 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

370 

371 - `user_id: Optional[str]`

372 

373 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

374 

375 - `vector_store_id: Optional[str]`

376 

377 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

378 

379 - `class DataResultOrganizationUsageWebSearchesResult: …`

380 

381 The aggregated web search calls usage details of the specific time bucket.

382 

383 - `num_model_requests: int`

384 

385 The count of model requests.

386 

387 - `num_requests: int`

388 

389 The count of web search calls.

390 

391 - `object: Literal["organization.usage.web_searches.result"]`

392 

393 - `"organization.usage.web_searches.result"`

394 

395 - `api_key_id: Optional[str]`

396 

397 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

398 

399 - `context_level: Optional[str]`

400 

401 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

402 

403 - `model: Optional[str]`

404 

405 When `group_by=model`, this field provides the model name of the grouped usage result.

406 

407 - `project_id: Optional[str]`

408 

409 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

410 

411 - `user_id: Optional[str]`

412 

413 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

414 

415 - `class DataResultOrganizationCostsResult: …`

416 

417 The aggregated costs details of the specific time bucket.

418 

419 - `object: Literal["organization.costs.result"]`

420 

421 - `"organization.costs.result"`

422 

423 - `amount: Optional[DataResultOrganizationCostsResultAmount]`

424 

425 The monetary value in its associated currency.

426 

427 - `currency: Optional[str]`

428 

429 Lowercase ISO-4217 currency e.g. "usd"

430 

431 - `value: Optional[float]`

432 

433 The numeric value of the cost.

434 

435 - `api_key_id: Optional[str]`

436 

437 When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result.

438 

439 - `line_item: Optional[str]`

440 

441 When `group_by=line_item`, this field provides the line item of the grouped costs result.

442 

443 - `project_id: Optional[str]`

444 

445 When `group_by=project_id`, this field provides the project ID of the grouped costs result.

446 

447 - `quantity: Optional[float]`

448 

449 When `group_by=line_item`, this field provides the quantity of the grouped costs result.

450 

451 - `start_time: int`

452 

453 - `has_more: bool`

454 

455 - `next_page: Optional[str]`

456 

457 - `object: Literal["page"]`

458 

459 - `"page"`

460 

461### Example

462 

463```python

464import os

465from openai import OpenAI

466 

467client = OpenAI(

468 admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted

469)

470response = client.admin.organization.usage.web_search_calls(

471 start_time=0,

472)

473print(response.data)

474```

475 

476#### Response

477 

478```json

479{

480 "data": [

481 {

482 "end_time": 0,

483 "object": "bucket",

484 "results": [

485 {

486 "input_tokens": 0,

487 "num_model_requests": 0,

488 "object": "organization.usage.completions.result",

489 "output_tokens": 0,

490 "api_key_id": "api_key_id",

491 "batch": true,

492 "input_audio_tokens": 0,

493 "input_cached_tokens": 0,

494 "model": "model",

495 "output_audio_tokens": 0,

496 "project_id": "project_id",

497 "service_tier": "service_tier",

498 "user_id": "user_id"

499 }

500 ],

501 "start_time": 0

502 }

503 ],

504 "has_more": true,

505 "next_page": "next_page",

506 "object": "page"

507}

508```

Details

2959 2959 

2960 The namespace of the custom tool being called.2960 The namespace of the custom tool being called.

2961 2961 

2962 - `class CompactionTrigger: …`

2963 

2964 Compacts the current context. Must be the final input item.

2965 

2966 - `type: Literal["compaction_trigger"]`

2967 

2968 The type of the item. Always `compaction_trigger`.

2969 

2970 - `"compaction_trigger"`

2971 

2962 - `class ItemReference: …`2972 - `class ItemReference: …`

2963 2973 

2964 An internal identifier for an item to reference.2974 An internal identifier for an item to reference.

Details

2961 2961 

2962 The namespace of the custom tool being called.2962 The namespace of the custom tool being called.

2963 2963 

2964 - `class CompactionTrigger: …`

2965 

2966 Compacts the current context. Must be the final input item.

2967 

2968 - `type: Literal["compaction_trigger"]`

2969 

2970 The type of the item. Always `compaction_trigger`.

2971 

2972 - `"compaction_trigger"`

2973 

2964 - `class ItemReference: …`2974 - `class ItemReference: …`

2965 2975 

2966 An internal identifier for an item to reference.2976 An internal identifier for an item to reference.

Details

3049 3049 

3050 The namespace of the custom tool being called.3050 The namespace of the custom tool being called.

3051 3051 

3052 - `class CompactionTrigger: …`

3053 

3054 Compacts the current context. Must be the final input item.

3055 

3056 - `type: Literal["compaction_trigger"]`

3057 

3058 The type of the item. Always `compaction_trigger`.

3059 

3060 - `"compaction_trigger"`

3061 

3052 - `class ItemReference: …`3062 - `class ItemReference: …`

3053 3063 

3054 An internal identifier for an item to reference.3064 An internal identifier for an item to reference.

Details

3163 3163 

3164 The namespace of the custom tool being called.3164 The namespace of the custom tool being called.

3165 3165 

3166 - `class CompactionTrigger: …`

3167 

3168 Compacts the current context. Must be the final input item.

3169 

3170 - `type: Literal["compaction_trigger"]`

3171 

3172 The type of the item. Always `compaction_trigger`.

3173 

3174 - `"compaction_trigger"`

3175 

3166 - `class ItemReference: …`3176 - `class ItemReference: …`

3167 3177 

3168 An internal identifier for an item to reference.3178 An internal identifier for an item to reference.

Details

3042 3042 

3043 The namespace of the custom tool being called.3043 The namespace of the custom tool being called.

3044 3044 

3045 - `class CompactionTrigger: …`

3046 

3047 Compacts the current context. Must be the final input item.

3048 

3049 - `type: Literal["compaction_trigger"]`

3050 

3051 The type of the item. Always `compaction_trigger`.

3052 

3053 - `"compaction_trigger"`

3054 

3045 - `class ItemReference: …`3055 - `class ItemReference: …`

3046 3056 

3047 An internal identifier for an item to reference.3057 An internal identifier for an item to reference.


6853 6863 

6854 The namespace of the custom tool being called.6864 The namespace of the custom tool being called.

6855 6865 

6866 - `class CompactionTrigger: …`

6867 

6868 Compacts the current context. Must be the final input item.

6869 

6870 - `type: Literal["compaction_trigger"]`

6871 

6872 The type of the item. Always `compaction_trigger`.

6873 

6874 - `"compaction_trigger"`

6875 

6856 - `class ItemReference: …`6876 - `class ItemReference: …`

6857 6877 

6858 An internal identifier for an item to reference.6878 An internal identifier for an item to reference.

Details

3091 3091 

3092 The namespace of the custom tool being called.3092 The namespace of the custom tool being called.

3093 3093 

3094 - `class CompactionTrigger: …`

3095 

3096 Compacts the current context. Must be the final input item.

3097 

3098 - `type: Literal["compaction_trigger"]`

3099 

3100 The type of the item. Always `compaction_trigger`.

3101 

3102 - `"compaction_trigger"`

3103 

3094 - `class ItemReference: …`3104 - `class ItemReference: …`

3095 3105 

3096 An internal identifier for an item to reference.3106 An internal identifier for an item to reference.

Details

2986 2986 

2987 The namespace of the custom tool being called.2987 The namespace of the custom tool being called.

2988 2988 

2989 - `class CompactionTrigger: …`

2990 

2991 Compacts the current context. Must be the final input item.

2992 

2993 - `type: Literal["compaction_trigger"]`

2994 

2995 The type of the item. Always `compaction_trigger`.

2996 

2997 - `"compaction_trigger"`

2998 

2989 - `class ItemReference: …`2999 - `class ItemReference: …`

2990 3000 

2991 An internal identifier for an item to reference.3001 An internal identifier for an item to reference.

Details

20 20 

21- `projects: optional array of object { id, role }`21- `projects: optional array of object { id, role }`

22 22 

23 An array of projects to which membership is granted at the same time the org invite is accepted. If omitted, the user will be invited to the default project for compatibility with legacy behavior.23 An array of projects to which membership is granted at the same time the org invite is accepted. If omitted, the user will be invited to the default project for compatibility with legacy behavior. If empty list is passed, the user will not be invited to any projects, including the default one.

24 24 

25 - `id: string`25 - `id: string`

26 26 

Details

1## Retrieve project hosted tool permissions

2 

3**get** `/organization/projects/{project_id}/hosted_tool_permissions`

4 

5Returns hosted tool permissions for a project.

6 

7### Path Parameters

8 

9- `project_id: string`

10 

11### Returns

12 

13- `ProjectHostedToolPermissions object { code_interpreter, file_search, image_generation, 2 more }`

14 

15 Represents hosted tool permissions for a project.

16 

17 - `code_interpreter: object { enabled }`

18 

19 Permission state for a single hosted tool on a project.

20 

21 - `enabled: boolean`

22 

23 Whether the hosted tool is enabled for the project.

24 

25 - `file_search: object { enabled }`

26 

27 Permission state for a single hosted tool on a project.

28 

29 - `enabled: boolean`

30 

31 Whether the hosted tool is enabled for the project.

32 

33 - `image_generation: object { enabled }`

34 

35 Permission state for a single hosted tool on a project.

36 

37 - `enabled: boolean`

38 

39 Whether the hosted tool is enabled for the project.

40 

41 - `mcp: object { enabled }`

42 

43 Permission state for a single hosted tool on a project.

44 

45 - `enabled: boolean`

46 

47 Whether the hosted tool is enabled for the project.

48 

49 - `web_search: object { enabled }`

50 

51 Permission state for a single hosted tool on a project.

52 

53 - `enabled: boolean`

54 

55 Whether the hosted tool is enabled for the project.

56 

57### Example

58 

59```http

60curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/hosted_tool_permissions \

61 -H "Authorization: Bearer $OPENAI_ADMIN_KEY"

62```

63 

64#### Response

65 

66```json

67{

68 "code_interpreter": {

69 "enabled": true

70 },

71 "file_search": {

72 "enabled": true

73 },

74 "image_generation": {

75 "enabled": true

76 },

77 "mcp": {

78 "enabled": true

79 },

80 "web_search": {

81 "enabled": true

82 }

83}

84```

85 

86### Example

87 

88```http

89curl https://api.openai.com/v1/organization/projects/proj_abc/hosted_tool_permissions \

90 -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \

91 -H "Content-Type: application/json"

92```

93 

94#### Response

95 

96```json

97{

98 "file_search": {

99 "enabled": true

100 },

101 "web_search": {

102 "enabled": true

103 },

104 "image_generation": {

105 "enabled": true

106 },

107 "mcp": {

108 "enabled": true

109 },

110 "code_interpreter": {

111 "enabled": true

112 }

113}

114```

Details

1## Modify project hosted tool permissions

2 

3**post** `/organization/projects/{project_id}/hosted_tool_permissions`

4 

5Updates hosted tool permissions for a project.

6 

7### Path Parameters

8 

9- `project_id: string`

10 

11### Body Parameters

12 

13- `code_interpreter: optional object { enabled }`

14 

15 The code interpreter permission update.

16 

17 - `enabled: boolean`

18 

19 Whether to enable the hosted tool for the project.

20 

21- `file_search: optional object { enabled }`

22 

23 The file search permission update.

24 

25 - `enabled: boolean`

26 

27 Whether to enable the hosted tool for the project.

28 

29- `image_generation: optional object { enabled }`

30 

31 The image generation permission update.

32 

33 - `enabled: boolean`

34 

35 Whether to enable the hosted tool for the project.

36 

37- `mcp: optional object { enabled }`

38 

39 The MCP permission update.

40 

41 - `enabled: boolean`

42 

43 Whether to enable the hosted tool for the project.

44 

45- `web_search: optional object { enabled }`

46 

47 The web search permission update.

48 

49 - `enabled: boolean`

50 

51 Whether to enable the hosted tool for the project.

52 

53### Returns

54 

55- `ProjectHostedToolPermissions object { code_interpreter, file_search, image_generation, 2 more }`

56 

57 Represents hosted tool permissions for a project.

58 

59 - `code_interpreter: object { enabled }`

60 

61 Permission state for a single hosted tool on a project.

62 

63 - `enabled: boolean`

64 

65 Whether the hosted tool is enabled for the project.

66 

67 - `file_search: object { enabled }`

68 

69 Permission state for a single hosted tool on a project.

70 

71 - `enabled: boolean`

72 

73 Whether the hosted tool is enabled for the project.

74 

75 - `image_generation: object { enabled }`

76 

77 Permission state for a single hosted tool on a project.

78 

79 - `enabled: boolean`

80 

81 Whether the hosted tool is enabled for the project.

82 

83 - `mcp: object { enabled }`

84 

85 Permission state for a single hosted tool on a project.

86 

87 - `enabled: boolean`

88 

89 Whether the hosted tool is enabled for the project.

90 

91 - `web_search: object { enabled }`

92 

93 Permission state for a single hosted tool on a project.

94 

95 - `enabled: boolean`

96 

97 Whether the hosted tool is enabled for the project.

98 

99### Example

100 

101```http

102curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/hosted_tool_permissions \

103 -H 'Content-Type: application/json' \

104 -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \

105 -d '{}'

106```

107 

108#### Response

109 

110```json

111{

112 "code_interpreter": {

113 "enabled": true

114 },

115 "file_search": {

116 "enabled": true

117 },

118 "image_generation": {

119 "enabled": true

120 },

121 "mcp": {

122 "enabled": true

123 },

124 "web_search": {

125 "enabled": true

126 }

127}

128```

129 

130### Example

131 

132```http

133curl -X POST https://api.openai.com/v1/organization/projects/proj_abc/hosted_tool_permissions \

134 -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \

135 -H "Content-Type: application/json" \

136 -d '{

137 "file_search": {

138 "enabled": true

139 },

140 "image_generation": {

141 "enabled": false

142 }

143 }'

144```

145 

146#### Response

147 

148```json

149{

150 "file_search": {

151 "enabled": true

152 },

153 "web_search": {

154 "enabled": true

155 },

156 "image_generation": {

157 "enabled": false

158 },

159 "mcp": {

160 "enabled": true

161 },

162 "code_interpreter": {

163 "enabled": true

164 }

165}

166```

Details

1## Delete project model permissions

2 

3**delete** `/organization/projects/{project_id}/model_permissions`

4 

5Deletes model permissions for a project.

6 

7### Path Parameters

8 

9- `project_id: string`

10 

11### Returns

12 

13- `ProjectModelPermissionsDeleted object { deleted, object }`

14 

15 Confirmation payload returned after deleting project model permissions.

16 

17 - `deleted: boolean`

18 

19 Whether the project model permissions were deleted.

20 

21 - `object: "project.model_permissions.deleted"`

22 

23 The object type, which is always `project.model_permissions.deleted`.

24 

25 - `"project.model_permissions.deleted"`

26 

27### Example

28 

29```http

30curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/model_permissions \

31 -X DELETE \

32 -H "Authorization: Bearer $OPENAI_ADMIN_KEY"

33```

34 

35#### Response

36 

37```json

38{

39 "deleted": true,

40 "object": "project.model_permissions.deleted"

41}

42```

43 

44### Example

45 

46```http

47curl -X DELETE https://api.openai.com/v1/organization/projects/proj_abc/model_permissions \

48 -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \

49 -H "Content-Type: application/json"

50```

51 

52#### Response

53 

54```json

55{

56 "object": "project.model_permissions.deleted",

57 "deleted": true

58}

59```

Details

1## Retrieve project model permissions

2 

3**get** `/organization/projects/{project_id}/model_permissions`

4 

5Returns model permissions for a project.

6 

7### Path Parameters

8 

9- `project_id: string`

10 

11### Returns

12 

13- `ProjectModelPermissions object { mode, model_ids, object }`

14 

15 Represents the model allowlist or denylist policy for a project.

16 

17 - `mode: "allow_list" or "deny_list"`

18 

19 Whether the project uses an allowlist or a denylist.

20 

21 - `"allow_list"`

22 

23 - `"deny_list"`

24 

25 - `model_ids: array of string`

26 

27 The model IDs included in the model permissions policy.

28 

29 - `object: "project.model_permissions"`

30 

31 The object type, which is always `project.model_permissions`.

32 

33 - `"project.model_permissions"`

34 

35### Example

36 

37```http

38curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/model_permissions \

39 -H "Authorization: Bearer $OPENAI_ADMIN_KEY"

40```

41 

42#### Response

43 

44```json

45{

46 "mode": "allow_list",

47 "model_ids": [

48 "string"

49 ],

50 "object": "project.model_permissions"

51}

52```

53 

54### Example

55 

56```http

57curl https://api.openai.com/v1/organization/projects/proj_abc/model_permissions \

58 -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \

59 -H "Content-Type: application/json"

60```

61 

62#### Response

63 

64```json

65{

66 "object": "project.model_permissions",

67 "mode": "allow_list",

68 "model_ids": [

69 "gpt-4.1",

70 "o3"

71 ]

72}

73```

Details

1## Modify project model permissions

2 

3**post** `/organization/projects/{project_id}/model_permissions`

4 

5Updates model permissions for a project.

6 

7### Path Parameters

8 

9- `project_id: string`

10 

11### Body Parameters

12 

13- `mode: "allow_list" or "deny_list"`

14 

15 The model permissions mode to apply.

16 

17 - `"allow_list"`

18 

19 - `"deny_list"`

20 

21- `model_ids: array of string`

22 

23 The model IDs included in this permissions policy.

24 

25### Returns

26 

27- `ProjectModelPermissions object { mode, model_ids, object }`

28 

29 Represents the model allowlist or denylist policy for a project.

30 

31 - `mode: "allow_list" or "deny_list"`

32 

33 Whether the project uses an allowlist or a denylist.

34 

35 - `"allow_list"`

36 

37 - `"deny_list"`

38 

39 - `model_ids: array of string`

40 

41 The model IDs included in the model permissions policy.

42 

43 - `object: "project.model_permissions"`

44 

45 The object type, which is always `project.model_permissions`.

46 

47 - `"project.model_permissions"`

48 

49### Example

50 

51```http

52curl https://api.openai.com/v1/organization/projects/$PROJECT_ID/model_permissions \

53 -H 'Content-Type: application/json' \

54 -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \

55 -d '{

56 "mode": "allow_list",

57 "model_ids": [

58 "string"

59 ]

60 }'

61```

62 

63#### Response

64 

65```json

66{

67 "mode": "allow_list",

68 "model_ids": [

69 "string"

70 ],

71 "object": "project.model_permissions"

72}

73```

74 

75### Example

76 

77```http

78curl -X POST https://api.openai.com/v1/organization/projects/proj_abc/model_permissions \

79 -H "Authorization: Bearer $OPENAI_ADMIN_KEY" \

80 -H "Content-Type: application/json" \

81 -d '{

82 "mode": "deny_list",

83 "model_ids": [

84 "o3"

85 ]

86 }'

87```

88 

89#### Response

90 

91```json

92{

93 "object": "project.model_permissions",

94 "mode": "deny_list",

95 "model_ids": [

96 "o3"

97 ]

98}

99```

Details

74 74 

75 - `"bucket"`75 - `"bucket"`

76 76 

77 - `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 6 more`77 - `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`

78 78 

79 - `OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }`79 - `OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }`

80 80 


332 332 

333 When `group_by=project_id`, this field provides the project ID of the grouped usage result.333 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

334 334 

335 - `OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }`

336 

337 The aggregated file search calls usage details of the specific time bucket.

338 

339 - `num_requests: number`

340 

341 The count of file search calls.

342 

343 - `object: "organization.usage.file_searches.result"`

344 

345 - `"organization.usage.file_searches.result"`

346 

347 - `api_key_id: optional string`

348 

349 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

350 

351 - `project_id: optional string`

352 

353 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

354 

355 - `user_id: optional string`

356 

357 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

358 

359 - `vector_store_id: optional string`

360 

361 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

362 

363 - `OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }`

364 

365 The aggregated web search calls usage details of the specific time bucket.

366 

367 - `num_model_requests: number`

368 

369 The count of model requests.

370 

371 - `num_requests: number`

372 

373 The count of web search calls.

374 

375 - `object: "organization.usage.web_searches.result"`

376 

377 - `"organization.usage.web_searches.result"`

378 

379 - `api_key_id: optional string`

380 

381 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

382 

383 - `context_level: optional string`

384 

385 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

386 

387 - `model: optional string`

388 

389 When `group_by=model`, this field provides the model name of the grouped usage result.

390 

391 - `project_id: optional string`

392 

393 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

394 

395 - `user_id: optional string`

396 

397 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

398 

335 - `OrganizationCostsResult object { object, amount, api_key_id, 3 more }`399 - `OrganizationCostsResult object { object, amount, api_key_id, 3 more }`

336 400 

337 The aggregated costs details of the specific time bucket.401 The aggregated costs details of the specific time bucket.

Details

74 74 

75 - `"bucket"`75 - `"bucket"`

76 76 

77 - `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 6 more`77 - `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`

78 78 

79 - `OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }`79 - `OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }`

80 80 


332 332 

333 When `group_by=project_id`, this field provides the project ID of the grouped usage result.333 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

334 334 

335 - `OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }`

336 

337 The aggregated file search calls usage details of the specific time bucket.

338 

339 - `num_requests: number`

340 

341 The count of file search calls.

342 

343 - `object: "organization.usage.file_searches.result"`

344 

345 - `"organization.usage.file_searches.result"`

346 

347 - `api_key_id: optional string`

348 

349 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

350 

351 - `project_id: optional string`

352 

353 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

354 

355 - `user_id: optional string`

356 

357 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

358 

359 - `vector_store_id: optional string`

360 

361 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

362 

363 - `OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }`

364 

365 The aggregated web search calls usage details of the specific time bucket.

366 

367 - `num_model_requests: number`

368 

369 The count of model requests.

370 

371 - `num_requests: number`

372 

373 The count of web search calls.

374 

375 - `object: "organization.usage.web_searches.result"`

376 

377 - `"organization.usage.web_searches.result"`

378 

379 - `api_key_id: optional string`

380 

381 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

382 

383 - `context_level: optional string`

384 

385 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

386 

387 - `model: optional string`

388 

389 When `group_by=model`, this field provides the model name of the grouped usage result.

390 

391 - `project_id: optional string`

392 

393 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

394 

395 - `user_id: optional string`

396 

397 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

398 

335 - `OrganizationCostsResult object { object, amount, api_key_id, 3 more }`399 - `OrganizationCostsResult object { object, amount, api_key_id, 3 more }`

336 400 

337 The aggregated costs details of the specific time bucket.401 The aggregated costs details of the specific time bucket.

Details

56 56 

57 - `"bucket"`57 - `"bucket"`

58 58 

59 - `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 6 more`59 - `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`

60 60 

61 - `OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }`61 - `OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }`

62 62 


314 314 

315 When `group_by=project_id`, this field provides the project ID of the grouped usage result.315 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

316 316 

317 - `OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }`

318 

319 The aggregated file search calls usage details of the specific time bucket.

320 

321 - `num_requests: number`

322 

323 The count of file search calls.

324 

325 - `object: "organization.usage.file_searches.result"`

326 

327 - `"organization.usage.file_searches.result"`

328 

329 - `api_key_id: optional string`

330 

331 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

332 

333 - `project_id: optional string`

334 

335 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

336 

337 - `user_id: optional string`

338 

339 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

340 

341 - `vector_store_id: optional string`

342 

343 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

344 

345 - `OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }`

346 

347 The aggregated web search calls usage details of the specific time bucket.

348 

349 - `num_model_requests: number`

350 

351 The count of model requests.

352 

353 - `num_requests: number`

354 

355 The count of web search calls.

356 

357 - `object: "organization.usage.web_searches.result"`

358 

359 - `"organization.usage.web_searches.result"`

360 

361 - `api_key_id: optional string`

362 

363 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

364 

365 - `context_level: optional string`

366 

367 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

368 

369 - `model: optional string`

370 

371 When `group_by=model`, this field provides the model name of the grouped usage result.

372 

373 - `project_id: optional string`

374 

375 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

376 

377 - `user_id: optional string`

378 

379 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

380 

317 - `OrganizationCostsResult object { object, amount, api_key_id, 3 more }`381 - `OrganizationCostsResult object { object, amount, api_key_id, 3 more }`

318 382 

319 The aggregated costs details of the specific time bucket.383 The aggregated costs details of the specific time bucket.

Details

82 82 

83 - `"bucket"`83 - `"bucket"`

84 84 

85 - `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 6 more`85 - `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`

86 86 

87 - `OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }`87 - `OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }`

88 88 


340 340 

341 When `group_by=project_id`, this field provides the project ID of the grouped usage result.341 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

342 342 

343 - `OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }`

344 

345 The aggregated file search calls usage details of the specific time bucket.

346 

347 - `num_requests: number`

348 

349 The count of file search calls.

350 

351 - `object: "organization.usage.file_searches.result"`

352 

353 - `"organization.usage.file_searches.result"`

354 

355 - `api_key_id: optional string`

356 

357 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

358 

359 - `project_id: optional string`

360 

361 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

362 

363 - `user_id: optional string`

364 

365 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

366 

367 - `vector_store_id: optional string`

368 

369 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

370 

371 - `OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }`

372 

373 The aggregated web search calls usage details of the specific time bucket.

374 

375 - `num_model_requests: number`

376 

377 The count of model requests.

378 

379 - `num_requests: number`

380 

381 The count of web search calls.

382 

383 - `object: "organization.usage.web_searches.result"`

384 

385 - `"organization.usage.web_searches.result"`

386 

387 - `api_key_id: optional string`

388 

389 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

390 

391 - `context_level: optional string`

392 

393 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

394 

395 - `model: optional string`

396 

397 When `group_by=model`, this field provides the model name of the grouped usage result.

398 

399 - `project_id: optional string`

400 

401 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

402 

403 - `user_id: optional string`

404 

405 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

406 

343 - `OrganizationCostsResult object { object, amount, api_key_id, 3 more }`407 - `OrganizationCostsResult object { object, amount, api_key_id, 3 more }`

344 408 

345 The aggregated costs details of the specific time bucket.409 The aggregated costs details of the specific time bucket.

Details

56 56 

57 - `"bucket"`57 - `"bucket"`

58 58 

59 - `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 6 more`59 - `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`

60 60 

61 - `OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }`61 - `OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }`

62 62 


314 314 

315 When `group_by=project_id`, this field provides the project ID of the grouped usage result.315 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

316 316 

317 - `OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }`

318 

319 The aggregated file search calls usage details of the specific time bucket.

320 

321 - `num_requests: number`

322 

323 The count of file search calls.

324 

325 - `object: "organization.usage.file_searches.result"`

326 

327 - `"organization.usage.file_searches.result"`

328 

329 - `api_key_id: optional string`

330 

331 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

332 

333 - `project_id: optional string`

334 

335 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

336 

337 - `user_id: optional string`

338 

339 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

340 

341 - `vector_store_id: optional string`

342 

343 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

344 

345 - `OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }`

346 

347 The aggregated web search calls usage details of the specific time bucket.

348 

349 - `num_model_requests: number`

350 

351 The count of model requests.

352 

353 - `num_requests: number`

354 

355 The count of web search calls.

356 

357 - `object: "organization.usage.web_searches.result"`

358 

359 - `"organization.usage.web_searches.result"`

360 

361 - `api_key_id: optional string`

362 

363 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

364 

365 - `context_level: optional string`

366 

367 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

368 

369 - `model: optional string`

370 

371 When `group_by=model`, this field provides the model name of the grouped usage result.

372 

373 - `project_id: optional string`

374 

375 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

376 

377 - `user_id: optional string`

378 

379 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

380 

317 - `OrganizationCostsResult object { object, amount, api_key_id, 3 more }`381 - `OrganizationCostsResult object { object, amount, api_key_id, 3 more }`

318 382 

319 The aggregated costs details of the specific time bucket.383 The aggregated costs details of the specific time bucket.

Details

74 74 

75 - `"bucket"`75 - `"bucket"`

76 76 

77 - `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 6 more`77 - `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`

78 78 

79 - `OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }`79 - `OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }`

80 80 


332 332 

333 When `group_by=project_id`, this field provides the project ID of the grouped usage result.333 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

334 334 

335 - `OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }`

336 

337 The aggregated file search calls usage details of the specific time bucket.

338 

339 - `num_requests: number`

340 

341 The count of file search calls.

342 

343 - `object: "organization.usage.file_searches.result"`

344 

345 - `"organization.usage.file_searches.result"`

346 

347 - `api_key_id: optional string`

348 

349 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

350 

351 - `project_id: optional string`

352 

353 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

354 

355 - `user_id: optional string`

356 

357 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

358 

359 - `vector_store_id: optional string`

360 

361 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

362 

363 - `OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }`

364 

365 The aggregated web search calls usage details of the specific time bucket.

366 

367 - `num_model_requests: number`

368 

369 The count of model requests.

370 

371 - `num_requests: number`

372 

373 The count of web search calls.

374 

375 - `object: "organization.usage.web_searches.result"`

376 

377 - `"organization.usage.web_searches.result"`

378 

379 - `api_key_id: optional string`

380 

381 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

382 

383 - `context_level: optional string`

384 

385 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

386 

387 - `model: optional string`

388 

389 When `group_by=model`, this field provides the model name of the grouped usage result.

390 

391 - `project_id: optional string`

392 

393 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

394 

395 - `user_id: optional string`

396 

397 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

398 

335 - `OrganizationCostsResult object { object, amount, api_key_id, 3 more }`399 - `OrganizationCostsResult object { object, amount, api_key_id, 3 more }`

336 400 

337 The aggregated costs details of the specific time bucket.401 The aggregated costs details of the specific time bucket.

Details

1## File search calls

2 

3**get** `/organization/usage/file_search_calls`

4 

5Get file 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- `end_time: optional number`

28 

29 End time (Unix seconds) of the query time range, exclusive.

30 

31- `group_by: optional array of "project_id" or "user_id" or "api_key_id" or "vector_store_id"`

32 

33 Group the usage data by the specified fields. Support fields include `project_id`, `user_id`, `api_key_id`, `vector_store_id` or any combination of them.

34 

35 - `"project_id"`

36 

37 - `"user_id"`

38 

39 - `"api_key_id"`

40 

41 - `"vector_store_id"`

42 

43- `limit: optional number`

44 

45 Specifies the number of buckets to return.

46 

47 - `bucket_width=1d`: default: 7, max: 31

48 - `bucket_width=1h`: default: 24, max: 168

49 - `bucket_width=1m`: default: 60, max: 1440

50 

51- `page: optional string`

52 

53 A cursor for use in pagination. Corresponding to the `next_page` field from the previous response.

54 

55- `project_ids: optional array of string`

56 

57 Return only usage for these projects.

58 

59- `user_ids: optional array of string`

60 

61 Return only usage for these users.

62 

63- `vector_store_ids: optional array of string`

64 

65 Return only usage for these vector stores.

66 

67### Returns

68 

69- `data: array of object { end_time, object, results, start_time }`

70 

71 - `end_time: number`

72 

73 - `object: "bucket"`

74 

75 - `"bucket"`

76 

77 - `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`

78 

79 - `OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }`

80 

81 The aggregated completions usage details of the specific time bucket.

82 

83 - `input_tokens: number`

84 

85 The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.

86 

87 - `num_model_requests: number`

88 

89 The count of requests made to the model.

90 

91 - `object: "organization.usage.completions.result"`

92 

93 - `"organization.usage.completions.result"`

94 

95 - `output_tokens: number`

96 

97 The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.

98 

99 - `api_key_id: optional string`

100 

101 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

102 

103 - `batch: optional boolean`

104 

105 When `group_by=batch`, this field tells whether the grouped usage result is batch or not.

106 

107 - `input_audio_tokens: optional number`

108 

109 The aggregated number of audio input tokens used, including cached tokens.

110 

111 - `input_cached_tokens: optional number`

112 

113 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.

114 

115 - `model: optional string`

116 

117 When `group_by=model`, this field provides the model name of the grouped usage result.

118 

119 - `output_audio_tokens: optional number`

120 

121 The aggregated number of audio output tokens used.

122 

123 - `project_id: optional string`

124 

125 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

126 

127 - `service_tier: optional string`

128 

129 When `group_by=service_tier`, this field provides the service tier of the grouped usage result.

130 

131 - `user_id: optional string`

132 

133 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

134 

135 - `OrganizationUsageEmbeddingsResult object { input_tokens, num_model_requests, object, 4 more }`

136 

137 The aggregated embeddings usage details of the specific time bucket.

138 

139 - `input_tokens: number`

140 

141 The aggregated number of input tokens used.

142 

143 - `num_model_requests: number`

144 

145 The count of requests made to the model.

146 

147 - `object: "organization.usage.embeddings.result"`

148 

149 - `"organization.usage.embeddings.result"`

150 

151 - `api_key_id: optional string`

152 

153 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

154 

155 - `model: optional string`

156 

157 When `group_by=model`, this field provides the model name of the grouped usage result.

158 

159 - `project_id: optional string`

160 

161 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

162 

163 - `user_id: optional string`

164 

165 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

166 

167 - `OrganizationUsageModerationsResult object { input_tokens, num_model_requests, object, 4 more }`

168 

169 The aggregated moderations usage details of the specific time bucket.

170 

171 - `input_tokens: number`

172 

173 The aggregated number of input tokens used.

174 

175 - `num_model_requests: number`

176 

177 The count of requests made to the model.

178 

179 - `object: "organization.usage.moderations.result"`

180 

181 - `"organization.usage.moderations.result"`

182 

183 - `api_key_id: optional string`

184 

185 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

186 

187 - `model: optional string`

188 

189 When `group_by=model`, this field provides the model name of the grouped usage result.

190 

191 - `project_id: optional string`

192 

193 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

194 

195 - `user_id: optional string`

196 

197 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

198 

199 - `OrganizationUsageImagesResult object { images, num_model_requests, object, 6 more }`

200 

201 The aggregated images usage details of the specific time bucket.

202 

203 - `images: number`

204 

205 The number of images processed.

206 

207 - `num_model_requests: number`

208 

209 The count of requests made to the model.

210 

211 - `object: "organization.usage.images.result"`

212 

213 - `"organization.usage.images.result"`

214 

215 - `api_key_id: optional string`

216 

217 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

218 

219 - `model: optional string`

220 

221 When `group_by=model`, this field provides the model name of the grouped usage result.

222 

223 - `project_id: optional string`

224 

225 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

226 

227 - `size: optional string`

228 

229 When `group_by=size`, this field provides the image size of the grouped usage result.

230 

231 - `source: optional string`

232 

233 When `group_by=source`, this field provides the source of the grouped usage result, possible values are `image.generation`, `image.edit`, `image.variation`.

234 

235 - `user_id: optional string`

236 

237 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

238 

239 - `OrganizationUsageAudioSpeechesResult object { characters, num_model_requests, object, 4 more }`

240 

241 The aggregated audio speeches usage details of the specific time bucket.

242 

243 - `characters: number`

244 

245 The number of characters processed.

246 

247 - `num_model_requests: number`

248 

249 The count of requests made to the model.

250 

251 - `object: "organization.usage.audio_speeches.result"`

252 

253 - `"organization.usage.audio_speeches.result"`

254 

255 - `api_key_id: optional string`

256 

257 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

258 

259 - `model: optional string`

260 

261 When `group_by=model`, this field provides the model name of the grouped usage result.

262 

263 - `project_id: optional string`

264 

265 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

266 

267 - `user_id: optional string`

268 

269 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

270 

271 - `OrganizationUsageAudioTranscriptionsResult object { num_model_requests, object, seconds, 4 more }`

272 

273 The aggregated audio transcriptions usage details of the specific time bucket.

274 

275 - `num_model_requests: number`

276 

277 The count of requests made to the model.

278 

279 - `object: "organization.usage.audio_transcriptions.result"`

280 

281 - `"organization.usage.audio_transcriptions.result"`

282 

283 - `seconds: number`

284 

285 The number of seconds processed.

286 

287 - `api_key_id: optional string`

288 

289 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

290 

291 - `model: optional string`

292 

293 When `group_by=model`, this field provides the model name of the grouped usage result.

294 

295 - `project_id: optional string`

296 

297 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

298 

299 - `user_id: optional string`

300 

301 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

302 

303 - `OrganizationUsageVectorStoresResult object { object, usage_bytes, project_id }`

304 

305 The aggregated vector stores usage details of the specific time bucket.

306 

307 - `object: "organization.usage.vector_stores.result"`

308 

309 - `"organization.usage.vector_stores.result"`

310 

311 - `usage_bytes: number`

312 

313 The vector stores usage in bytes.

314 

315 - `project_id: optional string`

316 

317 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

318 

319 - `OrganizationUsageCodeInterpreterSessionsResult object { num_sessions, object, project_id }`

320 

321 The aggregated code interpreter sessions usage details of the specific time bucket.

322 

323 - `num_sessions: number`

324 

325 The number of code interpreter sessions.

326 

327 - `object: "organization.usage.code_interpreter_sessions.result"`

328 

329 - `"organization.usage.code_interpreter_sessions.result"`

330 

331 - `project_id: optional string`

332 

333 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

334 

335 - `OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }`

336 

337 The aggregated file search calls usage details of the specific time bucket.

338 

339 - `num_requests: number`

340 

341 The count of file search calls.

342 

343 - `object: "organization.usage.file_searches.result"`

344 

345 - `"organization.usage.file_searches.result"`

346 

347 - `api_key_id: optional string`

348 

349 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

350 

351 - `project_id: optional string`

352 

353 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

354 

355 - `user_id: optional string`

356 

357 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

358 

359 - `vector_store_id: optional string`

360 

361 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

362 

363 - `OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }`

364 

365 The aggregated web search calls usage details of the specific time bucket.

366 

367 - `num_model_requests: number`

368 

369 The count of model requests.

370 

371 - `num_requests: number`

372 

373 The count of web search calls.

374 

375 - `object: "organization.usage.web_searches.result"`

376 

377 - `"organization.usage.web_searches.result"`

378 

379 - `api_key_id: optional string`

380 

381 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

382 

383 - `context_level: optional string`

384 

385 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

386 

387 - `model: optional string`

388 

389 When `group_by=model`, this field provides the model name of the grouped usage result.

390 

391 - `project_id: optional string`

392 

393 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

394 

395 - `user_id: optional string`

396 

397 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

398 

399 - `OrganizationCostsResult object { object, amount, api_key_id, 3 more }`

400 

401 The aggregated costs details of the specific time bucket.

402 

403 - `object: "organization.costs.result"`

404 

405 - `"organization.costs.result"`

406 

407 - `amount: optional object { currency, value }`

408 

409 The monetary value in its associated currency.

410 

411 - `currency: optional string`

412 

413 Lowercase ISO-4217 currency e.g. "usd"

414 

415 - `value: optional number`

416 

417 The numeric value of the cost.

418 

419 - `api_key_id: optional string`

420 

421 When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result.

422 

423 - `line_item: optional string`

424 

425 When `group_by=line_item`, this field provides the line item of the grouped costs result.

426 

427 - `project_id: optional string`

428 

429 When `group_by=project_id`, this field provides the project ID of the grouped costs result.

430 

431 - `quantity: optional number`

432 

433 When `group_by=line_item`, this field provides the quantity of the grouped costs result.

434 

435 - `start_time: number`

436 

437- `has_more: boolean`

438 

439- `next_page: string`

440 

441- `object: "page"`

442 

443 - `"page"`

444 

445### Example

446 

447```http

448curl https://api.openai.com/v1/organization/usage/file_search_calls \

449 -H "Authorization: Bearer $OPENAI_ADMIN_KEY"

450```

451 

452#### Response

453 

454```json

455{

456 "data": [

457 {

458 "end_time": 0,

459 "object": "bucket",

460 "results": [

461 {

462 "input_tokens": 0,

463 "num_model_requests": 0,

464 "object": "organization.usage.completions.result",

465 "output_tokens": 0,

466 "api_key_id": "api_key_id",

467 "batch": true,

468 "input_audio_tokens": 0,

469 "input_cached_tokens": 0,

470 "model": "model",

471 "output_audio_tokens": 0,

472 "project_id": "project_id",

473 "service_tier": "service_tier",

474 "user_id": "user_id"

475 }

476 ],

477 "start_time": 0

478 }

479 ],

480 "has_more": true,

481 "next_page": "next_page",

482 "object": "page"

483}

484```

485 

486### Example

487 

488```http

489curl "https://api.openai.com/v1/organization/usage/file_search_calls?start_time=1730419200&limit=1" \

490-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \

491-H "Content-Type: application/json"

492```

493 

494#### Response

495 

496```json

497{

498 "object": "page",

499 "data": [

500 {

501 "object": "bucket",

502 "start_time": 1730419200,

503 "end_time": 1730505600,

504 "results": [

505 {

506 "object": "organization.usage.file_searches.result",

507 "num_requests": 2,

508 "project_id": null,

509 "user_id": null,

510 "api_key_id": null,

511 "vector_store_id": null

512 }

513 ]

514 }

515 ],

516 "has_more": false,

517 "next_page": null

518}

519```

Details

102 102 

103 - `"bucket"`103 - `"bucket"`

104 104 

105 - `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 6 more`105 - `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`

106 106 

107 - `OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }`107 - `OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }`

108 108 


360 360 

361 When `group_by=project_id`, this field provides the project ID of the grouped usage result.361 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

362 362 

363 - `OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }`

364 

365 The aggregated file search calls usage details of the specific time bucket.

366 

367 - `num_requests: number`

368 

369 The count of file search calls.

370 

371 - `object: "organization.usage.file_searches.result"`

372 

373 - `"organization.usage.file_searches.result"`

374 

375 - `api_key_id: optional string`

376 

377 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

378 

379 - `project_id: optional string`

380 

381 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

382 

383 - `user_id: optional string`

384 

385 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

386 

387 - `vector_store_id: optional string`

388 

389 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

390 

391 - `OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }`

392 

393 The aggregated web search calls usage details of the specific time bucket.

394 

395 - `num_model_requests: number`

396 

397 The count of model requests.

398 

399 - `num_requests: number`

400 

401 The count of web search calls.

402 

403 - `object: "organization.usage.web_searches.result"`

404 

405 - `"organization.usage.web_searches.result"`

406 

407 - `api_key_id: optional string`

408 

409 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

410 

411 - `context_level: optional string`

412 

413 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

414 

415 - `model: optional string`

416 

417 When `group_by=model`, this field provides the model name of the grouped usage result.

418 

419 - `project_id: optional string`

420 

421 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

422 

423 - `user_id: optional string`

424 

425 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

426 

363 - `OrganizationCostsResult object { object, amount, api_key_id, 3 more }`427 - `OrganizationCostsResult object { object, amount, api_key_id, 3 more }`

364 428 

365 The aggregated costs details of the specific time bucket.429 The aggregated costs details of the specific time bucket.

Details

74 74 

75 - `"bucket"`75 - `"bucket"`

76 76 

77 - `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 6 more`77 - `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`

78 78 

79 - `OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }`79 - `OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }`

80 80 


332 332 

333 When `group_by=project_id`, this field provides the project ID of the grouped usage result.333 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

334 334 

335 - `OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }`

336 

337 The aggregated file search calls usage details of the specific time bucket.

338 

339 - `num_requests: number`

340 

341 The count of file search calls.

342 

343 - `object: "organization.usage.file_searches.result"`

344 

345 - `"organization.usage.file_searches.result"`

346 

347 - `api_key_id: optional string`

348 

349 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

350 

351 - `project_id: optional string`

352 

353 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

354 

355 - `user_id: optional string`

356 

357 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

358 

359 - `vector_store_id: optional string`

360 

361 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

362 

363 - `OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }`

364 

365 The aggregated web search calls usage details of the specific time bucket.

366 

367 - `num_model_requests: number`

368 

369 The count of model requests.

370 

371 - `num_requests: number`

372 

373 The count of web search calls.

374 

375 - `object: "organization.usage.web_searches.result"`

376 

377 - `"organization.usage.web_searches.result"`

378 

379 - `api_key_id: optional string`

380 

381 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

382 

383 - `context_level: optional string`

384 

385 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

386 

387 - `model: optional string`

388 

389 When `group_by=model`, this field provides the model name of the grouped usage result.

390 

391 - `project_id: optional string`

392 

393 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

394 

395 - `user_id: optional string`

396 

397 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

398 

335 - `OrganizationCostsResult object { object, amount, api_key_id, 3 more }`399 - `OrganizationCostsResult object { object, amount, api_key_id, 3 more }`

336 400 

337 The aggregated costs details of the specific time bucket.401 The aggregated costs details of the specific time bucket.

Details

56 56 

57 - `"bucket"`57 - `"bucket"`

58 58 

59 - `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 6 more`59 - `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`

60 60 

61 - `OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }`61 - `OrganizationUsageCompletionsResult object { input_tokens, num_model_requests, object, 10 more }`

62 62 


314 314 

315 When `group_by=project_id`, this field provides the project ID of the grouped usage result.315 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

316 316 

317 - `OrganizationUsageFileSearchesResult object { num_requests, object, api_key_id, 3 more }`

318 

319 The aggregated file search calls usage details of the specific time bucket.

320 

321 - `num_requests: number`

322 

323 The count of file search calls.

324 

325 - `object: "organization.usage.file_searches.result"`

326 

327 - `"organization.usage.file_searches.result"`

328 

329 - `api_key_id: optional string`

330 

331 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

332 

333 - `project_id: optional string`

334 

335 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

336 

337 - `user_id: optional string`

338 

339 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

340 

341 - `vector_store_id: optional string`

342 

343 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

344 

345 - `OrganizationUsageWebSearchesResult object { num_model_requests, num_requests, object, 5 more }`

346 

347 The aggregated web search calls usage details of the specific time bucket.

348 

349 - `num_model_requests: number`

350 

351 The count of model requests.

352 

353 - `num_requests: number`

354 

355 The count of web search calls.

356 

357 - `object: "organization.usage.web_searches.result"`

358 

359 - `"organization.usage.web_searches.result"`

360 

361 - `api_key_id: optional string`

362 

363 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

364 

365 - `context_level: optional string`

366 

367 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

368 

369 - `model: optional string`

370 

371 When `group_by=model`, this field provides the model name of the grouped usage result.

372 

373 - `project_id: optional string`

374 

375 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

376 

377 - `user_id: optional string`

378 

379 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

380 

317 - `OrganizationCostsResult object { object, amount, api_key_id, 3 more }`381 - `OrganizationCostsResult object { object, amount, api_key_id, 3 more }`

318 382 

319 The aggregated costs details of the specific time bucket.383 The aggregated costs details of the specific time bucket.

Details

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```

Details

6 6 

7### Body Parameters7### Body Parameters

8 8 

9- `items: optional array of EasyInputMessage or object { content, role, status, type } or ResponseOutputMessage or 25 more`9- `items: optional array of EasyInputMessage or object { content, role, status, type } or ResponseOutputMessage or 26 more`

10 10 

11 Initial items to include in the conversation context. You may add up to 20 items at a time.11 Initial items to include in the conversation context. You may add up to 20 items at a time.

12 12 


2800 2800 

2801 The namespace of the custom tool being called.2801 The namespace of the custom tool being called.

2802 2802 

2803 - `CompactionTrigger object { type }`

2804 

2805 Compacts the current context. Must be the final input item.

2806 

2807 - `type: "compaction_trigger"`

2808 

2809 The type of the item. Always `compaction_trigger`.

2810 

2811 - `"compaction_trigger"`

2812 

2803 - `ItemReference object { id, type }`2813 - `ItemReference object { id, type }`

2804 2814 

2805 An internal identifier for an item to reference.2815 An internal identifier for an item to reference.

Details

33 33 

34### Body Parameters34### Body Parameters

35 35 

36- `items: array of EasyInputMessage or object { content, role, status, type } or ResponseOutputMessage or 25 more`36- `items: array of EasyInputMessage or object { content, role, status, type } or ResponseOutputMessage or 26 more`

37 37 

38 The items to add to the conversation. You may add up to 20 items at a time.38 The items to add to the conversation. You may add up to 20 items at a time.

39 39 


2827 2827 

2828 The namespace of the custom tool being called.2828 The namespace of the custom tool being called.

2829 2829 

2830 - `CompactionTrigger object { type }`

2831 

2832 Compacts the current context. Must be the final input item.

2833 

2834 - `type: "compaction_trigger"`

2835 

2836 The type of the item. Always `compaction_trigger`.

2837 

2838 - `"compaction_trigger"`

2839 

2830 - `ItemReference object { id, type }`2840 - `ItemReference object { id, type }`

2831 2841 

2832 An internal identifier for an item to reference.2842 An internal identifier for an item to reference.

Details

82 82 

83 - `"content_filter"`83 - `"content_filter"`

84 84 

85 - `instructions: string or array of EasyInputMessage or object { content, role, status, type } or ResponseOutputMessage or 25 more`85 - `instructions: string or array of EasyInputMessage or object { content, role, status, type } or ResponseOutputMessage or 26 more`

86 86 

87 A system (or developer) message inserted into the model's context.87 A system (or developer) message inserted into the model's context.

88 88 


95 A text input to the model, equivalent to a text input with the95 A text input to the model, equivalent to a text input with the

96 `developer` role.96 `developer` role.

97 97 

98 - `InputItemList = array of EasyInputMessage or object { content, role, status, type } or ResponseOutputMessage or 25 more`98 - `InputItemList = array of EasyInputMessage or object { content, role, status, type } or ResponseOutputMessage or 26 more`

99 99 

100 A list of one or many input items to the model, containing100 A list of one or many input items to the model, containing

101 different content types.101 different content types.


2890 2890 

2891 The namespace of the custom tool being called.2891 The namespace of the custom tool being called.

2892 2892 

2893 - `CompactionTrigger object { type }`

2894 

2895 Compacts the current context. Must be the final input item.

2896 

2897 - `type: "compaction_trigger"`

2898 

2899 The type of the item. Always `compaction_trigger`.

2900 

2901 - `"compaction_trigger"`

2902 

2893 - `ItemReference object { id, type }`2903 - `ItemReference object { id, type }`

2894 2904 

2895 An internal identifier for an item to reference.2905 An internal identifier for an item to reference.

Details

202 202 

203 - `string`203 - `string`

204 204 

205- `input: optional string or array of EasyInputMessage or object { content, role, status, type } or ResponseOutputMessage or 25 more`205- `input: optional string or array of EasyInputMessage or object { content, role, status, type } or ResponseOutputMessage or 26 more`

206 206 

207 Text, image, or file inputs to the model, used to generate a response207 Text, image, or file inputs to the model, used to generate a response

208 208 


210 210 

211 A text input to the model, equivalent to a text input with the `user` role.211 A text input to the model, equivalent to a text input with the `user` role.

212 212 

213 - `array of EasyInputMessage or object { content, role, status, type } or ResponseOutputMessage or 25 more`213 - `array of EasyInputMessage or object { content, role, status, type } or ResponseOutputMessage or 26 more`

214 214 

215 A list of one or many input items to the model, containing different content types.215 A list of one or many input items to the model, containing different content types.

216 216 


3004 3004 

3005 The namespace of the custom tool being called.3005 The namespace of the custom tool being called.

3006 3006 

3007 - `CompactionTrigger object { type }`

3008 

3009 Compacts the current context. Must be the final input item.

3010 

3011 - `type: "compaction_trigger"`

3012 

3013 The type of the item. Always `compaction_trigger`.

3014 

3015 - `"compaction_trigger"`

3016 

3007 - `ItemReference object { id, type }`3017 - `ItemReference object { id, type }`

3008 3018 

3009 An internal identifier for an item to reference.3019 An internal identifier for an item to reference.

Details

74 74 

75 - `"message.output_text.logprobs"`75 - `"message.output_text.logprobs"`

76 76 

77- `input: optional string or array of EasyInputMessage or object { content, role, status, type } or ResponseOutputMessage or 25 more`77- `input: optional string or array of EasyInputMessage or object { content, role, status, type } or ResponseOutputMessage or 26 more`

78 78 

79 Text, image, or file inputs to the model, used to generate a response.79 Text, image, or file inputs to the model, used to generate a response.

80 80 


91 A text input to the model, equivalent to a text input with the91 A text input to the model, equivalent to a text input with the

92 `user` role.92 `user` role.

93 93 

94 - `InputItemList = array of EasyInputMessage or object { content, role, status, type } or ResponseOutputMessage or 25 more`94 - `InputItemList = array of EasyInputMessage or object { content, role, status, type } or ResponseOutputMessage or 26 more`

95 95 

96 A list of one or many input items to the model, containing96 A list of one or many input items to the model, containing

97 different content types.97 different content types.


2886 2886 

2887 The namespace of the custom tool being called.2887 The namespace of the custom tool being called.

2888 2888 

2889 - `CompactionTrigger object { type }`

2890 

2891 Compacts the current context. Must be the final input item.

2892 

2893 - `type: "compaction_trigger"`

2894 

2895 The type of the item. Always `compaction_trigger`.

2896 

2897 - `"compaction_trigger"`

2898 

2889 - `ItemReference object { id, type }`2899 - `ItemReference object { id, type }`

2890 2900 

2891 An internal identifier for an item to reference.2901 An internal identifier for an item to reference.


4399 4409 

4400 - `"content_filter"`4410 - `"content_filter"`

4401 4411 

4402 - `instructions: string or array of EasyInputMessage or object { content, role, status, type } or ResponseOutputMessage or 25 more`4412 - `instructions: string or array of EasyInputMessage or object { content, role, status, type } or ResponseOutputMessage or 26 more`

4403 4413 

4404 A system (or developer) message inserted into the model's context.4414 A system (or developer) message inserted into the model's context.

4405 4415 


4412 A text input to the model, equivalent to a text input with the4422 A text input to the model, equivalent to a text input with the

4413 `developer` role.4423 `developer` role.

4414 4424 

4415 - `InputItemList = array of EasyInputMessage or object { content, role, status, type } or ResponseOutputMessage or 25 more`4425 - `InputItemList = array of EasyInputMessage or object { content, role, status, type } or ResponseOutputMessage or 26 more`

4416 4426 

4417 A list of one or many input items to the model, containing4427 A list of one or many input items to the model, containing

4418 different content types.4428 different content types.


7207 7217 

7208 The namespace of the custom tool being called.7218 The namespace of the custom tool being called.

7209 7219 

7220 - `CompactionTrigger object { type }`

7221 

7222 Compacts the current context. Must be the final input item.

7223 

7224 - `type: "compaction_trigger"`

7225 

7226 The type of the item. Always `compaction_trigger`.

7227 

7228 - `"compaction_trigger"`

7229 

7210 - `ItemReference object { id, type }`7230 - `ItemReference object { id, type }`

7211 7231 

7212 An internal identifier for an item to reference.7232 An internal identifier for an item to reference.

Details

126 126 

127 - `"content_filter"`127 - `"content_filter"`

128 128 

129 - `instructions: string or array of EasyInputMessage or object { content, role, status, type } or ResponseOutputMessage or 25 more`129 - `instructions: string or array of EasyInputMessage or object { content, role, status, type } or ResponseOutputMessage or 26 more`

130 130 

131 A system (or developer) message inserted into the model's context.131 A system (or developer) message inserted into the model's context.

132 132 


139 A text input to the model, equivalent to a text input with the139 A text input to the model, equivalent to a text input with the

140 `developer` role.140 `developer` role.

141 141 

142 - `InputItemList = array of EasyInputMessage or object { content, role, status, type } or ResponseOutputMessage or 25 more`142 - `InputItemList = array of EasyInputMessage or object { content, role, status, type } or ResponseOutputMessage or 26 more`

143 143 

144 A list of one or many input items to the model, containing144 A list of one or many input items to the model, containing

145 different content types.145 different content types.


2934 2934 

2935 The namespace of the custom tool being called.2935 The namespace of the custom tool being called.

2936 2936 

2937 - `CompactionTrigger object { type }`

2938 

2939 Compacts the current context. Must be the final input item.

2940 

2941 - `type: "compaction_trigger"`

2942 

2943 The type of the item. Always `compaction_trigger`.

2944 

2945 - `"compaction_trigger"`

2946 

2937 - `ItemReference object { id, type }`2947 - `ItemReference object { id, type }`

2938 2948 

2939 An internal identifier for an item to reference.2949 An internal identifier for an item to reference.

Details

25 25 

26 The unique ID of the conversation.26 The unique ID of the conversation.

27 27 

28- `input: optional string or array of EasyInputMessage or object { content, role, status, type } or ResponseOutputMessage or 25 more`28- `input: optional string or array of EasyInputMessage or object { content, role, status, type } or ResponseOutputMessage or 26 more`

29 29 

30 Text, image, or file inputs to the model, used to generate a response30 Text, image, or file inputs to the model, used to generate a response

31 31 


33 33 

34 A text input to the model, equivalent to a text input with the `user` role.34 A text input to the model, equivalent to a text input with the `user` role.

35 35 

36 - `array of EasyInputMessage or object { content, role, status, type } or ResponseOutputMessage or 25 more`36 - `array of EasyInputMessage or object { content, role, status, type } or ResponseOutputMessage or 26 more`

37 37 

38 A list of one or many input items to the model, containing different content types.38 A list of one or many input items to the model, containing different content types.

39 39 


2827 2827 

2828 The namespace of the custom tool being called.2828 The namespace of the custom tool being called.

2829 2829 

2830 - `CompactionTrigger object { type }`

2831 

2832 Compacts the current context. Must be the final input item.

2833 

2834 - `type: "compaction_trigger"`

2835 

2836 The type of the item. Always `compaction_trigger`.

2837 

2838 - `"compaction_trigger"`

2839 

2830 - `ItemReference object { id, type }`2840 - `ItemReference object { id, type }`

2831 2841 

2832 An internal identifier for an item to reference.2842 An internal identifier for an item to reference.

Details

22 22 

23- `projects: Array[Project{ id, role}]`23- `projects: Array[Project{ id, role}]`

24 24 

25 An array of projects to which membership is granted at the same time the org invite is accepted. If omitted, the user will be invited to the default project for compatibility with legacy behavior.25 An array of projects to which membership is granted at the same time the org invite is accepted. If omitted, the user will be invited to the default project for compatibility with legacy behavior. If empty list is passed, the user will not be invited to any projects, including the default one.

26 26 

27 - `id: String`27 - `id: String`

28 28 

Details

1## Retrieve project hosted tool permissions

2 

3`admin.organization.projects.hosted_tool_permissions.retrieve(project_id) -> ProjectHostedToolPermissions`

4 

5**get** `/organization/projects/{project_id}/hosted_tool_permissions`

6 

7Returns hosted tool permissions for a project.

8 

9### Parameters

10 

11- `project_id: String`

12 

13### Returns

14 

15- `class ProjectHostedToolPermissions`

16 

17 Represents hosted tool permissions for a project.

18 

19 - `code_interpreter: CodeInterpreter{ enabled}`

20 

21 Permission state for a single hosted tool on a project.

22 

23 - `enabled: bool`

24 

25 Whether the hosted tool is enabled for the project.

26 

27 - `file_search: FileSearch{ enabled}`

28 

29 Permission state for a single hosted tool on a project.

30 

31 - `enabled: bool`

32 

33 Whether the hosted tool is enabled for the project.

34 

35 - `image_generation: ImageGeneration{ enabled}`

36 

37 Permission state for a single hosted tool on a project.

38 

39 - `enabled: bool`

40 

41 Whether the hosted tool is enabled for the project.

42 

43 - `mcp: Mcp{ enabled}`

44 

45 Permission state for a single hosted tool on a project.

46 

47 - `enabled: bool`

48 

49 Whether the hosted tool is enabled for the project.

50 

51 - `web_search: WebSearch{ enabled}`

52 

53 Permission state for a single hosted tool on a project.

54 

55 - `enabled: bool`

56 

57 Whether the hosted tool is enabled for the project.

58 

59### Example

60 

61```ruby

62require "openai"

63 

64openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")

65 

66project_hosted_tool_permissions = openai.admin.organization.projects.hosted_tool_permissions.retrieve("project_id")

67 

68puts(project_hosted_tool_permissions)

69```

70 

71#### Response

72 

73```json

74{

75 "code_interpreter": {

76 "enabled": true

77 },

78 "file_search": {

79 "enabled": true

80 },

81 "image_generation": {

82 "enabled": true

83 },

84 "mcp": {

85 "enabled": true

86 },

87 "web_search": {

88 "enabled": true

89 }

90}

91```

Details

1## Modify project hosted tool permissions

2 

3`admin.organization.projects.hosted_tool_permissions.update(project_id, **kwargs) -> ProjectHostedToolPermissions`

4 

5**post** `/organization/projects/{project_id}/hosted_tool_permissions`

6 

7Updates hosted tool permissions for a project.

8 

9### Parameters

10 

11- `project_id: String`

12 

13- `code_interpreter: CodeInterpreter{ enabled}`

14 

15 The code interpreter permission update.

16 

17 - `enabled: bool`

18 

19 Whether to enable the hosted tool for the project.

20 

21- `file_search: FileSearch{ enabled}`

22 

23 The file search permission update.

24 

25 - `enabled: bool`

26 

27 Whether to enable the hosted tool for the project.

28 

29- `image_generation: ImageGeneration{ enabled}`

30 

31 The image generation permission update.

32 

33 - `enabled: bool`

34 

35 Whether to enable the hosted tool for the project.

36 

37- `mcp: Mcp{ enabled}`

38 

39 The MCP permission update.

40 

41 - `enabled: bool`

42 

43 Whether to enable the hosted tool for the project.

44 

45- `web_search: WebSearch{ enabled}`

46 

47 The web search permission update.

48 

49 - `enabled: bool`

50 

51 Whether to enable the hosted tool for the project.

52 

53### Returns

54 

55- `class ProjectHostedToolPermissions`

56 

57 Represents hosted tool permissions for a project.

58 

59 - `code_interpreter: CodeInterpreter{ enabled}`

60 

61 Permission state for a single hosted tool on a project.

62 

63 - `enabled: bool`

64 

65 Whether the hosted tool is enabled for the project.

66 

67 - `file_search: FileSearch{ enabled}`

68 

69 Permission state for a single hosted tool on a project.

70 

71 - `enabled: bool`

72 

73 Whether the hosted tool is enabled for the project.

74 

75 - `image_generation: ImageGeneration{ enabled}`

76 

77 Permission state for a single hosted tool on a project.

78 

79 - `enabled: bool`

80 

81 Whether the hosted tool is enabled for the project.

82 

83 - `mcp: Mcp{ enabled}`

84 

85 Permission state for a single hosted tool on a project.

86 

87 - `enabled: bool`

88 

89 Whether the hosted tool is enabled for the project.

90 

91 - `web_search: WebSearch{ enabled}`

92 

93 Permission state for a single hosted tool on a project.

94 

95 - `enabled: bool`

96 

97 Whether the hosted tool is enabled for the project.

98 

99### Example

100 

101```ruby

102require "openai"

103 

104openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")

105 

106project_hosted_tool_permissions = openai.admin.organization.projects.hosted_tool_permissions.update("project_id")

107 

108puts(project_hosted_tool_permissions)

109```

110 

111#### Response

112 

113```json

114{

115 "code_interpreter": {

116 "enabled": true

117 },

118 "file_search": {

119 "enabled": true

120 },

121 "image_generation": {

122 "enabled": true

123 },

124 "mcp": {

125 "enabled": true

126 },

127 "web_search": {

128 "enabled": true

129 }

130}

131```

Details

1## Delete project model permissions

2 

3`admin.organization.projects.model_permissions.delete(project_id) -> ProjectModelPermissionsDeleted`

4 

5**delete** `/organization/projects/{project_id}/model_permissions`

6 

7Deletes model permissions for a project.

8 

9### Parameters

10 

11- `project_id: String`

12 

13### Returns

14 

15- `class ProjectModelPermissionsDeleted`

16 

17 Confirmation payload returned after deleting project model permissions.

18 

19 - `deleted: bool`

20 

21 Whether the project model permissions were deleted.

22 

23 - `object: :"project.model_permissions.deleted"`

24 

25 The object type, which is always `project.model_permissions.deleted`.

26 

27 - `:"project.model_permissions.deleted"`

28 

29### Example

30 

31```ruby

32require "openai"

33 

34openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")

35 

36project_model_permissions_deleted = openai.admin.organization.projects.model_permissions.delete("project_id")

37 

38puts(project_model_permissions_deleted)

39```

40 

41#### Response

42 

43```json

44{

45 "deleted": true,

46 "object": "project.model_permissions.deleted"

47}

48```

Details

1## Retrieve project model permissions

2 

3`admin.organization.projects.model_permissions.retrieve(project_id) -> ProjectModelPermissions`

4 

5**get** `/organization/projects/{project_id}/model_permissions`

6 

7Returns model permissions for a project.

8 

9### Parameters

10 

11- `project_id: String`

12 

13### Returns

14 

15- `class ProjectModelPermissions`

16 

17 Represents the model allowlist or denylist policy for a project.

18 

19 - `mode: :allow_list | :deny_list`

20 

21 Whether the project uses an allowlist or a denylist.

22 

23 - `:allow_list`

24 

25 - `:deny_list`

26 

27 - `model_ids: Array[String]`

28 

29 The model IDs included in the model permissions policy.

30 

31 - `object: :"project.model_permissions"`

32 

33 The object type, which is always `project.model_permissions`.

34 

35 - `:"project.model_permissions"`

36 

37### Example

38 

39```ruby

40require "openai"

41 

42openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")

43 

44project_model_permissions = openai.admin.organization.projects.model_permissions.retrieve("project_id")

45 

46puts(project_model_permissions)

47```

48 

49#### Response

50 

51```json

52{

53 "mode": "allow_list",

54 "model_ids": [

55 "string"

56 ],

57 "object": "project.model_permissions"

58}

59```

Details

1## Modify project model permissions

2 

3`admin.organization.projects.model_permissions.update(project_id, **kwargs) -> ProjectModelPermissions`

4 

5**post** `/organization/projects/{project_id}/model_permissions`

6 

7Updates model permissions for a project.

8 

9### Parameters

10 

11- `project_id: String`

12 

13- `mode: :allow_list | :deny_list`

14 

15 The model permissions mode to apply.

16 

17 - `:allow_list`

18 

19 - `:deny_list`

20 

21- `model_ids: Array[String]`

22 

23 The model IDs included in this permissions policy.

24 

25### Returns

26 

27- `class ProjectModelPermissions`

28 

29 Represents the model allowlist or denylist policy for a project.

30 

31 - `mode: :allow_list | :deny_list`

32 

33 Whether the project uses an allowlist or a denylist.

34 

35 - `:allow_list`

36 

37 - `:deny_list`

38 

39 - `model_ids: Array[String]`

40 

41 The model IDs included in the model permissions policy.

42 

43 - `object: :"project.model_permissions"`

44 

45 The object type, which is always `project.model_permissions`.

46 

47 - `:"project.model_permissions"`

48 

49### Example

50 

51```ruby

52require "openai"

53 

54openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")

55 

56project_model_permissions = openai.admin.organization.projects.model_permissions.update(

57 "project_id",

58 mode: :allow_list,

59 model_ids: ["string"]

60)

61 

62puts(project_model_permissions)

63```

64 

65#### Response

66 

67```json

68{

69 "mode": "allow_list",

70 "model_ids": [

71 "string"

72 ],

73 "object": "project.model_permissions"

74}

75```

Details

78 78 

79 - `:bucket`79 - `:bucket`

80 80 

81 - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 6 more]`81 - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]`

82 82 

83 - `class OrganizationUsageCompletionsResult`83 - `class OrganizationUsageCompletionsResult`

84 84 


336 336 

337 When `group_by=project_id`, this field provides the project ID of the grouped usage result.337 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

338 338 

339 - `class OrganizationUsageFileSearchesResult`

340 

341 The aggregated file search calls usage details of the specific time bucket.

342 

343 - `num_requests: Integer`

344 

345 The count of file search calls.

346 

347 - `object: :"organization.usage.file_searches.result"`

348 

349 - `:"organization.usage.file_searches.result"`

350 

351 - `api_key_id: String`

352 

353 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

354 

355 - `project_id: String`

356 

357 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

358 

359 - `user_id: String`

360 

361 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

362 

363 - `vector_store_id: String`

364 

365 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

366 

367 - `class OrganizationUsageWebSearchesResult`

368 

369 The aggregated web search calls usage details of the specific time bucket.

370 

371 - `num_model_requests: Integer`

372 

373 The count of model requests.

374 

375 - `num_requests: Integer`

376 

377 The count of web search calls.

378 

379 - `object: :"organization.usage.web_searches.result"`

380 

381 - `:"organization.usage.web_searches.result"`

382 

383 - `api_key_id: String`

384 

385 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

386 

387 - `context_level: String`

388 

389 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

390 

391 - `model: String`

392 

393 When `group_by=model`, this field provides the model name of the grouped usage result.

394 

395 - `project_id: String`

396 

397 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

398 

399 - `user_id: String`

400 

401 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

402 

339 - `class OrganizationCostsResult`403 - `class OrganizationCostsResult`

340 404 

341 The aggregated costs details of the specific time bucket.405 The aggregated costs details of the specific time bucket.

Details

78 78 

79 - `:bucket`79 - `:bucket`

80 80 

81 - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 6 more]`81 - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]`

82 82 

83 - `class OrganizationUsageCompletionsResult`83 - `class OrganizationUsageCompletionsResult`

84 84 


336 336 

337 When `group_by=project_id`, this field provides the project ID of the grouped usage result.337 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

338 338 

339 - `class OrganizationUsageFileSearchesResult`

340 

341 The aggregated file search calls usage details of the specific time bucket.

342 

343 - `num_requests: Integer`

344 

345 The count of file search calls.

346 

347 - `object: :"organization.usage.file_searches.result"`

348 

349 - `:"organization.usage.file_searches.result"`

350 

351 - `api_key_id: String`

352 

353 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

354 

355 - `project_id: String`

356 

357 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

358 

359 - `user_id: String`

360 

361 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

362 

363 - `vector_store_id: String`

364 

365 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

366 

367 - `class OrganizationUsageWebSearchesResult`

368 

369 The aggregated web search calls usage details of the specific time bucket.

370 

371 - `num_model_requests: Integer`

372 

373 The count of model requests.

374 

375 - `num_requests: Integer`

376 

377 The count of web search calls.

378 

379 - `object: :"organization.usage.web_searches.result"`

380 

381 - `:"organization.usage.web_searches.result"`

382 

383 - `api_key_id: String`

384 

385 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

386 

387 - `context_level: String`

388 

389 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

390 

391 - `model: String`

392 

393 When `group_by=model`, this field provides the model name of the grouped usage result.

394 

395 - `project_id: String`

396 

397 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

398 

399 - `user_id: String`

400 

401 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

402 

339 - `class OrganizationCostsResult`403 - `class OrganizationCostsResult`

340 404 

341 The aggregated costs details of the specific time bucket.405 The aggregated costs details of the specific time bucket.

Details

60 60 

61 - `:bucket`61 - `:bucket`

62 62 

63 - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 6 more]`63 - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]`

64 64 

65 - `class OrganizationUsageCompletionsResult`65 - `class OrganizationUsageCompletionsResult`

66 66 


318 318 

319 When `group_by=project_id`, this field provides the project ID of the grouped usage result.319 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

320 320 

321 - `class OrganizationUsageFileSearchesResult`

322 

323 The aggregated file search calls usage details of the specific time bucket.

324 

325 - `num_requests: Integer`

326 

327 The count of file search calls.

328 

329 - `object: :"organization.usage.file_searches.result"`

330 

331 - `:"organization.usage.file_searches.result"`

332 

333 - `api_key_id: String`

334 

335 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

336 

337 - `project_id: String`

338 

339 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

340 

341 - `user_id: String`

342 

343 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

344 

345 - `vector_store_id: String`

346 

347 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

348 

349 - `class OrganizationUsageWebSearchesResult`

350 

351 The aggregated web search calls usage details of the specific time bucket.

352 

353 - `num_model_requests: Integer`

354 

355 The count of model requests.

356 

357 - `num_requests: Integer`

358 

359 The count of web search calls.

360 

361 - `object: :"organization.usage.web_searches.result"`

362 

363 - `:"organization.usage.web_searches.result"`

364 

365 - `api_key_id: String`

366 

367 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

368 

369 - `context_level: String`

370 

371 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

372 

373 - `model: String`

374 

375 When `group_by=model`, this field provides the model name of the grouped usage result.

376 

377 - `project_id: String`

378 

379 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

380 

381 - `user_id: String`

382 

383 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

384 

321 - `class OrganizationCostsResult`385 - `class OrganizationCostsResult`

322 386 

323 The aggregated costs details of the specific time bucket.387 The aggregated costs details of the specific time bucket.

Details

86 86 

87 - `:bucket`87 - `:bucket`

88 88 

89 - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 6 more]`89 - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]`

90 90 

91 - `class OrganizationUsageCompletionsResult`91 - `class OrganizationUsageCompletionsResult`

92 92 


344 344 

345 When `group_by=project_id`, this field provides the project ID of the grouped usage result.345 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

346 346 

347 - `class OrganizationUsageFileSearchesResult`

348 

349 The aggregated file search calls usage details of the specific time bucket.

350 

351 - `num_requests: Integer`

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: 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: String`

364 

365 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

366 

367 - `user_id: String`

368 

369 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

370 

371 - `vector_store_id: String`

372 

373 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

374 

375 - `class OrganizationUsageWebSearchesResult`

376 

377 The aggregated web search calls usage details of the specific time bucket.

378 

379 - `num_model_requests: Integer`

380 

381 The count of model requests.

382 

383 - `num_requests: Integer`

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: 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: String`

396 

397 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

398 

399 - `model: String`

400 

401 When `group_by=model`, this field provides the model name of the grouped usage result.

402 

403 - `project_id: String`

404 

405 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

406 

407 - `user_id: String`

408 

409 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

410 

347 - `class OrganizationCostsResult`411 - `class OrganizationCostsResult`

348 412 

349 The aggregated costs details of the specific time bucket.413 The aggregated costs details of the specific time bucket.

Details

60 60 

61 - `:bucket`61 - `:bucket`

62 62 

63 - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 6 more]`63 - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]`

64 64 

65 - `class OrganizationUsageCompletionsResult`65 - `class OrganizationUsageCompletionsResult`

66 66 


318 318 

319 When `group_by=project_id`, this field provides the project ID of the grouped usage result.319 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

320 320 

321 - `class OrganizationUsageFileSearchesResult`

322 

323 The aggregated file search calls usage details of the specific time bucket.

324 

325 - `num_requests: Integer`

326 

327 The count of file search calls.

328 

329 - `object: :"organization.usage.file_searches.result"`

330 

331 - `:"organization.usage.file_searches.result"`

332 

333 - `api_key_id: String`

334 

335 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

336 

337 - `project_id: String`

338 

339 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

340 

341 - `user_id: String`

342 

343 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

344 

345 - `vector_store_id: String`

346 

347 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

348 

349 - `class OrganizationUsageWebSearchesResult`

350 

351 The aggregated web search calls usage details of the specific time bucket.

352 

353 - `num_model_requests: Integer`

354 

355 The count of model requests.

356 

357 - `num_requests: Integer`

358 

359 The count of web search calls.

360 

361 - `object: :"organization.usage.web_searches.result"`

362 

363 - `:"organization.usage.web_searches.result"`

364 

365 - `api_key_id: String`

366 

367 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

368 

369 - `context_level: String`

370 

371 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

372 

373 - `model: String`

374 

375 When `group_by=model`, this field provides the model name of the grouped usage result.

376 

377 - `project_id: String`

378 

379 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

380 

381 - `user_id: String`

382 

383 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

384 

321 - `class OrganizationCostsResult`385 - `class OrganizationCostsResult`

322 386 

323 The aggregated costs details of the specific time bucket.387 The aggregated costs details of the specific time bucket.

Details

78 78 

79 - `:bucket`79 - `:bucket`

80 80 

81 - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 6 more]`81 - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]`

82 82 

83 - `class OrganizationUsageCompletionsResult`83 - `class OrganizationUsageCompletionsResult`

84 84 


336 336 

337 When `group_by=project_id`, this field provides the project ID of the grouped usage result.337 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

338 338 

339 - `class OrganizationUsageFileSearchesResult`

340 

341 The aggregated file search calls usage details of the specific time bucket.

342 

343 - `num_requests: Integer`

344 

345 The count of file search calls.

346 

347 - `object: :"organization.usage.file_searches.result"`

348 

349 - `:"organization.usage.file_searches.result"`

350 

351 - `api_key_id: String`

352 

353 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

354 

355 - `project_id: String`

356 

357 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

358 

359 - `user_id: String`

360 

361 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

362 

363 - `vector_store_id: String`

364 

365 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

366 

367 - `class OrganizationUsageWebSearchesResult`

368 

369 The aggregated web search calls usage details of the specific time bucket.

370 

371 - `num_model_requests: Integer`

372 

373 The count of model requests.

374 

375 - `num_requests: Integer`

376 

377 The count of web search calls.

378 

379 - `object: :"organization.usage.web_searches.result"`

380 

381 - `:"organization.usage.web_searches.result"`

382 

383 - `api_key_id: String`

384 

385 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

386 

387 - `context_level: String`

388 

389 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

390 

391 - `model: String`

392 

393 When `group_by=model`, this field provides the model name of the grouped usage result.

394 

395 - `project_id: String`

396 

397 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

398 

399 - `user_id: String`

400 

401 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

402 

339 - `class OrganizationCostsResult`403 - `class OrganizationCostsResult`

340 404 

341 The aggregated costs details of the specific time bucket.405 The aggregated costs details of the specific time bucket.

Details

1## File search calls

2 

3`admin.organization.usage.file_search_calls(**kwargs) -> UsageFileSearchCallsResponse`

4 

5**get** `/organization/usage/file_search_calls`

6 

7Get file search calls usage details for the organization.

8 

9### Parameters

10 

11- `start_time: Integer`

12 

13 Start time (Unix seconds) of the query time range, inclusive.

14 

15- `api_key_ids: Array[String]`

16 

17 Return only usage for these API keys.

18 

19- `bucket_width: :"1m" | :"1h" | :"1d"`

20 

21 Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`.

22 

23 - `:"1m"`

24 

25 - `:"1h"`

26 

27 - `:"1d"`

28 

29- `end_time: Integer`

30 

31 End time (Unix seconds) of the query time range, exclusive.

32 

33- `group_by: Array[:project_id | :user_id | :api_key_id | :vector_store_id]`

34 

35 Group the usage data by the specified fields. Support fields include `project_id`, `user_id`, `api_key_id`, `vector_store_id` or any combination of them.

36 

37 - `:project_id`

38 

39 - `:user_id`

40 

41 - `:api_key_id`

42 

43 - `:vector_store_id`

44 

45- `limit: Integer`

46 

47 Specifies the number of buckets to return.

48 

49 - `bucket_width=1d`: default: 7, max: 31

50 - `bucket_width=1h`: default: 24, max: 168

51 - `bucket_width=1m`: default: 60, max: 1440

52 

53- `page: String`

54 

55 A cursor for use in pagination. Corresponding to the `next_page` field from the previous response.

56 

57- `project_ids: Array[String]`

58 

59 Return only usage for these projects.

60 

61- `user_ids: Array[String]`

62 

63 Return only usage for these users.

64 

65- `vector_store_ids: Array[String]`

66 

67 Return only usage for these vector stores.

68 

69### Returns

70 

71- `class UsageFileSearchCallsResponse`

72 

73 - `data: Array[Data{ end_time, object, results, start_time}]`

74 

75 - `end_time: Integer`

76 

77 - `object: :bucket`

78 

79 - `:bucket`

80 

81 - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]`

82 

83 - `class OrganizationUsageCompletionsResult`

84 

85 The aggregated completions usage details of the specific time bucket.

86 

87 - `input_tokens: Integer`

88 

89 The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.

90 

91 - `num_model_requests: Integer`

92 

93 The count of requests made to the model.

94 

95 - `object: :"organization.usage.completions.result"`

96 

97 - `:"organization.usage.completions.result"`

98 

99 - `output_tokens: Integer`

100 

101 The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.

102 

103 - `api_key_id: String`

104 

105 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

106 

107 - `batch: bool`

108 

109 When `group_by=batch`, this field tells whether the grouped usage result is batch or not.

110 

111 - `input_audio_tokens: Integer`

112 

113 The aggregated number of audio input tokens used, including cached tokens.

114 

115 - `input_cached_tokens: Integer`

116 

117 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.

118 

119 - `model: String`

120 

121 When `group_by=model`, this field provides the model name of the grouped usage result.

122 

123 - `output_audio_tokens: Integer`

124 

125 The aggregated number of audio output tokens used.

126 

127 - `project_id: String`

128 

129 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

130 

131 - `service_tier: String`

132 

133 When `group_by=service_tier`, this field provides the service tier of the grouped usage result.

134 

135 - `user_id: String`

136 

137 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

138 

139 - `class OrganizationUsageEmbeddingsResult`

140 

141 The aggregated embeddings usage details of the specific time bucket.

142 

143 - `input_tokens: Integer`

144 

145 The aggregated number of input tokens used.

146 

147 - `num_model_requests: Integer`

148 

149 The count of requests made to the model.

150 

151 - `object: :"organization.usage.embeddings.result"`

152 

153 - `:"organization.usage.embeddings.result"`

154 

155 - `api_key_id: String`

156 

157 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

158 

159 - `model: String`

160 

161 When `group_by=model`, this field provides the model name of the grouped usage result.

162 

163 - `project_id: String`

164 

165 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

166 

167 - `user_id: String`

168 

169 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

170 

171 - `class OrganizationUsageModerationsResult`

172 

173 The aggregated moderations usage details of the specific time bucket.

174 

175 - `input_tokens: Integer`

176 

177 The aggregated number of input tokens used.

178 

179 - `num_model_requests: Integer`

180 

181 The count of requests made to the model.

182 

183 - `object: :"organization.usage.moderations.result"`

184 

185 - `:"organization.usage.moderations.result"`

186 

187 - `api_key_id: String`

188 

189 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

190 

191 - `model: String`

192 

193 When `group_by=model`, this field provides the model name of the grouped usage result.

194 

195 - `project_id: String`

196 

197 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

198 

199 - `user_id: String`

200 

201 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

202 

203 - `class OrganizationUsageImagesResult`

204 

205 The aggregated images usage details of the specific time bucket.

206 

207 - `images: Integer`

208 

209 The number of images processed.

210 

211 - `num_model_requests: Integer`

212 

213 The count of requests made to the model.

214 

215 - `object: :"organization.usage.images.result"`

216 

217 - `:"organization.usage.images.result"`

218 

219 - `api_key_id: String`

220 

221 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

222 

223 - `model: String`

224 

225 When `group_by=model`, this field provides the model name of the grouped usage result.

226 

227 - `project_id: String`

228 

229 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

230 

231 - `size: String`

232 

233 When `group_by=size`, this field provides the image size of the grouped usage result.

234 

235 - `source: String`

236 

237 When `group_by=source`, this field provides the source of the grouped usage result, possible values are `image.generation`, `image.edit`, `image.variation`.

238 

239 - `user_id: String`

240 

241 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

242 

243 - `class OrganizationUsageAudioSpeechesResult`

244 

245 The aggregated audio speeches usage details of the specific time bucket.

246 

247 - `characters: Integer`

248 

249 The number of characters processed.

250 

251 - `num_model_requests: Integer`

252 

253 The count of requests made to the model.

254 

255 - `object: :"organization.usage.audio_speeches.result"`

256 

257 - `:"organization.usage.audio_speeches.result"`

258 

259 - `api_key_id: String`

260 

261 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

262 

263 - `model: String`

264 

265 When `group_by=model`, this field provides the model name of the grouped usage result.

266 

267 - `project_id: String`

268 

269 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

270 

271 - `user_id: String`

272 

273 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

274 

275 - `class OrganizationUsageAudioTranscriptionsResult`

276 

277 The aggregated audio transcriptions usage details of the specific time bucket.

278 

279 - `num_model_requests: Integer`

280 

281 The count of requests made to the model.

282 

283 - `object: :"organization.usage.audio_transcriptions.result"`

284 

285 - `:"organization.usage.audio_transcriptions.result"`

286 

287 - `seconds: Integer`

288 

289 The number of seconds processed.

290 

291 - `api_key_id: String`

292 

293 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

294 

295 - `model: String`

296 

297 When `group_by=model`, this field provides the model name of the grouped usage result.

298 

299 - `project_id: String`

300 

301 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

302 

303 - `user_id: String`

304 

305 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

306 

307 - `class OrganizationUsageVectorStoresResult`

308 

309 The aggregated vector stores usage details of the specific time bucket.

310 

311 - `object: :"organization.usage.vector_stores.result"`

312 

313 - `:"organization.usage.vector_stores.result"`

314 

315 - `usage_bytes: Integer`

316 

317 The vector stores usage in bytes.

318 

319 - `project_id: String`

320 

321 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

322 

323 - `class OrganizationUsageCodeInterpreterSessionsResult`

324 

325 The aggregated code interpreter sessions usage details of the specific time bucket.

326 

327 - `num_sessions: Integer`

328 

329 The number of code interpreter sessions.

330 

331 - `object: :"organization.usage.code_interpreter_sessions.result"`

332 

333 - `:"organization.usage.code_interpreter_sessions.result"`

334 

335 - `project_id: String`

336 

337 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

338 

339 - `class OrganizationUsageFileSearchesResult`

340 

341 The aggregated file search calls usage details of the specific time bucket.

342 

343 - `num_requests: Integer`

344 

345 The count of file search calls.

346 

347 - `object: :"organization.usage.file_searches.result"`

348 

349 - `:"organization.usage.file_searches.result"`

350 

351 - `api_key_id: String`

352 

353 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

354 

355 - `project_id: String`

356 

357 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

358 

359 - `user_id: String`

360 

361 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

362 

363 - `vector_store_id: String`

364 

365 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

366 

367 - `class OrganizationUsageWebSearchesResult`

368 

369 The aggregated web search calls usage details of the specific time bucket.

370 

371 - `num_model_requests: Integer`

372 

373 The count of model requests.

374 

375 - `num_requests: Integer`

376 

377 The count of web search calls.

378 

379 - `object: :"organization.usage.web_searches.result"`

380 

381 - `:"organization.usage.web_searches.result"`

382 

383 - `api_key_id: String`

384 

385 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

386 

387 - `context_level: String`

388 

389 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

390 

391 - `model: String`

392 

393 When `group_by=model`, this field provides the model name of the grouped usage result.

394 

395 - `project_id: String`

396 

397 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

398 

399 - `user_id: String`

400 

401 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

402 

403 - `class OrganizationCostsResult`

404 

405 The aggregated costs details of the specific time bucket.

406 

407 - `object: :"organization.costs.result"`

408 

409 - `:"organization.costs.result"`

410 

411 - `amount: Amount{ currency, value}`

412 

413 The monetary value in its associated currency.

414 

415 - `currency: String`

416 

417 Lowercase ISO-4217 currency e.g. "usd"

418 

419 - `value: Float`

420 

421 The numeric value of the cost.

422 

423 - `api_key_id: String`

424 

425 When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result.

426 

427 - `line_item: String`

428 

429 When `group_by=line_item`, this field provides the line item of the grouped costs result.

430 

431 - `project_id: String`

432 

433 When `group_by=project_id`, this field provides the project ID of the grouped costs result.

434 

435 - `quantity: Float`

436 

437 When `group_by=line_item`, this field provides the quantity of the grouped costs result.

438 

439 - `start_time: Integer`

440 

441 - `has_more: bool`

442 

443 - `next_page: String`

444 

445 - `object: :page`

446 

447 - `:page`

448 

449### Example

450 

451```ruby

452require "openai"

453 

454openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")

455 

456response = openai.admin.organization.usage.file_search_calls(start_time: 0)

457 

458puts(response)

459```

460 

461#### Response

462 

463```json

464{

465 "data": [

466 {

467 "end_time": 0,

468 "object": "bucket",

469 "results": [

470 {

471 "input_tokens": 0,

472 "num_model_requests": 0,

473 "object": "organization.usage.completions.result",

474 "output_tokens": 0,

475 "api_key_id": "api_key_id",

476 "batch": true,

477 "input_audio_tokens": 0,

478 "input_cached_tokens": 0,

479 "model": "model",

480 "output_audio_tokens": 0,

481 "project_id": "project_id",

482 "service_tier": "service_tier",

483 "user_id": "user_id"

484 }

485 ],

486 "start_time": 0

487 }

488 ],

489 "has_more": true,

490 "next_page": "next_page",

491 "object": "page"

492}

493```

Details

106 106 

107 - `:bucket`107 - `:bucket`

108 108 

109 - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 6 more]`109 - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]`

110 110 

111 - `class OrganizationUsageCompletionsResult`111 - `class OrganizationUsageCompletionsResult`

112 112 


364 364 

365 When `group_by=project_id`, this field provides the project ID of the grouped usage result.365 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

366 366 

367 - `class OrganizationUsageFileSearchesResult`

368 

369 The aggregated file search calls usage details of the specific time bucket.

370 

371 - `num_requests: Integer`

372 

373 The count of file search calls.

374 

375 - `object: :"organization.usage.file_searches.result"`

376 

377 - `:"organization.usage.file_searches.result"`

378 

379 - `api_key_id: String`

380 

381 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

382 

383 - `project_id: String`

384 

385 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

386 

387 - `user_id: String`

388 

389 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

390 

391 - `vector_store_id: String`

392 

393 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

394 

395 - `class OrganizationUsageWebSearchesResult`

396 

397 The aggregated web search calls usage details of the specific time bucket.

398 

399 - `num_model_requests: Integer`

400 

401 The count of model requests.

402 

403 - `num_requests: Integer`

404 

405 The count of web search calls.

406 

407 - `object: :"organization.usage.web_searches.result"`

408 

409 - `:"organization.usage.web_searches.result"`

410 

411 - `api_key_id: String`

412 

413 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

414 

415 - `context_level: String`

416 

417 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

418 

419 - `model: String`

420 

421 When `group_by=model`, this field provides the model name of the grouped usage result.

422 

423 - `project_id: String`

424 

425 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

426 

427 - `user_id: String`

428 

429 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

430 

367 - `class OrganizationCostsResult`431 - `class OrganizationCostsResult`

368 432 

369 The aggregated costs details of the specific time bucket.433 The aggregated costs details of the specific time bucket.

Details

78 78 

79 - `:bucket`79 - `:bucket`

80 80 

81 - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 6 more]`81 - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]`

82 82 

83 - `class OrganizationUsageCompletionsResult`83 - `class OrganizationUsageCompletionsResult`

84 84 


336 336 

337 When `group_by=project_id`, this field provides the project ID of the grouped usage result.337 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

338 338 

339 - `class OrganizationUsageFileSearchesResult`

340 

341 The aggregated file search calls usage details of the specific time bucket.

342 

343 - `num_requests: Integer`

344 

345 The count of file search calls.

346 

347 - `object: :"organization.usage.file_searches.result"`

348 

349 - `:"organization.usage.file_searches.result"`

350 

351 - `api_key_id: String`

352 

353 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

354 

355 - `project_id: String`

356 

357 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

358 

359 - `user_id: String`

360 

361 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

362 

363 - `vector_store_id: String`

364 

365 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

366 

367 - `class OrganizationUsageWebSearchesResult`

368 

369 The aggregated web search calls usage details of the specific time bucket.

370 

371 - `num_model_requests: Integer`

372 

373 The count of model requests.

374 

375 - `num_requests: Integer`

376 

377 The count of web search calls.

378 

379 - `object: :"organization.usage.web_searches.result"`

380 

381 - `:"organization.usage.web_searches.result"`

382 

383 - `api_key_id: String`

384 

385 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

386 

387 - `context_level: String`

388 

389 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

390 

391 - `model: String`

392 

393 When `group_by=model`, this field provides the model name of the grouped usage result.

394 

395 - `project_id: String`

396 

397 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

398 

399 - `user_id: String`

400 

401 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

402 

339 - `class OrganizationCostsResult`403 - `class OrganizationCostsResult`

340 404 

341 The aggregated costs details of the specific time bucket.405 The aggregated costs details of the specific time bucket.

Details

60 60 

61 - `:bucket`61 - `:bucket`

62 62 

63 - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 6 more]`63 - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]`

64 64 

65 - `class OrganizationUsageCompletionsResult`65 - `class OrganizationUsageCompletionsResult`

66 66 


318 318 

319 When `group_by=project_id`, this field provides the project ID of the grouped usage result.319 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

320 320 

321 - `class OrganizationUsageFileSearchesResult`

322 

323 The aggregated file search calls usage details of the specific time bucket.

324 

325 - `num_requests: Integer`

326 

327 The count of file search calls.

328 

329 - `object: :"organization.usage.file_searches.result"`

330 

331 - `:"organization.usage.file_searches.result"`

332 

333 - `api_key_id: String`

334 

335 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

336 

337 - `project_id: String`

338 

339 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

340 

341 - `user_id: String`

342 

343 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

344 

345 - `vector_store_id: String`

346 

347 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

348 

349 - `class OrganizationUsageWebSearchesResult`

350 

351 The aggregated web search calls usage details of the specific time bucket.

352 

353 - `num_model_requests: Integer`

354 

355 The count of model requests.

356 

357 - `num_requests: Integer`

358 

359 The count of web search calls.

360 

361 - `object: :"organization.usage.web_searches.result"`

362 

363 - `:"organization.usage.web_searches.result"`

364 

365 - `api_key_id: String`

366 

367 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

368 

369 - `context_level: String`

370 

371 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

372 

373 - `model: String`

374 

375 When `group_by=model`, this field provides the model name of the grouped usage result.

376 

377 - `project_id: String`

378 

379 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

380 

381 - `user_id: String`

382 

383 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

384 

321 - `class OrganizationCostsResult`385 - `class OrganizationCostsResult`

322 386 

323 The aggregated costs details of the specific time bucket.387 The aggregated costs details of the specific time bucket.

Details

1## Web search calls

2 

3`admin.organization.usage.web_search_calls(**kwargs) -> UsageWebSearchCallsResponse`

4 

5**get** `/organization/usage/web_search_calls`

6 

7Get web search calls usage details for the organization.

8 

9### Parameters

10 

11- `start_time: Integer`

12 

13 Start time (Unix seconds) of the query time range, inclusive.

14 

15- `api_key_ids: Array[String]`

16 

17 Return only usage for these API keys.

18 

19- `bucket_width: :"1m" | :"1h" | :"1d"`

20 

21 Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`.

22 

23 - `:"1m"`

24 

25 - `:"1h"`

26 

27 - `:"1d"`

28 

29- `context_levels: Array[:low | :medium | :high]`

30 

31 Return only web search usage for these context levels.

32 

33 - `:low`

34 

35 - `:medium`

36 

37 - `:high`

38 

39- `end_time: Integer`

40 

41 End time (Unix seconds) of the query time range, exclusive.

42 

43- `group_by: Array[:project_id | :user_id | :api_key_id | 2 more]`

44 

45 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.

46 

47 - `:project_id`

48 

49 - `:user_id`

50 

51 - `:api_key_id`

52 

53 - `:model`

54 

55 - `:context_level`

56 

57- `limit: Integer`

58 

59 Specifies the number of buckets to return.

60 

61 - `bucket_width=1d`: default: 7, max: 31

62 - `bucket_width=1h`: default: 24, max: 168

63 - `bucket_width=1m`: default: 60, max: 1440

64 

65- `models: Array[String]`

66 

67 Return only usage for these models.

68 

69- `page: String`

70 

71 A cursor for use in pagination. Corresponding to the `next_page` field from the previous response.

72 

73- `project_ids: Array[String]`

74 

75 Return only usage for these projects.

76 

77- `user_ids: Array[String]`

78 

79 Return only usage for these users.

80 

81### Returns

82 

83- `class UsageWebSearchCallsResponse`

84 

85 - `data: Array[Data{ end_time, object, results, start_time}]`

86 

87 - `end_time: Integer`

88 

89 - `object: :bucket`

90 

91 - `:bucket`

92 

93 - `results: Array[OrganizationUsageCompletionsResult{ input_tokens, num_model_requests, object, 10 more} | OrganizationUsageEmbeddingsResult{ input_tokens, num_model_requests, object, 4 more} | OrganizationUsageModerationsResult{ input_tokens, num_model_requests, object, 4 more} | 8 more]`

94 

95 - `class OrganizationUsageCompletionsResult`

96 

97 The aggregated completions usage details of the specific time bucket.

98 

99 - `input_tokens: Integer`

100 

101 The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.

102 

103 - `num_model_requests: Integer`

104 

105 The count of requests made to the model.

106 

107 - `object: :"organization.usage.completions.result"`

108 

109 - `:"organization.usage.completions.result"`

110 

111 - `output_tokens: Integer`

112 

113 The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.

114 

115 - `api_key_id: String`

116 

117 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

118 

119 - `batch: bool`

120 

121 When `group_by=batch`, this field tells whether the grouped usage result is batch or not.

122 

123 - `input_audio_tokens: Integer`

124 

125 The aggregated number of audio input tokens used, including cached tokens.

126 

127 - `input_cached_tokens: Integer`

128 

129 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.

130 

131 - `model: String`

132 

133 When `group_by=model`, this field provides the model name of the grouped usage result.

134 

135 - `output_audio_tokens: Integer`

136 

137 The aggregated number of audio output tokens used.

138 

139 - `project_id: String`

140 

141 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

142 

143 - `service_tier: String`

144 

145 When `group_by=service_tier`, this field provides the service tier of the grouped usage result.

146 

147 - `user_id: String`

148 

149 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

150 

151 - `class OrganizationUsageEmbeddingsResult`

152 

153 The aggregated embeddings usage details of the specific time bucket.

154 

155 - `input_tokens: Integer`

156 

157 The aggregated number of input tokens used.

158 

159 - `num_model_requests: Integer`

160 

161 The count of requests made to the model.

162 

163 - `object: :"organization.usage.embeddings.result"`

164 

165 - `:"organization.usage.embeddings.result"`

166 

167 - `api_key_id: String`

168 

169 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

170 

171 - `model: String`

172 

173 When `group_by=model`, this field provides the model name of the grouped usage result.

174 

175 - `project_id: String`

176 

177 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

178 

179 - `user_id: String`

180 

181 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

182 

183 - `class OrganizationUsageModerationsResult`

184 

185 The aggregated moderations usage details of the specific time bucket.

186 

187 - `input_tokens: Integer`

188 

189 The aggregated number of input tokens used.

190 

191 - `num_model_requests: Integer`

192 

193 The count of requests made to the model.

194 

195 - `object: :"organization.usage.moderations.result"`

196 

197 - `:"organization.usage.moderations.result"`

198 

199 - `api_key_id: String`

200 

201 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

202 

203 - `model: String`

204 

205 When `group_by=model`, this field provides the model name of the grouped usage result.

206 

207 - `project_id: String`

208 

209 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

210 

211 - `user_id: String`

212 

213 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

214 

215 - `class OrganizationUsageImagesResult`

216 

217 The aggregated images usage details of the specific time bucket.

218 

219 - `images: Integer`

220 

221 The number of images processed.

222 

223 - `num_model_requests: Integer`

224 

225 The count of requests made to the model.

226 

227 - `object: :"organization.usage.images.result"`

228 

229 - `:"organization.usage.images.result"`

230 

231 - `api_key_id: String`

232 

233 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

234 

235 - `model: String`

236 

237 When `group_by=model`, this field provides the model name of the grouped usage result.

238 

239 - `project_id: String`

240 

241 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

242 

243 - `size: String`

244 

245 When `group_by=size`, this field provides the image size of the grouped usage result.

246 

247 - `source: String`

248 

249 When `group_by=source`, this field provides the source of the grouped usage result, possible values are `image.generation`, `image.edit`, `image.variation`.

250 

251 - `user_id: String`

252 

253 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

254 

255 - `class OrganizationUsageAudioSpeechesResult`

256 

257 The aggregated audio speeches usage details of the specific time bucket.

258 

259 - `characters: Integer`

260 

261 The number of characters processed.

262 

263 - `num_model_requests: Integer`

264 

265 The count of requests made to the model.

266 

267 - `object: :"organization.usage.audio_speeches.result"`

268 

269 - `:"organization.usage.audio_speeches.result"`

270 

271 - `api_key_id: String`

272 

273 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

274 

275 - `model: String`

276 

277 When `group_by=model`, this field provides the model name of the grouped usage result.

278 

279 - `project_id: String`

280 

281 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

282 

283 - `user_id: String`

284 

285 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

286 

287 - `class OrganizationUsageAudioTranscriptionsResult`

288 

289 The aggregated audio transcriptions usage details of the specific time bucket.

290 

291 - `num_model_requests: Integer`

292 

293 The count of requests made to the model.

294 

295 - `object: :"organization.usage.audio_transcriptions.result"`

296 

297 - `:"organization.usage.audio_transcriptions.result"`

298 

299 - `seconds: Integer`

300 

301 The number of seconds processed.

302 

303 - `api_key_id: String`

304 

305 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

306 

307 - `model: String`

308 

309 When `group_by=model`, this field provides the model name of the grouped usage result.

310 

311 - `project_id: String`

312 

313 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

314 

315 - `user_id: String`

316 

317 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

318 

319 - `class OrganizationUsageVectorStoresResult`

320 

321 The aggregated vector stores usage details of the specific time bucket.

322 

323 - `object: :"organization.usage.vector_stores.result"`

324 

325 - `:"organization.usage.vector_stores.result"`

326 

327 - `usage_bytes: Integer`

328 

329 The vector stores usage in bytes.

330 

331 - `project_id: String`

332 

333 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

334 

335 - `class OrganizationUsageCodeInterpreterSessionsResult`

336 

337 The aggregated code interpreter sessions usage details of the specific time bucket.

338 

339 - `num_sessions: Integer`

340 

341 The number of code interpreter sessions.

342 

343 - `object: :"organization.usage.code_interpreter_sessions.result"`

344 

345 - `:"organization.usage.code_interpreter_sessions.result"`

346 

347 - `project_id: String`

348 

349 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

350 

351 - `class OrganizationUsageFileSearchesResult`

352 

353 The aggregated file search calls usage details of the specific time bucket.

354 

355 - `num_requests: Integer`

356 

357 The count of file search calls.

358 

359 - `object: :"organization.usage.file_searches.result"`

360 

361 - `:"organization.usage.file_searches.result"`

362 

363 - `api_key_id: String`

364 

365 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

366 

367 - `project_id: String`

368 

369 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

370 

371 - `user_id: String`

372 

373 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

374 

375 - `vector_store_id: String`

376 

377 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

378 

379 - `class OrganizationUsageWebSearchesResult`

380 

381 The aggregated web search calls usage details of the specific time bucket.

382 

383 - `num_model_requests: Integer`

384 

385 The count of model requests.

386 

387 - `num_requests: Integer`

388 

389 The count of web search calls.

390 

391 - `object: :"organization.usage.web_searches.result"`

392 

393 - `:"organization.usage.web_searches.result"`

394 

395 - `api_key_id: String`

396 

397 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

398 

399 - `context_level: String`

400 

401 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

402 

403 - `model: String`

404 

405 When `group_by=model`, this field provides the model name of the grouped usage result.

406 

407 - `project_id: String`

408 

409 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

410 

411 - `user_id: String`

412 

413 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

414 

415 - `class OrganizationCostsResult`

416 

417 The aggregated costs details of the specific time bucket.

418 

419 - `object: :"organization.costs.result"`

420 

421 - `:"organization.costs.result"`

422 

423 - `amount: Amount{ currency, value}`

424 

425 The monetary value in its associated currency.

426 

427 - `currency: String`

428 

429 Lowercase ISO-4217 currency e.g. "usd"

430 

431 - `value: Float`

432 

433 The numeric value of the cost.

434 

435 - `api_key_id: String`

436 

437 When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result.

438 

439 - `line_item: String`

440 

441 When `group_by=line_item`, this field provides the line item of the grouped costs result.

442 

443 - `project_id: String`

444 

445 When `group_by=project_id`, this field provides the project ID of the grouped costs result.

446 

447 - `quantity: Float`

448 

449 When `group_by=line_item`, this field provides the quantity of the grouped costs result.

450 

451 - `start_time: Integer`

452 

453 - `has_more: bool`

454 

455 - `next_page: String`

456 

457 - `object: :page`

458 

459 - `:page`

460 

461### Example

462 

463```ruby

464require "openai"

465 

466openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")

467 

468response = openai.admin.organization.usage.web_search_calls(start_time: 0)

469 

470puts(response)

471```

472 

473#### Response

474 

475```json

476{

477 "data": [

478 {

479 "end_time": 0,

480 "object": "bucket",

481 "results": [

482 {

483 "input_tokens": 0,

484 "num_model_requests": 0,

485 "object": "organization.usage.completions.result",

486 "output_tokens": 0,

487 "api_key_id": "api_key_id",

488 "batch": true,

489 "input_audio_tokens": 0,

490 "input_cached_tokens": 0,

491 "model": "model",

492 "output_audio_tokens": 0,

493 "project_id": "project_id",

494 "service_tier": "service_tier",

495 "user_id": "user_id"

496 }

497 ],

498 "start_time": 0

499 }

500 ],

501 "has_more": true,

502 "next_page": "next_page",

503 "object": "page"

504}

505```

Details

2952 2952 

2953 The namespace of the custom tool being called.2953 The namespace of the custom tool being called.

2954 2954 

2955 - `class CompactionTrigger`

2956 

2957 Compacts the current context. Must be the final input item.

2958 

2959 - `type: :compaction_trigger`

2960 

2961 The type of the item. Always `compaction_trigger`.

2962 

2963 - `:compaction_trigger`

2964 

2955 - `class ItemReference`2965 - `class ItemReference`

2956 2966 

2957 An internal identifier for an item to reference.2967 An internal identifier for an item to reference.

Details

2954 2954 

2955 The namespace of the custom tool being called.2955 The namespace of the custom tool being called.

2956 2956 

2957 - `class CompactionTrigger`

2958 

2959 Compacts the current context. Must be the final input item.

2960 

2961 - `type: :compaction_trigger`

2962 

2963 The type of the item. Always `compaction_trigger`.

2964 

2965 - `:compaction_trigger`

2966 

2957 - `class ItemReference`2967 - `class ItemReference`

2958 2968 

2959 An internal identifier for an item to reference.2969 An internal identifier for an item to reference.

Details

3042 3042 

3043 The namespace of the custom tool being called.3043 The namespace of the custom tool being called.

3044 3044 

3045 - `class CompactionTrigger`

3046 

3047 Compacts the current context. Must be the final input item.

3048 

3049 - `type: :compaction_trigger`

3050 

3051 The type of the item. Always `compaction_trigger`.

3052 

3053 - `:compaction_trigger`

3054 

3045 - `class ItemReference`3055 - `class ItemReference`

3046 3056 

3047 An internal identifier for an item to reference.3057 An internal identifier for an item to reference.

Details

3156 3156 

3157 The namespace of the custom tool being called.3157 The namespace of the custom tool being called.

3158 3158 

3159 - `class CompactionTrigger`

3160 

3161 Compacts the current context. Must be the final input item.

3162 

3163 - `type: :compaction_trigger`

3164 

3165 The type of the item. Always `compaction_trigger`.

3166 

3167 - `:compaction_trigger`

3168 

3159 - `class ItemReference`3169 - `class ItemReference`

3160 3170 

3161 An internal identifier for an item to reference.3171 An internal identifier for an item to reference.

Details

3038 3038 

3039 The namespace of the custom tool being called.3039 The namespace of the custom tool being called.

3040 3040 

3041 - `class CompactionTrigger`

3042 

3043 Compacts the current context. Must be the final input item.

3044 

3045 - `type: :compaction_trigger`

3046 

3047 The type of the item. Always `compaction_trigger`.

3048 

3049 - `:compaction_trigger`

3050 

3041 - `class ItemReference`3051 - `class ItemReference`

3042 3052 

3043 An internal identifier for an item to reference.3053 An internal identifier for an item to reference.


6849 6859 

6850 The namespace of the custom tool being called.6860 The namespace of the custom tool being called.

6851 6861 

6862 - `class CompactionTrigger`

6863 

6864 Compacts the current context. Must be the final input item.

6865 

6866 - `type: :compaction_trigger`

6867 

6868 The type of the item. Always `compaction_trigger`.

6869 

6870 - `:compaction_trigger`

6871 

6852 - `class ItemReference`6872 - `class ItemReference`

6853 6873 

6854 An internal identifier for an item to reference.6874 An internal identifier for an item to reference.

Details

3082 3082 

3083 The namespace of the custom tool being called.3083 The namespace of the custom tool being called.

3084 3084 

3085 - `class CompactionTrigger`

3086 

3087 Compacts the current context. Must be the final input item.

3088 

3089 - `type: :compaction_trigger`

3090 

3091 The type of the item. Always `compaction_trigger`.

3092 

3093 - `:compaction_trigger`

3094 

3085 - `class ItemReference`3095 - `class ItemReference`

3086 3096 

3087 An internal identifier for an item to reference.3097 An internal identifier for an item to reference.

Details

2979 2979 

2980 The namespace of the custom tool being called.2980 The namespace of the custom tool being called.

2981 2981 

2982 - `class CompactionTrigger`

2983 

2984 Compacts the current context. Must be the final input item.

2985 

2986 - `type: :compaction_trigger`

2987 

2988 The type of the item. Always `compaction_trigger`.

2989 

2990 - `:compaction_trigger`

2991 

2982 - `class ItemReference`2992 - `class ItemReference`

2983 2993 

2984 An internal identifier for an item to reference.2994 An internal identifier for an item to reference.

Details

24 24 

25 - `projects?: Array<Project>`25 - `projects?: Array<Project>`

26 26 

27 An array of projects to which membership is granted at the same time the org invite is accepted. If omitted, the user will be invited to the default project for compatibility with legacy behavior.27 An array of projects to which membership is granted at the same time the org invite is accepted. If omitted, the user will be invited to the default project for compatibility with legacy behavior. If empty list is passed, the user will not be invited to any projects, including the default one.

28 28 

29 - `id: string`29 - `id: string`

30 30 

Details

1## Retrieve project hosted tool permissions

2 

3`client.admin.organization.projects.hostedToolPermissions.retrieve(stringprojectID, RequestOptionsoptions?): ProjectHostedToolPermissions`

4 

5**get** `/organization/projects/{project_id}/hosted_tool_permissions`

6 

7Returns hosted tool permissions for a project.

8 

9### Parameters

10 

11- `projectID: string`

12 

13### Returns

14 

15- `ProjectHostedToolPermissions`

16 

17 Represents hosted tool permissions for a project.

18 

19 - `code_interpreter: CodeInterpreter`

20 

21 Permission state for a single hosted tool on a project.

22 

23 - `enabled: boolean`

24 

25 Whether the hosted tool is enabled for the project.

26 

27 - `file_search: FileSearch`

28 

29 Permission state for a single hosted tool on a project.

30 

31 - `enabled: boolean`

32 

33 Whether the hosted tool is enabled for the project.

34 

35 - `image_generation: ImageGeneration`

36 

37 Permission state for a single hosted tool on a project.

38 

39 - `enabled: boolean`

40 

41 Whether the hosted tool is enabled for the project.

42 

43 - `mcp: Mcp`

44 

45 Permission state for a single hosted tool on a project.

46 

47 - `enabled: boolean`

48 

49 Whether the hosted tool is enabled for the project.

50 

51 - `web_search: WebSearch`

52 

53 Permission state for a single hosted tool on a project.

54 

55 - `enabled: boolean`

56 

57 Whether the hosted tool is enabled for the project.

58 

59### Example

60 

61```typescript

62import OpenAI from 'openai';

63 

64const client = new OpenAI({

65 adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted

66});

67 

68const projectHostedToolPermissions =

69 await client.admin.organization.projects.hostedToolPermissions.retrieve('project_id');

70 

71console.log(projectHostedToolPermissions.code_interpreter);

72```

73 

74#### Response

75 

76```json

77{

78 "code_interpreter": {

79 "enabled": true

80 },

81 "file_search": {

82 "enabled": true

83 },

84 "image_generation": {

85 "enabled": true

86 },

87 "mcp": {

88 "enabled": true

89 },

90 "web_search": {

91 "enabled": true

92 }

93}

94```

Details

1## Modify project hosted tool permissions

2 

3`client.admin.organization.projects.hostedToolPermissions.update(stringprojectID, HostedToolPermissionUpdateParamsbody, RequestOptionsoptions?): ProjectHostedToolPermissions`

4 

5**post** `/organization/projects/{project_id}/hosted_tool_permissions`

6 

7Updates hosted tool permissions for a project.

8 

9### Parameters

10 

11- `projectID: string`

12 

13- `body: HostedToolPermissionUpdateParams`

14 

15 - `code_interpreter?: CodeInterpreter | null`

16 

17 The code interpreter permission update.

18 

19 - `enabled: boolean`

20 

21 Whether to enable the hosted tool for the project.

22 

23 - `file_search?: FileSearch | null`

24 

25 The file search permission update.

26 

27 - `enabled: boolean`

28 

29 Whether to enable the hosted tool for the project.

30 

31 - `image_generation?: ImageGeneration | null`

32 

33 The image generation permission update.

34 

35 - `enabled: boolean`

36 

37 Whether to enable the hosted tool for the project.

38 

39 - `mcp?: Mcp | null`

40 

41 The MCP permission update.

42 

43 - `enabled: boolean`

44 

45 Whether to enable the hosted tool for the project.

46 

47 - `web_search?: WebSearch | null`

48 

49 The web search permission update.

50 

51 - `enabled: boolean`

52 

53 Whether to enable the hosted tool for the project.

54 

55### Returns

56 

57- `ProjectHostedToolPermissions`

58 

59 Represents hosted tool permissions for a project.

60 

61 - `code_interpreter: CodeInterpreter`

62 

63 Permission state for a single hosted tool on a project.

64 

65 - `enabled: boolean`

66 

67 Whether the hosted tool is enabled for the project.

68 

69 - `file_search: FileSearch`

70 

71 Permission state for a single hosted tool on a project.

72 

73 - `enabled: boolean`

74 

75 Whether the hosted tool is enabled for the project.

76 

77 - `image_generation: ImageGeneration`

78 

79 Permission state for a single hosted tool on a project.

80 

81 - `enabled: boolean`

82 

83 Whether the hosted tool is enabled for the project.

84 

85 - `mcp: Mcp`

86 

87 Permission state for a single hosted tool on a project.

88 

89 - `enabled: boolean`

90 

91 Whether the hosted tool is enabled for the project.

92 

93 - `web_search: WebSearch`

94 

95 Permission state for a single hosted tool on a project.

96 

97 - `enabled: boolean`

98 

99 Whether the hosted tool is enabled for the project.

100 

101### Example

102 

103```typescript

104import OpenAI from 'openai';

105 

106const client = new OpenAI({

107 adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted

108});

109 

110const projectHostedToolPermissions =

111 await client.admin.organization.projects.hostedToolPermissions.update('project_id');

112 

113console.log(projectHostedToolPermissions.code_interpreter);

114```

115 

116#### Response

117 

118```json

119{

120 "code_interpreter": {

121 "enabled": true

122 },

123 "file_search": {

124 "enabled": true

125 },

126 "image_generation": {

127 "enabled": true

128 },

129 "mcp": {

130 "enabled": true

131 },

132 "web_search": {

133 "enabled": true

134 }

135}

136```

Details

1## Delete project model permissions

2 

3`client.admin.organization.projects.modelPermissions.delete(stringprojectID, RequestOptionsoptions?): ProjectModelPermissionsDeleted`

4 

5**delete** `/organization/projects/{project_id}/model_permissions`

6 

7Deletes model permissions for a project.

8 

9### Parameters

10 

11- `projectID: string`

12 

13### Returns

14 

15- `ProjectModelPermissionsDeleted`

16 

17 Confirmation payload returned after deleting project model permissions.

18 

19 - `deleted: boolean`

20 

21 Whether the project model permissions were deleted.

22 

23 - `object: "project.model_permissions.deleted"`

24 

25 The object type, which is always `project.model_permissions.deleted`.

26 

27 - `"project.model_permissions.deleted"`

28 

29### Example

30 

31```typescript

32import OpenAI from 'openai';

33 

34const client = new OpenAI({

35 adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted

36});

37 

38const projectModelPermissionsDeleted =

39 await client.admin.organization.projects.modelPermissions.delete('project_id');

40 

41console.log(projectModelPermissionsDeleted.deleted);

42```

43 

44#### Response

45 

46```json

47{

48 "deleted": true,

49 "object": "project.model_permissions.deleted"

50}

51```

Details

1## Retrieve project model permissions

2 

3`client.admin.organization.projects.modelPermissions.retrieve(stringprojectID, RequestOptionsoptions?): ProjectModelPermissions`

4 

5**get** `/organization/projects/{project_id}/model_permissions`

6 

7Returns model permissions for a project.

8 

9### Parameters

10 

11- `projectID: string`

12 

13### Returns

14 

15- `ProjectModelPermissions`

16 

17 Represents the model allowlist or denylist policy for a project.

18 

19 - `mode: "allow_list" | "deny_list"`

20 

21 Whether the project uses an allowlist or a denylist.

22 

23 - `"allow_list"`

24 

25 - `"deny_list"`

26 

27 - `model_ids: Array<string>`

28 

29 The model IDs included in the model permissions policy.

30 

31 - `object: "project.model_permissions"`

32 

33 The object type, which is always `project.model_permissions`.

34 

35 - `"project.model_permissions"`

36 

37### Example

38 

39```typescript

40import OpenAI from 'openai';

41 

42const client = new OpenAI({

43 adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted

44});

45 

46const projectModelPermissions = await client.admin.organization.projects.modelPermissions.retrieve(

47 'project_id',

48);

49 

50console.log(projectModelPermissions.model_ids);

51```

52 

53#### Response

54 

55```json

56{

57 "mode": "allow_list",

58 "model_ids": [

59 "string"

60 ],

61 "object": "project.model_permissions"

62}

63```

Details

1## Modify project model permissions

2 

3`client.admin.organization.projects.modelPermissions.update(stringprojectID, ModelPermissionUpdateParamsbody, RequestOptionsoptions?): ProjectModelPermissions`

4 

5**post** `/organization/projects/{project_id}/model_permissions`

6 

7Updates model permissions for a project.

8 

9### Parameters

10 

11- `projectID: string`

12 

13- `body: ModelPermissionUpdateParams`

14 

15 - `mode: "allow_list" | "deny_list"`

16 

17 The model permissions mode to apply.

18 

19 - `"allow_list"`

20 

21 - `"deny_list"`

22 

23 - `model_ids: Array<string>`

24 

25 The model IDs included in this permissions policy.

26 

27### Returns

28 

29- `ProjectModelPermissions`

30 

31 Represents the model allowlist or denylist policy for a project.

32 

33 - `mode: "allow_list" | "deny_list"`

34 

35 Whether the project uses an allowlist or a denylist.

36 

37 - `"allow_list"`

38 

39 - `"deny_list"`

40 

41 - `model_ids: Array<string>`

42 

43 The model IDs included in the model permissions policy.

44 

45 - `object: "project.model_permissions"`

46 

47 The object type, which is always `project.model_permissions`.

48 

49 - `"project.model_permissions"`

50 

51### Example

52 

53```typescript

54import OpenAI from 'openai';

55 

56const client = new OpenAI({

57 adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted

58});

59 

60const projectModelPermissions = await client.admin.organization.projects.modelPermissions.update(

61 'project_id',

62 { mode: 'allow_list', model_ids: ['string'] },

63);

64 

65console.log(projectModelPermissions.model_ids);

66```

67 

68#### Response

69 

70```json

71{

72 "mode": "allow_list",

73 "model_ids": [

74 "string"

75 ],

76 "object": "project.model_permissions"

77}

78```

Details

80 80 

81 - `"bucket"`81 - `"bucket"`

82 82 

83 - `results: Array<OrganizationUsageCompletionsResult | OrganizationUsageEmbeddingsResult | OrganizationUsageModerationsResult | 6 more>`83 - `results: Array<OrganizationUsageCompletionsResult | OrganizationUsageEmbeddingsResult | OrganizationUsageModerationsResult | 8 more>`

84 84 

85 - `OrganizationUsageCompletionsResult`85 - `OrganizationUsageCompletionsResult`

86 86 


338 338 

339 When `group_by=project_id`, this field provides the project ID of the grouped usage result.339 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

340 340 

341 - `OrganizationUsageFileSearchesResult`

342 

343 The aggregated file search calls usage details of the specific time bucket.

344 

345 - `num_requests: number`

346 

347 The count of file search calls.

348 

349 - `object: "organization.usage.file_searches.result"`

350 

351 - `"organization.usage.file_searches.result"`

352 

353 - `api_key_id?: string | null`

354 

355 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

356 

357 - `project_id?: string | null`

358 

359 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

360 

361 - `user_id?: string | null`

362 

363 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

364 

365 - `vector_store_id?: string | null`

366 

367 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

368 

369 - `OrganizationUsageWebSearchesResult`

370 

371 The aggregated web search calls usage details of the specific time bucket.

372 

373 - `num_model_requests: number`

374 

375 The count of model requests.

376 

377 - `num_requests: number`

378 

379 The count of web search calls.

380 

381 - `object: "organization.usage.web_searches.result"`

382 

383 - `"organization.usage.web_searches.result"`

384 

385 - `api_key_id?: string | null`

386 

387 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

388 

389 - `context_level?: string | null`

390 

391 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

392 

393 - `model?: string | null`

394 

395 When `group_by=model`, this field provides the model name of the grouped usage result.

396 

397 - `project_id?: string | null`

398 

399 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

400 

401 - `user_id?: string | null`

402 

403 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

404 

341 - `OrganizationCostsResult`405 - `OrganizationCostsResult`

342 406 

343 The aggregated costs details of the specific time bucket.407 The aggregated costs details of the specific time bucket.

Details

80 80 

81 - `"bucket"`81 - `"bucket"`

82 82 

83 - `results: Array<OrganizationUsageCompletionsResult | OrganizationUsageEmbeddingsResult | OrganizationUsageModerationsResult | 6 more>`83 - `results: Array<OrganizationUsageCompletionsResult | OrganizationUsageEmbeddingsResult | OrganizationUsageModerationsResult | 8 more>`

84 84 

85 - `OrganizationUsageCompletionsResult`85 - `OrganizationUsageCompletionsResult`

86 86 


338 338 

339 When `group_by=project_id`, this field provides the project ID of the grouped usage result.339 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

340 340 

341 - `OrganizationUsageFileSearchesResult`

342 

343 The aggregated file search calls usage details of the specific time bucket.

344 

345 - `num_requests: number`

346 

347 The count of file search calls.

348 

349 - `object: "organization.usage.file_searches.result"`

350 

351 - `"organization.usage.file_searches.result"`

352 

353 - `api_key_id?: string | null`

354 

355 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

356 

357 - `project_id?: string | null`

358 

359 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

360 

361 - `user_id?: string | null`

362 

363 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

364 

365 - `vector_store_id?: string | null`

366 

367 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

368 

369 - `OrganizationUsageWebSearchesResult`

370 

371 The aggregated web search calls usage details of the specific time bucket.

372 

373 - `num_model_requests: number`

374 

375 The count of model requests.

376 

377 - `num_requests: number`

378 

379 The count of web search calls.

380 

381 - `object: "organization.usage.web_searches.result"`

382 

383 - `"organization.usage.web_searches.result"`

384 

385 - `api_key_id?: string | null`

386 

387 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

388 

389 - `context_level?: string | null`

390 

391 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

392 

393 - `model?: string | null`

394 

395 When `group_by=model`, this field provides the model name of the grouped usage result.

396 

397 - `project_id?: string | null`

398 

399 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

400 

401 - `user_id?: string | null`

402 

403 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

404 

341 - `OrganizationCostsResult`405 - `OrganizationCostsResult`

342 406 

343 The aggregated costs details of the specific time bucket.407 The aggregated costs details of the specific time bucket.

Details

62 62 

63 - `"bucket"`63 - `"bucket"`

64 64 

65 - `results: Array<OrganizationUsageCompletionsResult | OrganizationUsageEmbeddingsResult | OrganizationUsageModerationsResult | 6 more>`65 - `results: Array<OrganizationUsageCompletionsResult | OrganizationUsageEmbeddingsResult | OrganizationUsageModerationsResult | 8 more>`

66 66 

67 - `OrganizationUsageCompletionsResult`67 - `OrganizationUsageCompletionsResult`

68 68 


320 320 

321 When `group_by=project_id`, this field provides the project ID of the grouped usage result.321 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

322 322 

323 - `OrganizationUsageFileSearchesResult`

324 

325 The aggregated file search calls usage details of the specific time bucket.

326 

327 - `num_requests: number`

328 

329 The count of file search calls.

330 

331 - `object: "organization.usage.file_searches.result"`

332 

333 - `"organization.usage.file_searches.result"`

334 

335 - `api_key_id?: string | null`

336 

337 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

338 

339 - `project_id?: string | null`

340 

341 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

342 

343 - `user_id?: string | null`

344 

345 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

346 

347 - `vector_store_id?: string | null`

348 

349 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

350 

351 - `OrganizationUsageWebSearchesResult`

352 

353 The aggregated web search calls usage details of the specific time bucket.

354 

355 - `num_model_requests: number`

356 

357 The count of model requests.

358 

359 - `num_requests: number`

360 

361 The count of web search calls.

362 

363 - `object: "organization.usage.web_searches.result"`

364 

365 - `"organization.usage.web_searches.result"`

366 

367 - `api_key_id?: string | null`

368 

369 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

370 

371 - `context_level?: string | null`

372 

373 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

374 

375 - `model?: string | null`

376 

377 When `group_by=model`, this field provides the model name of the grouped usage result.

378 

379 - `project_id?: string | null`

380 

381 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

382 

383 - `user_id?: string | null`

384 

385 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

386 

323 - `OrganizationCostsResult`387 - `OrganizationCostsResult`

324 388 

325 The aggregated costs details of the specific time bucket.389 The aggregated costs details of the specific time bucket.

Details

88 88 

89 - `"bucket"`89 - `"bucket"`

90 90 

91 - `results: Array<OrganizationUsageCompletionsResult | OrganizationUsageEmbeddingsResult | OrganizationUsageModerationsResult | 6 more>`91 - `results: Array<OrganizationUsageCompletionsResult | OrganizationUsageEmbeddingsResult | OrganizationUsageModerationsResult | 8 more>`

92 92 

93 - `OrganizationUsageCompletionsResult`93 - `OrganizationUsageCompletionsResult`

94 94 


346 346 

347 When `group_by=project_id`, this field provides the project ID of the grouped usage result.347 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

348 348 

349 - `OrganizationUsageFileSearchesResult`

350 

351 The aggregated file search calls usage details of the specific time bucket.

352 

353 - `num_requests: number`

354 

355 The count of file search calls.

356 

357 - `object: "organization.usage.file_searches.result"`

358 

359 - `"organization.usage.file_searches.result"`

360 

361 - `api_key_id?: string | null`

362 

363 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

364 

365 - `project_id?: string | null`

366 

367 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

368 

369 - `user_id?: string | null`

370 

371 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

372 

373 - `vector_store_id?: string | null`

374 

375 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

376 

377 - `OrganizationUsageWebSearchesResult`

378 

379 The aggregated web search calls usage details of the specific time bucket.

380 

381 - `num_model_requests: number`

382 

383 The count of model requests.

384 

385 - `num_requests: number`

386 

387 The count of web search calls.

388 

389 - `object: "organization.usage.web_searches.result"`

390 

391 - `"organization.usage.web_searches.result"`

392 

393 - `api_key_id?: string | null`

394 

395 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

396 

397 - `context_level?: string | null`

398 

399 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

400 

401 - `model?: string | null`

402 

403 When `group_by=model`, this field provides the model name of the grouped usage result.

404 

405 - `project_id?: string | null`

406 

407 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

408 

409 - `user_id?: string | null`

410 

411 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

412 

349 - `OrganizationCostsResult`413 - `OrganizationCostsResult`

350 414 

351 The aggregated costs details of the specific time bucket.415 The aggregated costs details of the specific time bucket.

Details

62 62 

63 - `"bucket"`63 - `"bucket"`

64 64 

65 - `results: Array<OrganizationUsageCompletionsResult | OrganizationUsageEmbeddingsResult | OrganizationUsageModerationsResult | 6 more>`65 - `results: Array<OrganizationUsageCompletionsResult | OrganizationUsageEmbeddingsResult | OrganizationUsageModerationsResult | 8 more>`

66 66 

67 - `OrganizationUsageCompletionsResult`67 - `OrganizationUsageCompletionsResult`

68 68 


320 320 

321 When `group_by=project_id`, this field provides the project ID of the grouped usage result.321 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

322 322 

323 - `OrganizationUsageFileSearchesResult`

324 

325 The aggregated file search calls usage details of the specific time bucket.

326 

327 - `num_requests: number`

328 

329 The count of file search calls.

330 

331 - `object: "organization.usage.file_searches.result"`

332 

333 - `"organization.usage.file_searches.result"`

334 

335 - `api_key_id?: string | null`

336 

337 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

338 

339 - `project_id?: string | null`

340 

341 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

342 

343 - `user_id?: string | null`

344 

345 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

346 

347 - `vector_store_id?: string | null`

348 

349 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

350 

351 - `OrganizationUsageWebSearchesResult`

352 

353 The aggregated web search calls usage details of the specific time bucket.

354 

355 - `num_model_requests: number`

356 

357 The count of model requests.

358 

359 - `num_requests: number`

360 

361 The count of web search calls.

362 

363 - `object: "organization.usage.web_searches.result"`

364 

365 - `"organization.usage.web_searches.result"`

366 

367 - `api_key_id?: string | null`

368 

369 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

370 

371 - `context_level?: string | null`

372 

373 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

374 

375 - `model?: string | null`

376 

377 When `group_by=model`, this field provides the model name of the grouped usage result.

378 

379 - `project_id?: string | null`

380 

381 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

382 

383 - `user_id?: string | null`

384 

385 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

386 

323 - `OrganizationCostsResult`387 - `OrganizationCostsResult`

324 388 

325 The aggregated costs details of the specific time bucket.389 The aggregated costs details of the specific time bucket.

Details

80 80 

81 - `"bucket"`81 - `"bucket"`

82 82 

83 - `results: Array<OrganizationUsageCompletionsResult | OrganizationUsageEmbeddingsResult | OrganizationUsageModerationsResult | 6 more>`83 - `results: Array<OrganizationUsageCompletionsResult | OrganizationUsageEmbeddingsResult | OrganizationUsageModerationsResult | 8 more>`

84 84 

85 - `OrganizationUsageCompletionsResult`85 - `OrganizationUsageCompletionsResult`

86 86 


338 338 

339 When `group_by=project_id`, this field provides the project ID of the grouped usage result.339 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

340 340 

341 - `OrganizationUsageFileSearchesResult`

342 

343 The aggregated file search calls usage details of the specific time bucket.

344 

345 - `num_requests: number`

346 

347 The count of file search calls.

348 

349 - `object: "organization.usage.file_searches.result"`

350 

351 - `"organization.usage.file_searches.result"`

352 

353 - `api_key_id?: string | null`

354 

355 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

356 

357 - `project_id?: string | null`

358 

359 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

360 

361 - `user_id?: string | null`

362 

363 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

364 

365 - `vector_store_id?: string | null`

366 

367 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

368 

369 - `OrganizationUsageWebSearchesResult`

370 

371 The aggregated web search calls usage details of the specific time bucket.

372 

373 - `num_model_requests: number`

374 

375 The count of model requests.

376 

377 - `num_requests: number`

378 

379 The count of web search calls.

380 

381 - `object: "organization.usage.web_searches.result"`

382 

383 - `"organization.usage.web_searches.result"`

384 

385 - `api_key_id?: string | null`

386 

387 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

388 

389 - `context_level?: string | null`

390 

391 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

392 

393 - `model?: string | null`

394 

395 When `group_by=model`, this field provides the model name of the grouped usage result.

396 

397 - `project_id?: string | null`

398 

399 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

400 

401 - `user_id?: string | null`

402 

403 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

404 

341 - `OrganizationCostsResult`405 - `OrganizationCostsResult`

342 406 

343 The aggregated costs details of the specific time bucket.407 The aggregated costs details of the specific time bucket.

Details

1## File search calls

2 

3`client.admin.organization.usage.fileSearchCalls(UsageFileSearchCallsParamsquery, RequestOptionsoptions?): UsageFileSearchCallsResponse`

4 

5**get** `/organization/usage/file_search_calls`

6 

7Get file search calls usage details for the organization.

8 

9### Parameters

10 

11- `query: UsageFileSearchCallsParams`

12 

13 - `start_time: number`

14 

15 Start time (Unix seconds) of the query time range, inclusive.

16 

17 - `api_key_ids?: Array<string>`

18 

19 Return only usage for these API keys.

20 

21 - `bucket_width?: "1m" | "1h" | "1d"`

22 

23 Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`.

24 

25 - `"1m"`

26 

27 - `"1h"`

28 

29 - `"1d"`

30 

31 - `end_time?: number`

32 

33 End time (Unix seconds) of the query time range, exclusive.

34 

35 - `group_by?: Array<"project_id" | "user_id" | "api_key_id" | "vector_store_id">`

36 

37 Group the usage data by the specified fields. Support fields include `project_id`, `user_id`, `api_key_id`, `vector_store_id` or any combination of them.

38 

39 - `"project_id"`

40 

41 - `"user_id"`

42 

43 - `"api_key_id"`

44 

45 - `"vector_store_id"`

46 

47 - `limit?: number`

48 

49 Specifies the number of buckets to return.

50 

51 - `bucket_width=1d`: default: 7, max: 31

52 - `bucket_width=1h`: default: 24, max: 168

53 - `bucket_width=1m`: default: 60, max: 1440

54 

55 - `page?: string`

56 

57 A cursor for use in pagination. Corresponding to the `next_page` field from the previous response.

58 

59 - `project_ids?: Array<string>`

60 

61 Return only usage for these projects.

62 

63 - `user_ids?: Array<string>`

64 

65 Return only usage for these users.

66 

67 - `vector_store_ids?: Array<string>`

68 

69 Return only usage for these vector stores.

70 

71### Returns

72 

73- `UsageFileSearchCallsResponse`

74 

75 - `data: Array<Data>`

76 

77 - `end_time: number`

78 

79 - `object: "bucket"`

80 

81 - `"bucket"`

82 

83 - `results: Array<OrganizationUsageCompletionsResult | OrganizationUsageEmbeddingsResult | OrganizationUsageModerationsResult | 8 more>`

84 

85 - `OrganizationUsageCompletionsResult`

86 

87 The aggregated completions usage details of the specific time bucket.

88 

89 - `input_tokens: number`

90 

91 The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.

92 

93 - `num_model_requests: number`

94 

95 The count of requests made to the model.

96 

97 - `object: "organization.usage.completions.result"`

98 

99 - `"organization.usage.completions.result"`

100 

101 - `output_tokens: number`

102 

103 The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.

104 

105 - `api_key_id?: string | null`

106 

107 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

108 

109 - `batch?: boolean | null`

110 

111 When `group_by=batch`, this field tells whether the grouped usage result is batch or not.

112 

113 - `input_audio_tokens?: number`

114 

115 The aggregated number of audio input tokens used, including cached tokens.

116 

117 - `input_cached_tokens?: number`

118 

119 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.

120 

121 - `model?: string | null`

122 

123 When `group_by=model`, this field provides the model name of the grouped usage result.

124 

125 - `output_audio_tokens?: number`

126 

127 The aggregated number of audio output tokens used.

128 

129 - `project_id?: string | null`

130 

131 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

132 

133 - `service_tier?: string | null`

134 

135 When `group_by=service_tier`, this field provides the service tier of the grouped usage result.

136 

137 - `user_id?: string | null`

138 

139 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

140 

141 - `OrganizationUsageEmbeddingsResult`

142 

143 The aggregated embeddings usage details of the specific time bucket.

144 

145 - `input_tokens: number`

146 

147 The aggregated number of input tokens used.

148 

149 - `num_model_requests: number`

150 

151 The count of requests made to the model.

152 

153 - `object: "organization.usage.embeddings.result"`

154 

155 - `"organization.usage.embeddings.result"`

156 

157 - `api_key_id?: string | null`

158 

159 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

160 

161 - `model?: string | null`

162 

163 When `group_by=model`, this field provides the model name of the grouped usage result.

164 

165 - `project_id?: string | null`

166 

167 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

168 

169 - `user_id?: string | null`

170 

171 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

172 

173 - `OrganizationUsageModerationsResult`

174 

175 The aggregated moderations usage details of the specific time bucket.

176 

177 - `input_tokens: number`

178 

179 The aggregated number of input tokens used.

180 

181 - `num_model_requests: number`

182 

183 The count of requests made to the model.

184 

185 - `object: "organization.usage.moderations.result"`

186 

187 - `"organization.usage.moderations.result"`

188 

189 - `api_key_id?: string | null`

190 

191 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

192 

193 - `model?: string | null`

194 

195 When `group_by=model`, this field provides the model name of the grouped usage result.

196 

197 - `project_id?: string | null`

198 

199 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

200 

201 - `user_id?: string | null`

202 

203 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

204 

205 - `OrganizationUsageImagesResult`

206 

207 The aggregated images usage details of the specific time bucket.

208 

209 - `images: number`

210 

211 The number of images processed.

212 

213 - `num_model_requests: number`

214 

215 The count of requests made to the model.

216 

217 - `object: "organization.usage.images.result"`

218 

219 - `"organization.usage.images.result"`

220 

221 - `api_key_id?: string | null`

222 

223 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

224 

225 - `model?: string | null`

226 

227 When `group_by=model`, this field provides the model name of the grouped usage result.

228 

229 - `project_id?: string | null`

230 

231 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

232 

233 - `size?: string | null`

234 

235 When `group_by=size`, this field provides the image size of the grouped usage result.

236 

237 - `source?: string | null`

238 

239 When `group_by=source`, this field provides the source of the grouped usage result, possible values are `image.generation`, `image.edit`, `image.variation`.

240 

241 - `user_id?: string | null`

242 

243 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

244 

245 - `OrganizationUsageAudioSpeechesResult`

246 

247 The aggregated audio speeches usage details of the specific time bucket.

248 

249 - `characters: number`

250 

251 The number of characters processed.

252 

253 - `num_model_requests: number`

254 

255 The count of requests made to the model.

256 

257 - `object: "organization.usage.audio_speeches.result"`

258 

259 - `"organization.usage.audio_speeches.result"`

260 

261 - `api_key_id?: string | null`

262 

263 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

264 

265 - `model?: string | null`

266 

267 When `group_by=model`, this field provides the model name of the grouped usage result.

268 

269 - `project_id?: string | null`

270 

271 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

272 

273 - `user_id?: string | null`

274 

275 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

276 

277 - `OrganizationUsageAudioTranscriptionsResult`

278 

279 The aggregated audio transcriptions usage details of the specific time bucket.

280 

281 - `num_model_requests: number`

282 

283 The count of requests made to the model.

284 

285 - `object: "organization.usage.audio_transcriptions.result"`

286 

287 - `"organization.usage.audio_transcriptions.result"`

288 

289 - `seconds: number`

290 

291 The number of seconds processed.

292 

293 - `api_key_id?: string | null`

294 

295 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

296 

297 - `model?: string | null`

298 

299 When `group_by=model`, this field provides the model name of the grouped usage result.

300 

301 - `project_id?: string | null`

302 

303 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

304 

305 - `user_id?: string | null`

306 

307 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

308 

309 - `OrganizationUsageVectorStoresResult`

310 

311 The aggregated vector stores usage details of the specific time bucket.

312 

313 - `object: "organization.usage.vector_stores.result"`

314 

315 - `"organization.usage.vector_stores.result"`

316 

317 - `usage_bytes: number`

318 

319 The vector stores usage in bytes.

320 

321 - `project_id?: string | null`

322 

323 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

324 

325 - `OrganizationUsageCodeInterpreterSessionsResult`

326 

327 The aggregated code interpreter sessions usage details of the specific time bucket.

328 

329 - `num_sessions: number`

330 

331 The number of code interpreter sessions.

332 

333 - `object: "organization.usage.code_interpreter_sessions.result"`

334 

335 - `"organization.usage.code_interpreter_sessions.result"`

336 

337 - `project_id?: string | null`

338 

339 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

340 

341 - `OrganizationUsageFileSearchesResult`

342 

343 The aggregated file search calls usage details of the specific time bucket.

344 

345 - `num_requests: number`

346 

347 The count of file search calls.

348 

349 - `object: "organization.usage.file_searches.result"`

350 

351 - `"organization.usage.file_searches.result"`

352 

353 - `api_key_id?: string | null`

354 

355 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

356 

357 - `project_id?: string | null`

358 

359 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

360 

361 - `user_id?: string | null`

362 

363 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

364 

365 - `vector_store_id?: string | null`

366 

367 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

368 

369 - `OrganizationUsageWebSearchesResult`

370 

371 The aggregated web search calls usage details of the specific time bucket.

372 

373 - `num_model_requests: number`

374 

375 The count of model requests.

376 

377 - `num_requests: number`

378 

379 The count of web search calls.

380 

381 - `object: "organization.usage.web_searches.result"`

382 

383 - `"organization.usage.web_searches.result"`

384 

385 - `api_key_id?: string | null`

386 

387 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

388 

389 - `context_level?: string | null`

390 

391 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

392 

393 - `model?: string | null`

394 

395 When `group_by=model`, this field provides the model name of the grouped usage result.

396 

397 - `project_id?: string | null`

398 

399 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

400 

401 - `user_id?: string | null`

402 

403 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

404 

405 - `OrganizationCostsResult`

406 

407 The aggregated costs details of the specific time bucket.

408 

409 - `object: "organization.costs.result"`

410 

411 - `"organization.costs.result"`

412 

413 - `amount?: Amount`

414 

415 The monetary value in its associated currency.

416 

417 - `currency?: string`

418 

419 Lowercase ISO-4217 currency e.g. "usd"

420 

421 - `value?: number`

422 

423 The numeric value of the cost.

424 

425 - `api_key_id?: string | null`

426 

427 When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result.

428 

429 - `line_item?: string | null`

430 

431 When `group_by=line_item`, this field provides the line item of the grouped costs result.

432 

433 - `project_id?: string | null`

434 

435 When `group_by=project_id`, this field provides the project ID of the grouped costs result.

436 

437 - `quantity?: number | null`

438 

439 When `group_by=line_item`, this field provides the quantity of the grouped costs result.

440 

441 - `start_time: number`

442 

443 - `has_more: boolean`

444 

445 - `next_page: string | null`

446 

447 - `object: "page"`

448 

449 - `"page"`

450 

451### Example

452 

453```typescript

454import OpenAI from 'openai';

455 

456const client = new OpenAI({

457 adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted

458});

459 

460const response = await client.admin.organization.usage.fileSearchCalls({ start_time: 0 });

461 

462console.log(response.data);

463```

464 

465#### Response

466 

467```json

468{

469 "data": [

470 {

471 "end_time": 0,

472 "object": "bucket",

473 "results": [

474 {

475 "input_tokens": 0,

476 "num_model_requests": 0,

477 "object": "organization.usage.completions.result",

478 "output_tokens": 0,

479 "api_key_id": "api_key_id",

480 "batch": true,

481 "input_audio_tokens": 0,

482 "input_cached_tokens": 0,

483 "model": "model",

484 "output_audio_tokens": 0,

485 "project_id": "project_id",

486 "service_tier": "service_tier",

487 "user_id": "user_id"

488 }

489 ],

490 "start_time": 0

491 }

492 ],

493 "has_more": true,

494 "next_page": "next_page",

495 "object": "page"

496}

497```

Details

108 108 

109 - `"bucket"`109 - `"bucket"`

110 110 

111 - `results: Array<OrganizationUsageCompletionsResult | OrganizationUsageEmbeddingsResult | OrganizationUsageModerationsResult | 6 more>`111 - `results: Array<OrganizationUsageCompletionsResult | OrganizationUsageEmbeddingsResult | OrganizationUsageModerationsResult | 8 more>`

112 112 

113 - `OrganizationUsageCompletionsResult`113 - `OrganizationUsageCompletionsResult`

114 114 


366 366 

367 When `group_by=project_id`, this field provides the project ID of the grouped usage result.367 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

368 368 

369 - `OrganizationUsageFileSearchesResult`

370 

371 The aggregated file search calls usage details of the specific time bucket.

372 

373 - `num_requests: number`

374 

375 The count of file search calls.

376 

377 - `object: "organization.usage.file_searches.result"`

378 

379 - `"organization.usage.file_searches.result"`

380 

381 - `api_key_id?: string | null`

382 

383 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

384 

385 - `project_id?: string | null`

386 

387 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

388 

389 - `user_id?: string | null`

390 

391 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

392 

393 - `vector_store_id?: string | null`

394 

395 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

396 

397 - `OrganizationUsageWebSearchesResult`

398 

399 The aggregated web search calls usage details of the specific time bucket.

400 

401 - `num_model_requests: number`

402 

403 The count of model requests.

404 

405 - `num_requests: number`

406 

407 The count of web search calls.

408 

409 - `object: "organization.usage.web_searches.result"`

410 

411 - `"organization.usage.web_searches.result"`

412 

413 - `api_key_id?: string | null`

414 

415 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

416 

417 - `context_level?: string | null`

418 

419 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

420 

421 - `model?: string | null`

422 

423 When `group_by=model`, this field provides the model name of the grouped usage result.

424 

425 - `project_id?: string | null`

426 

427 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

428 

429 - `user_id?: string | null`

430 

431 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

432 

369 - `OrganizationCostsResult`433 - `OrganizationCostsResult`

370 434 

371 The aggregated costs details of the specific time bucket.435 The aggregated costs details of the specific time bucket.

Details

80 80 

81 - `"bucket"`81 - `"bucket"`

82 82 

83 - `results: Array<OrganizationUsageCompletionsResult | OrganizationUsageEmbeddingsResult | OrganizationUsageModerationsResult | 6 more>`83 - `results: Array<OrganizationUsageCompletionsResult | OrganizationUsageEmbeddingsResult | OrganizationUsageModerationsResult | 8 more>`

84 84 

85 - `OrganizationUsageCompletionsResult`85 - `OrganizationUsageCompletionsResult`

86 86 


338 338 

339 When `group_by=project_id`, this field provides the project ID of the grouped usage result.339 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

340 340 

341 - `OrganizationUsageFileSearchesResult`

342 

343 The aggregated file search calls usage details of the specific time bucket.

344 

345 - `num_requests: number`

346 

347 The count of file search calls.

348 

349 - `object: "organization.usage.file_searches.result"`

350 

351 - `"organization.usage.file_searches.result"`

352 

353 - `api_key_id?: string | null`

354 

355 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

356 

357 - `project_id?: string | null`

358 

359 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

360 

361 - `user_id?: string | null`

362 

363 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

364 

365 - `vector_store_id?: string | null`

366 

367 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

368 

369 - `OrganizationUsageWebSearchesResult`

370 

371 The aggregated web search calls usage details of the specific time bucket.

372 

373 - `num_model_requests: number`

374 

375 The count of model requests.

376 

377 - `num_requests: number`

378 

379 The count of web search calls.

380 

381 - `object: "organization.usage.web_searches.result"`

382 

383 - `"organization.usage.web_searches.result"`

384 

385 - `api_key_id?: string | null`

386 

387 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

388 

389 - `context_level?: string | null`

390 

391 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

392 

393 - `model?: string | null`

394 

395 When `group_by=model`, this field provides the model name of the grouped usage result.

396 

397 - `project_id?: string | null`

398 

399 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

400 

401 - `user_id?: string | null`

402 

403 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

404 

341 - `OrganizationCostsResult`405 - `OrganizationCostsResult`

342 406 

343 The aggregated costs details of the specific time bucket.407 The aggregated costs details of the specific time bucket.

Details

62 62 

63 - `"bucket"`63 - `"bucket"`

64 64 

65 - `results: Array<OrganizationUsageCompletionsResult | OrganizationUsageEmbeddingsResult | OrganizationUsageModerationsResult | 6 more>`65 - `results: Array<OrganizationUsageCompletionsResult | OrganizationUsageEmbeddingsResult | OrganizationUsageModerationsResult | 8 more>`

66 66 

67 - `OrganizationUsageCompletionsResult`67 - `OrganizationUsageCompletionsResult`

68 68 


320 320 

321 When `group_by=project_id`, this field provides the project ID of the grouped usage result.321 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

322 322 

323 - `OrganizationUsageFileSearchesResult`

324 

325 The aggregated file search calls usage details of the specific time bucket.

326 

327 - `num_requests: number`

328 

329 The count of file search calls.

330 

331 - `object: "organization.usage.file_searches.result"`

332 

333 - `"organization.usage.file_searches.result"`

334 

335 - `api_key_id?: string | null`

336 

337 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

338 

339 - `project_id?: string | null`

340 

341 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

342 

343 - `user_id?: string | null`

344 

345 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

346 

347 - `vector_store_id?: string | null`

348 

349 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

350 

351 - `OrganizationUsageWebSearchesResult`

352 

353 The aggregated web search calls usage details of the specific time bucket.

354 

355 - `num_model_requests: number`

356 

357 The count of model requests.

358 

359 - `num_requests: number`

360 

361 The count of web search calls.

362 

363 - `object: "organization.usage.web_searches.result"`

364 

365 - `"organization.usage.web_searches.result"`

366 

367 - `api_key_id?: string | null`

368 

369 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

370 

371 - `context_level?: string | null`

372 

373 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

374 

375 - `model?: string | null`

376 

377 When `group_by=model`, this field provides the model name of the grouped usage result.

378 

379 - `project_id?: string | null`

380 

381 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

382 

383 - `user_id?: string | null`

384 

385 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

386 

323 - `OrganizationCostsResult`387 - `OrganizationCostsResult`

324 388 

325 The aggregated costs details of the specific time bucket.389 The aggregated costs details of the specific time bucket.

Details

1## Web search calls

2 

3`client.admin.organization.usage.webSearchCalls(UsageWebSearchCallsParamsquery, RequestOptionsoptions?): UsageWebSearchCallsResponse`

4 

5**get** `/organization/usage/web_search_calls`

6 

7Get web search calls usage details for the organization.

8 

9### Parameters

10 

11- `query: UsageWebSearchCallsParams`

12 

13 - `start_time: number`

14 

15 Start time (Unix seconds) of the query time range, inclusive.

16 

17 - `api_key_ids?: Array<string>`

18 

19 Return only usage for these API keys.

20 

21 - `bucket_width?: "1m" | "1h" | "1d"`

22 

23 Width of each time bucket in response. Currently `1m`, `1h` and `1d` are supported, default to `1d`.

24 

25 - `"1m"`

26 

27 - `"1h"`

28 

29 - `"1d"`

30 

31 - `context_levels?: Array<"low" | "medium" | "high">`

32 

33 Return only web search usage for these context levels.

34 

35 - `"low"`

36 

37 - `"medium"`

38 

39 - `"high"`

40 

41 - `end_time?: number`

42 

43 End time (Unix seconds) of the query time range, exclusive.

44 

45 - `group_by?: Array<"project_id" | "user_id" | "api_key_id" | 2 more>`

46 

47 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.

48 

49 - `"project_id"`

50 

51 - `"user_id"`

52 

53 - `"api_key_id"`

54 

55 - `"model"`

56 

57 - `"context_level"`

58 

59 - `limit?: number`

60 

61 Specifies the number of buckets to return.

62 

63 - `bucket_width=1d`: default: 7, max: 31

64 - `bucket_width=1h`: default: 24, max: 168

65 - `bucket_width=1m`: default: 60, max: 1440

66 

67 - `models?: Array<string>`

68 

69 Return only usage for these models.

70 

71 - `page?: string`

72 

73 A cursor for use in pagination. Corresponding to the `next_page` field from the previous response.

74 

75 - `project_ids?: Array<string>`

76 

77 Return only usage for these projects.

78 

79 - `user_ids?: Array<string>`

80 

81 Return only usage for these users.

82 

83### Returns

84 

85- `UsageWebSearchCallsResponse`

86 

87 - `data: Array<Data>`

88 

89 - `end_time: number`

90 

91 - `object: "bucket"`

92 

93 - `"bucket"`

94 

95 - `results: Array<OrganizationUsageCompletionsResult | OrganizationUsageEmbeddingsResult | OrganizationUsageModerationsResult | 8 more>`

96 

97 - `OrganizationUsageCompletionsResult`

98 

99 The aggregated completions usage details of the specific time bucket.

100 

101 - `input_tokens: number`

102 

103 The aggregated number of text input tokens used, including cached tokens. For customers subscribe to scale tier, this includes scale tier tokens.

104 

105 - `num_model_requests: number`

106 

107 The count of requests made to the model.

108 

109 - `object: "organization.usage.completions.result"`

110 

111 - `"organization.usage.completions.result"`

112 

113 - `output_tokens: number`

114 

115 The aggregated number of text output tokens used. For customers subscribe to scale tier, this includes scale tier tokens.

116 

117 - `api_key_id?: string | null`

118 

119 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

120 

121 - `batch?: boolean | null`

122 

123 When `group_by=batch`, this field tells whether the grouped usage result is batch or not.

124 

125 - `input_audio_tokens?: number`

126 

127 The aggregated number of audio input tokens used, including cached tokens.

128 

129 - `input_cached_tokens?: number`

130 

131 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.

132 

133 - `model?: string | null`

134 

135 When `group_by=model`, this field provides the model name of the grouped usage result.

136 

137 - `output_audio_tokens?: number`

138 

139 The aggregated number of audio output tokens used.

140 

141 - `project_id?: string | null`

142 

143 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

144 

145 - `service_tier?: string | null`

146 

147 When `group_by=service_tier`, this field provides the service tier of the grouped usage result.

148 

149 - `user_id?: string | null`

150 

151 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

152 

153 - `OrganizationUsageEmbeddingsResult`

154 

155 The aggregated embeddings usage details of the specific time bucket.

156 

157 - `input_tokens: number`

158 

159 The aggregated number of input tokens used.

160 

161 - `num_model_requests: number`

162 

163 The count of requests made to the model.

164 

165 - `object: "organization.usage.embeddings.result"`

166 

167 - `"organization.usage.embeddings.result"`

168 

169 - `api_key_id?: string | null`

170 

171 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

172 

173 - `model?: string | null`

174 

175 When `group_by=model`, this field provides the model name of the grouped usage result.

176 

177 - `project_id?: string | null`

178 

179 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

180 

181 - `user_id?: string | null`

182 

183 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

184 

185 - `OrganizationUsageModerationsResult`

186 

187 The aggregated moderations usage details of the specific time bucket.

188 

189 - `input_tokens: number`

190 

191 The aggregated number of input tokens used.

192 

193 - `num_model_requests: number`

194 

195 The count of requests made to the model.

196 

197 - `object: "organization.usage.moderations.result"`

198 

199 - `"organization.usage.moderations.result"`

200 

201 - `api_key_id?: string | null`

202 

203 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

204 

205 - `model?: string | null`

206 

207 When `group_by=model`, this field provides the model name of the grouped usage result.

208 

209 - `project_id?: string | null`

210 

211 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

212 

213 - `user_id?: string | null`

214 

215 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

216 

217 - `OrganizationUsageImagesResult`

218 

219 The aggregated images usage details of the specific time bucket.

220 

221 - `images: number`

222 

223 The number of images processed.

224 

225 - `num_model_requests: number`

226 

227 The count of requests made to the model.

228 

229 - `object: "organization.usage.images.result"`

230 

231 - `"organization.usage.images.result"`

232 

233 - `api_key_id?: string | null`

234 

235 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

236 

237 - `model?: string | null`

238 

239 When `group_by=model`, this field provides the model name of the grouped usage result.

240 

241 - `project_id?: string | null`

242 

243 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

244 

245 - `size?: string | null`

246 

247 When `group_by=size`, this field provides the image size of the grouped usage result.

248 

249 - `source?: string | null`

250 

251 When `group_by=source`, this field provides the source of the grouped usage result, possible values are `image.generation`, `image.edit`, `image.variation`.

252 

253 - `user_id?: string | null`

254 

255 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

256 

257 - `OrganizationUsageAudioSpeechesResult`

258 

259 The aggregated audio speeches usage details of the specific time bucket.

260 

261 - `characters: number`

262 

263 The number of characters processed.

264 

265 - `num_model_requests: number`

266 

267 The count of requests made to the model.

268 

269 - `object: "organization.usage.audio_speeches.result"`

270 

271 - `"organization.usage.audio_speeches.result"`

272 

273 - `api_key_id?: string | null`

274 

275 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

276 

277 - `model?: string | null`

278 

279 When `group_by=model`, this field provides the model name of the grouped usage result.

280 

281 - `project_id?: string | null`

282 

283 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

284 

285 - `user_id?: string | null`

286 

287 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

288 

289 - `OrganizationUsageAudioTranscriptionsResult`

290 

291 The aggregated audio transcriptions usage details of the specific time bucket.

292 

293 - `num_model_requests: number`

294 

295 The count of requests made to the model.

296 

297 - `object: "organization.usage.audio_transcriptions.result"`

298 

299 - `"organization.usage.audio_transcriptions.result"`

300 

301 - `seconds: number`

302 

303 The number of seconds processed.

304 

305 - `api_key_id?: string | null`

306 

307 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

308 

309 - `model?: string | null`

310 

311 When `group_by=model`, this field provides the model name of the grouped usage result.

312 

313 - `project_id?: string | null`

314 

315 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

316 

317 - `user_id?: string | null`

318 

319 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

320 

321 - `OrganizationUsageVectorStoresResult`

322 

323 The aggregated vector stores usage details of the specific time bucket.

324 

325 - `object: "organization.usage.vector_stores.result"`

326 

327 - `"organization.usage.vector_stores.result"`

328 

329 - `usage_bytes: number`

330 

331 The vector stores usage in bytes.

332 

333 - `project_id?: string | null`

334 

335 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

336 

337 - `OrganizationUsageCodeInterpreterSessionsResult`

338 

339 The aggregated code interpreter sessions usage details of the specific time bucket.

340 

341 - `num_sessions: number`

342 

343 The number of code interpreter sessions.

344 

345 - `object: "organization.usage.code_interpreter_sessions.result"`

346 

347 - `"organization.usage.code_interpreter_sessions.result"`

348 

349 - `project_id?: string | null`

350 

351 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

352 

353 - `OrganizationUsageFileSearchesResult`

354 

355 The aggregated file search calls usage details of the specific time bucket.

356 

357 - `num_requests: number`

358 

359 The count of file search calls.

360 

361 - `object: "organization.usage.file_searches.result"`

362 

363 - `"organization.usage.file_searches.result"`

364 

365 - `api_key_id?: string | null`

366 

367 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

368 

369 - `project_id?: string | null`

370 

371 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

372 

373 - `user_id?: string | null`

374 

375 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

376 

377 - `vector_store_id?: string | null`

378 

379 When `group_by=vector_store_id`, this field provides the vector store ID of the grouped usage result.

380 

381 - `OrganizationUsageWebSearchesResult`

382 

383 The aggregated web search calls usage details of the specific time bucket.

384 

385 - `num_model_requests: number`

386 

387 The count of model requests.

388 

389 - `num_requests: number`

390 

391 The count of web search calls.

392 

393 - `object: "organization.usage.web_searches.result"`

394 

395 - `"organization.usage.web_searches.result"`

396 

397 - `api_key_id?: string | null`

398 

399 When `group_by=api_key_id`, this field provides the API key ID of the grouped usage result.

400 

401 - `context_level?: string | null`

402 

403 When `group_by=context_level`, this field provides the search context size of the grouped usage result.

404 

405 - `model?: string | null`

406 

407 When `group_by=model`, this field provides the model name of the grouped usage result.

408 

409 - `project_id?: string | null`

410 

411 When `group_by=project_id`, this field provides the project ID of the grouped usage result.

412 

413 - `user_id?: string | null`

414 

415 When `group_by=user_id`, this field provides the user ID of the grouped usage result.

416 

417 - `OrganizationCostsResult`

418 

419 The aggregated costs details of the specific time bucket.

420 

421 - `object: "organization.costs.result"`

422 

423 - `"organization.costs.result"`

424 

425 - `amount?: Amount`

426 

427 The monetary value in its associated currency.

428 

429 - `currency?: string`

430 

431 Lowercase ISO-4217 currency e.g. "usd"

432 

433 - `value?: number`

434 

435 The numeric value of the cost.

436 

437 - `api_key_id?: string | null`

438 

439 When `group_by=api_key_id`, this field provides the API Key ID of the grouped costs result.

440 

441 - `line_item?: string | null`

442 

443 When `group_by=line_item`, this field provides the line item of the grouped costs result.

444 

445 - `project_id?: string | null`

446 

447 When `group_by=project_id`, this field provides the project ID of the grouped costs result.

448 

449 - `quantity?: number | null`

450 

451 When `group_by=line_item`, this field provides the quantity of the grouped costs result.

452 

453 - `start_time: number`

454 

455 - `has_more: boolean`

456 

457 - `next_page: string | null`

458 

459 - `object: "page"`

460 

461 - `"page"`

462 

463### Example

464 

465```typescript

466import OpenAI from 'openai';

467 

468const client = new OpenAI({

469 adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted

470});

471 

472const response = await client.admin.organization.usage.webSearchCalls({ start_time: 0 });

473 

474console.log(response.data);

475```

476 

477#### Response

478 

479```json

480{

481 "data": [

482 {

483 "end_time": 0,

484 "object": "bucket",

485 "results": [

486 {

487 "input_tokens": 0,

488 "num_model_requests": 0,

489 "object": "organization.usage.completions.result",

490 "output_tokens": 0,

491 "api_key_id": "api_key_id",

492 "batch": true,

493 "input_audio_tokens": 0,

494 "input_cached_tokens": 0,

495 "model": "model",

496 "output_audio_tokens": 0,

497 "project_id": "project_id",

498 "service_tier": "service_tier",

499 "user_id": "user_id"

500 }

501 ],

502 "start_time": 0

503 }

504 ],

505 "has_more": true,

506 "next_page": "next_page",

507 "object": "page"

508}

509```

Details

2934 2934 

2935 The namespace of the custom tool being called.2935 The namespace of the custom tool being called.

2936 2936 

2937 - `CompactionTrigger`

2938 

2939 Compacts the current context. Must be the final input item.

2940 

2941 - `type: "compaction_trigger"`

2942 

2943 The type of the item. Always `compaction_trigger`.

2944 

2945 - `"compaction_trigger"`

2946 

2937 - `ItemReference`2947 - `ItemReference`

2938 2948 

2939 An internal identifier for an item to reference.2949 An internal identifier for an item to reference.

Details

2936 2936 

2937 The namespace of the custom tool being called.2937 The namespace of the custom tool being called.

2938 2938 

2939 - `CompactionTrigger`

2940 

2941 Compacts the current context. Must be the final input item.

2942 

2943 - `type: "compaction_trigger"`

2944 

2945 The type of the item. Always `compaction_trigger`.

2946 

2947 - `"compaction_trigger"`

2948 

2939 - `ItemReference`2949 - `ItemReference`

2940 2950 

2941 An internal identifier for an item to reference.2951 An internal identifier for an item to reference.

Details

3016 3016 

3017 The namespace of the custom tool being called.3017 The namespace of the custom tool being called.

3018 3018 

3019 - `CompactionTrigger`

3020 

3021 Compacts the current context. Must be the final input item.

3022 

3023 - `type: "compaction_trigger"`

3024 

3025 The type of the item. Always `compaction_trigger`.

3026 

3027 - `"compaction_trigger"`

3028 

3019 - `ItemReference`3029 - `ItemReference`

3020 3030 

3021 An internal identifier for an item to reference.3031 An internal identifier for an item to reference.

Details

3132 3132 

3133 The namespace of the custom tool being called.3133 The namespace of the custom tool being called.

3134 3134 

3135 - `CompactionTrigger`

3136 

3137 Compacts the current context. Must be the final input item.

3138 

3139 - `type: "compaction_trigger"`

3140 

3141 The type of the item. Always `compaction_trigger`.

3142 

3143 - `"compaction_trigger"`

3144 

3135 - `ItemReference`3145 - `ItemReference`

3136 3146 

3137 An internal identifier for an item to reference.3147 An internal identifier for an item to reference.

Details

3017 3017 

3018 The namespace of the custom tool being called.3018 The namespace of the custom tool being called.

3019 3019 

3020 - `CompactionTrigger`

3021 

3022 Compacts the current context. Must be the final input item.

3023 

3024 - `type: "compaction_trigger"`

3025 

3026 The type of the item. Always `compaction_trigger`.

3027 

3028 - `"compaction_trigger"`

3029 

3020 - `ItemReference`3030 - `ItemReference`

3021 3031 

3022 An internal identifier for an item to reference.3032 An internal identifier for an item to reference.


6824 6834 

6825 The namespace of the custom tool being called.6835 The namespace of the custom tool being called.

6826 6836 

6837 - `CompactionTrigger`

6838 

6839 Compacts the current context. Must be the final input item.

6840 

6841 - `type: "compaction_trigger"`

6842 

6843 The type of the item. Always `compaction_trigger`.

6844 

6845 - `"compaction_trigger"`

6846 

6827 - `ItemReference`6847 - `ItemReference`

6828 6848 

6829 An internal identifier for an item to reference.6849 An internal identifier for an item to reference.

Details

3082 3082 

3083 The namespace of the custom tool being called.3083 The namespace of the custom tool being called.

3084 3084 

3085 - `CompactionTrigger`

3086 

3087 Compacts the current context. Must be the final input item.

3088 

3089 - `type: "compaction_trigger"`

3090 

3091 The type of the item. Always `compaction_trigger`.

3092 

3093 - `"compaction_trigger"`

3094 

3085 - `ItemReference`3095 - `ItemReference`

3086 3096 

3087 An internal identifier for an item to reference.3097 An internal identifier for an item to reference.

Details

2955 2955 

2956 The namespace of the custom tool being called.2956 The namespace of the custom tool being called.

2957 2957 

2958 - `CompactionTrigger`

2959 

2960 Compacts the current context. Must be the final input item.

2961 

2962 - `type: "compaction_trigger"`

2963 

2964 The type of the item. Always `compaction_trigger`.

2965 

2966 - `"compaction_trigger"`

2967 

2958 - `ItemReference`2968 - `ItemReference`

2959 2969 

2960 An internal identifier for an item to reference.2970 An internal identifier for an item to reference.