diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsageClient.Costs.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsageClient.Costs.g.cs
index f70875eb..e1b0f081 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsageClient.Costs.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.IUsageClient.Costs.g.cs
@@ -13,6 +13,7 @@ public partial interface IUsageClient
/// Default Value: 1d
///
///
+ ///
///
///
/// Default Value: 7
@@ -26,6 +27,7 @@ public partial interface IUsageClient
int? endTime = default,
global::tryAGI.OpenAI.UsageCostsBucketWidth? bucketWidth = default,
global::System.Collections.Generic.IList? projectIds = default,
+ global::System.Collections.Generic.IList? apiKeyIds = default,
global::System.Collections.Generic.IList? groupBy = default,
int? limit = default,
string? page = default,
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.CostsResult.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.CostsResult.g.cs
index 4650247e..3a206a8f 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.CostsResult.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.CostsResult.g.cs
@@ -33,6 +33,12 @@ public sealed partial class CostsResult
[global::System.Text.Json.Serialization.JsonPropertyName("project_id")]
public string? ProjectId { get; set; }
+ ///
+ ///
+ ///
+ [global::System.Text.Json.Serialization.JsonPropertyName("api_key_id")]
+ public string? ApiKeyId { get; set; }
+
///
/// Additional properties that are not explicitly defined in the schema
///
@@ -48,6 +54,7 @@ public sealed partial class CostsResult
///
///
///
+ ///
#if NET7_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
#endif
@@ -55,12 +62,14 @@ public CostsResult(
global::tryAGI.OpenAI.CostsResultObject @object,
global::tryAGI.OpenAI.CostsResultAmount? amount,
string? lineItem,
- string? projectId)
+ string? projectId,
+ string? apiKeyId)
{
this.Object = @object;
this.Amount = amount;
this.LineItem = lineItem;
this.ProjectId = projectId;
+ this.ApiKeyId = apiKeyId;
}
///
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.CostsResultApiKeyId.Json.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.CostsResultApiKeyId.Json.g.cs
new file mode 100644
index 00000000..72cbf083
--- /dev/null
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.CostsResultApiKeyId.Json.g.cs
@@ -0,0 +1,92 @@
+#nullable enable
+
+namespace tryAGI.OpenAI
+{
+ public sealed partial class CostsResultApiKeyId
+ {
+ ///
+ /// Serializes the current instance to a JSON string using the provided JsonSerializerContext.
+ ///
+ public string ToJson(
+ global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext)
+ {
+ return global::System.Text.Json.JsonSerializer.Serialize(
+ this,
+ this.GetType(),
+ jsonSerializerContext);
+ }
+
+ ///
+ /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions.
+ ///
+#if NET8_0_OR_GREATER
+ [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
+ [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")]
+#endif
+ public string ToJson(
+ global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null)
+ {
+ return global::System.Text.Json.JsonSerializer.Serialize(
+ this,
+ jsonSerializerOptions);
+ }
+
+ ///
+ /// Deserializes a JSON string using the provided JsonSerializerContext.
+ ///
+ public static global::tryAGI.OpenAI.CostsResultApiKeyId? FromJson(
+ string json,
+ global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext)
+ {
+ return global::System.Text.Json.JsonSerializer.Deserialize(
+ json,
+ typeof(global::tryAGI.OpenAI.CostsResultApiKeyId),
+ jsonSerializerContext) as global::tryAGI.OpenAI.CostsResultApiKeyId;
+ }
+
+ ///
+ /// Deserializes a JSON string using the provided JsonSerializerOptions.
+ ///
+#if NET8_0_OR_GREATER
+ [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
+ [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")]
+#endif
+ public static global::tryAGI.OpenAI.CostsResultApiKeyId? FromJson(
+ string json,
+ global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null)
+ {
+ return global::System.Text.Json.JsonSerializer.Deserialize(
+ json,
+ jsonSerializerOptions);
+ }
+
+ ///
+ /// Deserializes a JSON stream using the provided JsonSerializerContext.
+ ///
+ public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync(
+ global::System.IO.Stream jsonStream,
+ global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext)
+ {
+ return (await global::System.Text.Json.JsonSerializer.DeserializeAsync(
+ jsonStream,
+ typeof(global::tryAGI.OpenAI.CostsResultApiKeyId),
+ jsonSerializerContext).ConfigureAwait(false)) as global::tryAGI.OpenAI.CostsResultApiKeyId;
+ }
+
+ ///
+ /// Deserializes a JSON stream using the provided JsonSerializerOptions.
+ ///
+#if NET8_0_OR_GREATER
+ [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
+ [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")]
+#endif
+ public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync(
+ global::System.IO.Stream jsonStream,
+ global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null)
+ {
+ return global::System.Text.Json.JsonSerializer.DeserializeAsync(
+ jsonStream,
+ jsonSerializerOptions);
+ }
+ }
+}
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.CostsResultApiKeyId.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.CostsResultApiKeyId.g.cs
new file mode 100644
index 00000000..81218062
--- /dev/null
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.CostsResultApiKeyId.g.cs
@@ -0,0 +1,18 @@
+
+#nullable enable
+
+namespace tryAGI.OpenAI
+{
+ ///
+ ///
+ ///
+ public sealed partial class CostsResultApiKeyId
+ {
+
+ ///
+ /// Additional properties that are not explicitly defined in the schema
+ ///
+ [global::System.Text.Json.Serialization.JsonExtensionData]
+ public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary();
+ }
+}
\ No newline at end of file
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.UsageCostsGroupByItem.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.UsageCostsGroupByItem.g.cs
index 000b1ec0..5173b455 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.UsageCostsGroupByItem.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.UsageCostsGroupByItem.g.cs
@@ -8,6 +8,10 @@ namespace tryAGI.OpenAI
///
public enum UsageCostsGroupByItem
{
+ ///
+ ///
+ ///
+ ApiKeyId,
///
///
///
@@ -30,6 +34,7 @@ public static string ToValueString(this UsageCostsGroupByItem value)
{
return value switch
{
+ UsageCostsGroupByItem.ApiKeyId => "api_key_id",
UsageCostsGroupByItem.LineItem => "line_item",
UsageCostsGroupByItem.ProjectId => "project_id",
_ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null),
@@ -42,6 +47,7 @@ public static string ToValueString(this UsageCostsGroupByItem value)
{
return value switch
{
+ "api_key_id" => UsageCostsGroupByItem.ApiKeyId,
"line_item" => UsageCostsGroupByItem.LineItem,
"project_id" => UsageCostsGroupByItem.ProjectId,
_ => null,
diff --git a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsageClient.Costs.g.cs b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsageClient.Costs.g.cs
index 91fc4deb..46b47f7d 100644
--- a/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsageClient.Costs.g.cs
+++ b/src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.UsageClient.Costs.g.cs
@@ -31,6 +31,7 @@ partial void PrepareCostsArguments(
ref int? endTime,
ref global::tryAGI.OpenAI.UsageCostsBucketWidth? bucketWidth,
global::System.Collections.Generic.IList? projectIds,
+ global::System.Collections.Generic.IList? apiKeyIds,
global::System.Collections.Generic.IList? groupBy,
ref int? limit,
ref string? page);
@@ -41,6 +42,7 @@ partial void PrepareCostsRequest(
int? endTime,
global::tryAGI.OpenAI.UsageCostsBucketWidth? bucketWidth,
global::System.Collections.Generic.IList? projectIds,
+ global::System.Collections.Generic.IList? apiKeyIds,
global::System.Collections.Generic.IList? groupBy,
int? limit,
string? page);
@@ -62,6 +64,7 @@ partial void ProcessCostsResponseContent(
/// Default Value: 1d
///
///
+ ///
///
///
/// Default Value: 7
@@ -75,6 +78,7 @@ partial void ProcessCostsResponseContent(
int? endTime = default,
global::tryAGI.OpenAI.UsageCostsBucketWidth? bucketWidth = default,
global::System.Collections.Generic.IList? projectIds = default,
+ global::System.Collections.Generic.IList? apiKeyIds = default,
global::System.Collections.Generic.IList? groupBy = default,
int? limit = default,
string? page = default,
@@ -89,6 +93,7 @@ partial void ProcessCostsResponseContent(
endTime: ref endTime,
bucketWidth: ref bucketWidth,
projectIds: projectIds,
+ apiKeyIds: apiKeyIds,
groupBy: groupBy,
limit: ref limit,
page: ref page);
@@ -123,6 +128,7 @@ partial void ProcessCostsResponseContent(
.AddOptionalParameter("end_time", endTime?.ToString())
.AddOptionalParameter("bucket_width", bucketWidth?.ToValueString())
.AddOptionalParameter("project_ids", projectIds, delimiter: ",", explode: true)
+ .AddOptionalParameter("api_key_ids", apiKeyIds, delimiter: ",", explode: true)
.AddOptionalParameter("group_by", groupBy, selector: static x => x.ToValueString(), delimiter: ",", explode: true)
.AddOptionalParameter("limit", limit?.ToString())
.AddOptionalParameter("page", page)
@@ -171,6 +177,7 @@ partial void ProcessCostsResponseContent(
endTime: endTime,
bucketWidth: bucketWidth,
projectIds: projectIds,
+ apiKeyIds: apiKeyIds,
groupBy: groupBy,
limit: limit,
page: page);
diff --git a/src/libs/tryAGI.OpenAI/openapi.yaml b/src/libs/tryAGI.OpenAI/openapi.yaml
index a7bc4d72..6875cc5c 100644
--- a/src/libs/tryAGI.OpenAI/openapi.yaml
+++ b/src/libs/tryAGI.OpenAI/openapi.yaml
@@ -14266,6 +14266,64 @@ paths:
curl https://api.openai.com/v1/organization/audit_logs \
-H "Authorization: Bearer $OPENAI_ADMIN_KEY" \
-H "Content-Type: application/json"
+ node.js: >-
+ import OpenAI from 'openai';
+
+
+ const client = new OpenAI({
+ adminAPIKey: process.env['OPENAI_ADMIN_KEY'], // This is the default and can be omitted
+ });
+
+
+ // Automatically fetches more pages as needed.
+
+ for await (const auditLogListResponse of
+ client.admin.organization.auditLogs.list()) {
+ console.log(auditLogListResponse.id);
+ }
+ python: |-
+ import os
+ from openai import OpenAI
+
+ client = OpenAI(
+ admin_api_key=os.environ.get("OPENAI_ADMIN_KEY"), # This is the default and can be omitted
+ )
+ page = client.admin.organization.audit_logs.list()
+ page = page.data[0]
+ print(page.id)
+ go: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/openai/openai-go\"\n\t\"github.com/openai/openai-go/option\"\n)\n\nfunc main() {\n\tclient := openai.NewClient(\n\t\toption.WithAdminAPIKey(\"My Admin API Key\"),\n\t)\n\tpage, err := client.Admin.Organization.AuditLogs.List(context.TODO(), openai.AdminOrganizationAuditLogListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n"
+ java: >-
+ package com.openai.example;
+
+
+ import com.openai.client.OpenAIClient;
+
+ import com.openai.client.okhttp.OpenAIOkHttpClient;
+
+ import
+ com.openai.models.admin.organization.auditlogs.AuditLogListPage;
+
+ import
+ com.openai.models.admin.organization.auditlogs.AuditLogListParams;
+
+
+ public final class Main {
+ private Main() {}
+
+ public static void main(String[] args) {
+ OpenAIClient client = OpenAIOkHttpClient.fromEnv();
+
+ AuditLogListPage page = client.admin().organization().auditLogs().list();
+ }
+ }
+ ruby: |-
+ require "openai"
+
+ openai = OpenAI::Client.new(admin_api_key: "My Admin API Key")
+
+ page = openai.admin.organization.audit_logs.list
+
+ puts(page)
response: |
{
"object": "list",
@@ -14788,11 +14846,19 @@ paths:
type: array
items:
type: string
+ - name: api_key_ids
+ in: query
+ description: Return only costs for these API keys.
+ required: false
+ schema:
+ type: array
+ items:
+ type: string
- name: group_by
in: query
description: >-
Group the costs by the specified fields. Support fields include
- `project_id`, `line_item` and any combination of them.
+ `project_id`, `line_item`, `api_key_id` and any combination of them.
required: false
schema:
type: array
@@ -14801,6 +14867,7 @@ paths:
enum:
- project_id
- line_item
+ - api_key_id
- name: limit
in: query
description: >
@@ -14853,7 +14920,8 @@ paths:
"currency": "usd"
},
"line_item": null,
- "project_id": null
+ "project_id": null,
+ "api_key_id": null
}
]
}
@@ -36840,6 +36908,13 @@ components:
When `group_by=project_id`, this field provides the project ID
of the grouped costs result.
- type: 'null'
+ api_key_id:
+ anyOf:
+ - type: string
+ description: >-
+ When `group_by=api_key_id`, this field provides the API Key ID
+ of the grouped costs result.
+ - type: 'null'
required:
- object
x-oaiMeta: