I found this: How can i check OpenAI usage with Python? - #5 by weibing.chen.xy
Can’t find any documentation on it, but I converted the code to PHP and ran it and darned if it didn’t work!
This is the data it comes back with (I ran it with date=2023-05-01):
Array
(
[object] => list
[data] => Array
(
[0] => Array
(
[aggregation_timestamp] => 1682923500
[n_requests] => 3
[operation] => completion
[snapshot_id] => gpt-3.5-turbo-0301
[n_context] => 3
[n_context_tokens_total] => 322
[n_generated] => 3
[n_generated_tokens_total] => 53
)
[1] => Array
(
[aggregation_timestamp] => 1682923500
[n_requests] => 1
[operation] => completion
[snapshot_id] => gpt-4-0314
[n_context] => 1
[n_context_tokens_total] => 229
[n_generated] => 1
[n_generated_tokens_total] => 22
)
[2] => Array
(
[aggregation_timestamp] => 1682923500
[n_requests] => 2
[operation] => embeddings
[snapshot_id] => text-embedding-ada-002-v2
[n_context] => 2
[n_context_tokens_total] => 21
[n_generated] => 0
[n_generated_tokens_total] => 0
)
[3] => Array
(
[aggregation_timestamp] => 1682923800
[n_requests] => 1
[operation] => completion
[snapshot_id] => gpt-4-0314
[n_context] => 1
[n_context_tokens_total] => 239
[n_generated] => 1
[n_generated_tokens_total] => 25
)
[4] => Array
(
[aggregation_timestamp] => 1682931000
[n_requests] => 7
[operation] => completion
[snapshot_id] => gpt-3.5-turbo-0301
[n_context] => 7
[n_context_tokens_total] => 1217
[n_generated] => 7
[n_generated_tokens_total] => 227
)
[5] => Array
(
[aggregation_timestamp] => 1682931000
[n_requests] => 4
[operation] => completion
[snapshot_id] => gpt-4-0314
[n_context] => 4
[n_context_tokens_total] => 5576
[n_generated] => 4
[n_generated_tokens_total] => 176
)
[6] => Array
(
[aggregation_timestamp] => 1682931000
[n_requests] => 4
[operation] => embeddings
[snapshot_id] => text-embedding-ada-002-v2
[n_context] => 4
[n_context_tokens_total] => 48
[n_generated] => 0
[n_generated_tokens_total] => 0
)
[7] => Array
(
[aggregation_timestamp] => 1682931600
[n_requests] => 1
[operation] => completion
[snapshot_id] => gpt-3.5-turbo-0301
[n_context] => 1
[n_context_tokens_total] => 99
[n_generated] => 1
[n_generated_tokens_total] => 9
)
[8] => Array
(
[aggregation_timestamp] => 1682931600
[n_requests] => 1
[operation] => completion
[snapshot_id] => gpt-4-0314
[n_context] => 1
[n_context_tokens_total] => 1193
[n_generated] => 1
[n_generated_tokens_total] => 81
)
[9] => Array
(
[aggregation_timestamp] => 1682931600
[n_requests] => 1
[operation] => embeddings
[snapshot_id] => text-embedding-ada-002-v2
[n_context] => 1
[n_context_tokens_total] => 4
[n_generated] => 0
[n_generated_tokens_total] => 0
)
[10] => Array
(
[aggregation_timestamp] => 1682931900
[n_requests] => 8
[operation] => completion
[snapshot_id] => gpt-3.5-turbo-0301
[n_context] => 8
[n_context_tokens_total] => 1714
[n_generated] => 8
[n_generated_tokens_total] => 256
)
[11] => Array
(
[aggregation_timestamp] => 1682931900
[n_requests] => 4
[operation] => completion
[snapshot_id] => gpt-4-0314
[n_context] => 4
[n_context_tokens_total] => 5231
[n_generated] => 4
[n_generated_tokens_total] => 184
)
[12] => Array
(
[aggregation_timestamp] => 1682931900
[n_requests] => 4
[operation] => embeddings
[snapshot_id] => text-embedding-ada-002-v2
[n_context] => 4
[n_context_tokens_total] => 74
[n_generated] => 0
[n_generated_tokens_total] => 0
)
)
[ft_data] => Array
(
)
[dalle_api_data] => Array
(
)
[whisper_api_data] => Array
(
)
[current_usage_usd] => 0
)