You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: OpenAI_API/APIAuthentication.cs
+34-39Lines changed: 34 additions & 39 deletions
Original file line number
Diff line number
Diff line change
@@ -1,10 +1,5 @@
1
1
usingSystem;
2
-
usingSystem.Collections.Generic;
3
-
usingSystem.Dynamic;
4
2
usingSystem.IO;
5
-
usingSystem.Linq;
6
-
usingSystem.Runtime.CompilerServices;
7
-
usingSystem.Text;
8
3
9
4
namespaceOpenAI_API
10
5
{
@@ -17,10 +12,10 @@ public class APIAuthentication
17
12
/// The API key, required to access the API endpoint.
18
13
/// </summary>
19
14
publicstringApiKey{get;set;}
20
-
/// <summary>
21
-
/// The Organization ID to count API requests against. This can be found at https://beta.openai.com/account/org-settings.
22
-
/// </summary>
23
-
publicstringOpenAIOrganization{get;set;}
15
+
/// <summary>
16
+
/// The Organization ID to count API requests against. This can be found at https://beta.openai.com/account/org-settings.
17
+
/// </summary>
18
+
publicstringOpenAIOrganization{get;set;}
24
19
25
20
/// <summary>
26
21
/// Allows implicit casting from a string, so that a simple string API key can be provided in place of an instance of <see cref="APIAuthentication"/>
@@ -41,18 +36,18 @@ public APIAuthentication(string apiKey)
41
36
}
42
37
43
38
44
-
/// <summary>
45
-
/// Instantiates a new Authentication object with the given <paramref name="apiKey"/>, which may be <see langword="null"/>. For users who belong to multiple organizations, you can specify which organization is used. Usage from these API requests will count against the specified organization's subscription quota.
46
-
/// </summary>
47
-
/// <param name="apiKey">The API key, required to access the API endpoint.</param>
48
-
/// <param name="openAIOrganization">The Organization ID to count API requests against. This can be found at https://beta.openai.com/account/org-settings.</param>
/// Instantiates a new Authentication object with the given <paramref name="apiKey"/>, which may be <see langword="null"/>. For users who belong to multiple organizations, you can specify which organization is used. Usage from these API requests will count against the specified organization's subscription quota.
41
+
/// </summary>
42
+
/// <param name="apiKey">The API key, required to access the API endpoint.</param>
43
+
/// <param name="openAIOrganization">The Organization ID to count API requests against. This can be found at https://beta.openai.com/account/org-settings.</param>
/// The default authentication to use when no other auth is specified. This can be set manually, or automatically loaded via environment variables or a config file. <seealso cref="LoadFromEnv"/><seealso cref="LoadFromPath(string, string, bool)"/>
@@ -79,25 +74,25 @@ public static APIAuthentication Default
79
74
}
80
75
}
81
76
82
-
/// <summary>
83
-
/// Attempts to load api key from environment variables, as "OPENAI_KEY" or "OPENAI_API_KEY". Also loads org if from "OPENAI_ORGANIZATION" if present.
84
-
/// </summary>
85
-
/// <returns>Returns the loaded <see cref="APIAuthentication"/> any api keys were found, or <see langword="null"/> if there were no matching environment vars.</returns>
86
-
publicstaticAPIAuthenticationLoadFromEnv()
77
+
/// <summary>
78
+
/// Attempts to load api key from environment variables, as "OPENAI_KEY" or "OPENAI_API_KEY". Also loads org if from "OPENAI_ORGANIZATION" if present.
79
+
/// </summary>
80
+
/// <returns>Returns the loaded <see cref="APIAuthentication"/> any api keys were found, or <see langword="null"/> if there were no matching environment vars.</returns>
/// The organization associated with the API request, as reported by the API.
36
+
/// </summary>
37
+
[JsonIgnore]
38
+
publicstringOrganization{get;internalset;}
39
+
40
+
/// <summary>
41
+
/// The server-side processing time as reported by the API. This can be useful for debugging where a delay occurs.
42
+
/// </summary>
43
+
[JsonIgnore]
44
+
publicTimeSpanProcessingTime{get;internalset;}
45
+
46
+
/// <summary>
47
+
/// The request id of this API call, as reported in the response headers. This may be useful for troubleshooting or when contacting OpenAI support in reference to a specific request.
48
+
/// </summary>
49
+
[JsonIgnore]
50
+
publicstringRequestId{get;internalset;}
51
+
52
+
/// <summary>
53
+
/// The Openai-Version used to generate this response, as reported in the response headers. This may be useful for troubleshooting or when contacting OpenAI support in reference to a specific request.
0 commit comments