用法
完成
获取 https://api.openai.com/v1/organization/usage/completions
获取组织的完成项使用情况详细信息。
查询参数
指定要返回的存储桶数。
bucket_width=1d
: 默认: 7, 最大: 31bucket_width=1h
: 默认: 24, 最大: 168bucket_width=1m
: 默认值: 60, 最大值: 1440
返回
分页、时间分段的 Completions 使用对象的列表。
示例请求
1
2
3
curl "https://api.openai.com/v1/organization/usage/completions?start_time=1730419200&limit=1" \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
响应
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
{
"object": "page",
"data": [
{
"object": "bucket",
"start_time": 1730419200,
"end_time": 1730505600,
"results": [
{
"object": "organization.usage.completions.result",
"input_tokens": 1000,
"output_tokens": 500,
"input_cached_tokens": 800,
"num_model_requests": 5,
"project_id": null,
"user_id": null,
"api_key_id": null,
"model": null,
"batch": null
}
]
}
],
"has_more": true,
"next_page": "AAAAAGdGxdEiJdKOAAAAAGcqsYA="
}
Completions 使用对象
特定时间存储桶的聚合完成使用情况详细信息。
OBJECT Completions 使用对象
1
2
3
4
5
6
7
8
9
10
11
12
{
"object": "organization.usage.completions.result",
"input_tokens": 5000,
"output_tokens": 1000,
"input_cached_tokens": 4000,
"num_model_requests": 5,
"project_id": "proj_abc",
"user_id": "user-abc",
"api_key_id": "key_abc",
"model": "gpt-4o-mini-2024-07-18",
"batch": false
}
Embeddings
获取 https://api.openai.com/v1/organization/usage/embeddings
获取组织的嵌入使用情况详细信息。
查询参数
指定要返回的存储桶数。
bucket_width=1d
: 默认: 7, 最大: 31bucket_width=1h
: 默认: 24, 最大: 168bucket_width=1m
: 默认值: 60, 最大值: 1440
返回
分页、时间分段的 Embeddings 使用对象的列表。
示例请求
1
2
3
curl "https://api.openai.com/v1/organization/usage/embeddings?start_time=1730419200&limit=1" \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
响应
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{
"object": "page",
"data": [
{
"object": "bucket",
"start_time": 1730419200,
"end_time": 1730505600,
"results": [
{
"object": "organization.usage.embeddings.result",
"input_tokens": 16,
"num_model_requests": 2,
"project_id": null,
"user_id": null,
"api_key_id": null,
"model": null
}
]
}
],
"has_more": false,
"next_page": null
}
Embeddings 使用对象
聚合的嵌入使用时间 Bucket 的使用情况详细信息。
OBJECT 嵌入使用对象
1
2
3
4
5
6
7
8
9
{
"object": "organization.usage.embeddings.result",
"input_tokens": 20,
"num_model_requests": 2,
"project_id": "proj_abc",
"user_id": "user-abc",
"api_key_id": "key_abc",
"model": "text-embedding-ada-002-v2"
}
审核
获取 https://api.openai.com/v1/organization/usage/moderations
获取组织的审核使用情况详细信息。
查询参数
指定要返回的存储桶数。
bucket_width=1d
: 默认: 7, 最大: 31bucket_width=1h
: 默认: 24, 最大: 168bucket_width=1m
: 默认值: 60, 最大值: 1440
返回
分页、时间分段的 Moderations 使用对象列表。
示例请求
1
2
3
curl "https://api.openai.com/v1/organization/usage/moderations?start_time=1730419200&limit=1" \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
响应
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{
"object": "page",
"data": [
{
"object": "bucket",
"start_time": 1730419200,
"end_time": 1730505600,
"results": [
{
"object": "organization.usage.moderations.result",
"input_tokens": 16,
"num_model_requests": 2,
"project_id": null,
"user_id": null,
"api_key_id": null,
"model": null
}
]
}
],
"has_more": false,
"next_page": null
}
Moderations usage 对象
特定时间存储桶的聚合审核使用情况详细信息。
OBJECT Moderations 使用对象
1
2
3
4
5
6
7
8
9
{
"object": "organization.usage.moderations.result",
"input_tokens": 20,
"num_model_requests": 2,
"project_id": "proj_abc",
"user_id": "user-abc",
"api_key_id": "key_abc",
"model": "text-moderation"
}
图像
获取 https://api.openai.com/v1/organization/usage/images
获取组织的映像使用情况详细信息。
查询参数
指定要返回的存储桶数。
bucket_width=1d
: 默认: 7, 最大: 31bucket_width=1h
: 默认: 24, 最大: 168bucket_width=1m
: 默认值: 60, 最大值: 1440
返回
分页、时间分段的 Images 使用对象列表。
示例请求
1
2
3
curl "https://api.openai.com/v1/organization/usage/images?start_time=1730419200&limit=1" \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
响应
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{
"object": "page",
"data": [
{
"object": "bucket",
"start_time": 1730419200,
"end_time": 1730505600,
"results": [
{
"object": "organization.usage.images.result",
"images": 2,
"num_model_requests": 2,
"size": null,
"source": null,
"project_id": null,
"user_id": null,
"api_key_id": null,
"model": null
}
]
}
],
"has_more": false,
"next_page": null
}
Images usage 对象
特定时间桶的聚合图像使用详情。
OBJECT 图像使用对象
1
2
3
4
5
6
7
8
9
10
11
{
"object": "organization.usage.images.result",
"images": 2,
"num_model_requests": 2,
"size": "1024x1024",
"source": "image.generation",
"project_id": "proj_abc",
"user_id": "user-abc",
"api_key_id": "key_abc",
"model": "dall-e-3"
}
音频演讲
获取 https://api.openai.com/v1/organization/usage/audio_speeches
获取组织的音频语音使用详细信息。
查询参数
指定要返回的存储桶数。
bucket_width=1d
: 默认: 7, 最大: 31bucket_width=1h
: 默认: 24, 最大: 168bucket_width=1m
: 默认值: 60, 最大值: 1440
返回
分页、时间分段的 Audio speeches 使用对象列表。
示例请求
1
2
3
curl "https://api.openai.com/v1/organization/usage/audio_speeches?start_time=1730419200&limit=1" \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
响应
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{
"object": "page",
"data": [
{
"object": "bucket",
"start_time": 1730419200,
"end_time": 1730505600,
"results": [
{
"object": "organization.usage.audio_speeches.result",
"characters": 45,
"num_model_requests": 1,
"project_id": null,
"user_id": null,
"api_key_id": null,
"model": null
}
]
}
],
"has_more": false,
"next_page": null
}
Audio speeches 使用对象
特定时间桶的聚合音频语音使用详细信息。
OBJECT Audio speeches usage 对象
1
2
3
4
5
6
7
8
9
{
"object": "organization.usage.audio_speeches.result",
"characters": 45,
"num_model_requests": 1,
"project_id": "proj_abc",
"user_id": "user-abc",
"api_key_id": "key_abc",
"model": "tts-1"
}
音频转录
获取 https://api.openai.com/v1/organization/usage/audio_transcriptions
获取组织的音频转录使用情况详细信息。
查询参数
指定要返回的存储桶数。
bucket_width=1d
: 默认: 7, 最大: 31bucket_width=1h
: 默认: 24, 最大: 168bucket_width=1m
: 默认值: 60, 最大值: 1440
返回
分页、时间分段的音频转录使用对象列表。
示例请求
1
2
3
curl "https://api.openai.com/v1/organization/usage/audio_transcriptions?start_time=1730419200&limit=1" \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
响应
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{
"object": "page",
"data": [
{
"object": "bucket",
"start_time": 1730419200,
"end_time": 1730505600,
"results": [
{
"object": "organization.usage.audio_transcriptions.result",
"seconds": 20,
"num_model_requests": 1,
"project_id": null,
"user_id": null,
"api_key_id": null,
"model": null
}
]
}
],
"has_more": false,
"next_page": null
}
Audio transcriptions usage 对象
特定时间存储桶的聚合音频转录使用情况详细信息。
OBJECT 音频转录使用对象
1
2
3
4
5
6
7
8
9
{
"object": "organization.usage.audio_transcriptions.result",
"seconds": 10,
"num_model_requests": 1,
"project_id": "proj_abc",
"user_id": "user-abc",
"api_key_id": "key_abc",
"model": "tts-1"
}
矢量存储
获取 https://api.openai.com/v1/organization/usage/vector_stores
获取 vector 存储组织的使用情况详细信息。
查询参数
指定要返回的存储桶数。
bucket_width=1d
: 默认: 7, 最大: 31bucket_width=1h
: 默认: 24, 最大: 168bucket_width=1m
: 默认值: 60, 最大值: 1440
返回
分页、时间分段的 Vector 列表存储使用对象。
示例请求
1
2
3
curl "https://api.openai.com/v1/organization/usage/vector_stores?start_time=1730419200&limit=1" \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
响应
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{
"object": "page",
"data": [
{
"object": "bucket",
"start_time": 1730419200,
"end_time": 1730505600,
"results": [
{
"object": "organization.usage.vector_stores.result",
"usage_bytes": 1024,
"project_id": null
}
]
}
],
"has_more": false,
"next_page": null
}
Vector 存储使用对象
代码解释器会话
获取 https://api.openai.com/v1/organization/usage/code_interpreter_sessions
获取组织的 Code Interpreter 会话使用详细信息。
查询参数
指定要返回的存储桶数。
bucket_width=1d
: 默认: 7, 最大: 31bucket_width=1h
: 默认: 24, 最大: 168bucket_width=1m
: 默认值: 60, 最大值: 1440
返回
分页、时间分段的 Code 解释器会话使用对象的列表。
示例请求
1
2
3
curl "https://api.openai.com/v1/organization/usage/code_interpreter_sessions?start_time=1730419200&limit=1" \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
响应
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
{
"object": "page",
"data": [
{
"object": "bucket",
"start_time": 1730419200,
"end_time": 1730505600,
"results": [
{
"object": "organization.usage.code_interpreter_sessions.result",
"sessions": 1,
"project_id": null
}
]
}
],
"has_more": false,
"next_page": null
}
代码解释器会话使用对象
成本
示例请求
1
2
3
curl "https://api.openai.com/v1/organization/costs?start_time=1730419200&limit=1" \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
响应
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
{
"object": "page",
"data": [
{
"object": "bucket",
"start_time": 1730419200,
"end_time": 1730505600,
"results": [
{
"object": "organization.costs.result",
"amount": {
"value": 0.06,
"currency": "usd"
},
"line_item": null,
"project_id": null
}
]
}
],
"has_more": false,
"next_page": null
}
costs 对象
特定时间桶的聚合成本详细信息。
OBJECT Costs 对象
1
2
3
4
5
6
7
8
9
{
"object": "organization.costs.result",
"amount": {
"value": 0.06,
"currency": "usd"
},
"line_item": "Image models",
"project_id": "proj_abc"
}