diff --git a/src/libs/OpenRouter/Generated/OpenRouter.ApiKeysClient.List.g.cs b/src/libs/OpenRouter/Generated/OpenRouter.ApiKeysClient.List.g.cs
index 5ffbab30..fe8a0d34 100644
--- a/src/libs/OpenRouter/Generated/OpenRouter.ApiKeysClient.List.g.cs
+++ b/src/libs/OpenRouter/Generated/OpenRouter.ApiKeysClient.List.g.cs
@@ -27,16 +27,18 @@ public partial class ApiKeysClient
};
partial void PrepareListArguments(
global::System.Net.Http.HttpClient httpClient,
+ ref int? offset,
+ ref int? limit,
ref bool? includeDisabled,
ref bool? includeExpired,
- ref int? offset,
ref global::System.Guid? workspaceId);
partial void PrepareListRequest(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpRequestMessage httpRequestMessage,
+ int? offset,
+ int? limit,
bool? includeDisabled,
bool? includeExpired,
- int? offset,
global::System.Guid? workspaceId);
partial void ProcessListResponse(
global::System.Net.Http.HttpClient httpClient,
@@ -51,6 +53,16 @@ partial void ProcessListResponseContent(
/// List API keys
/// List all API keys for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required.
///
+ ///
+ /// Number of records to skip for pagination
+ /// Default Value: 0
+ /// Example: 0
+ ///
+ ///
+ /// Maximum number of records to return (max 100)
+ /// Default Value: 100
+ /// Example: 100
+ ///
///
/// Whether to include disabled API keys in the response
/// Example: false
@@ -59,10 +71,6 @@ partial void ProcessListResponseContent(
/// Whether to include expired API keys in the response. Expired keys are excluded by default and returned only when this is true.
/// Example: false
///
- ///
- /// Number of API keys to skip for pagination
- /// Example: 0
- ///
///
/// Filter API keys by workspace ID. By default, keys in the default workspace are returned.
/// Example: 0df9e665-d932-5740-b2c7-b52af166bc11
@@ -71,17 +79,19 @@ partial void ProcessListResponseContent(
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task ListAsync(
+ int? offset = default,
+ int? limit = default,
bool? includeDisabled = default,
bool? includeExpired = default,
- int? offset = default,
global::System.Guid? workspaceId = default,
global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __response = await ListAsResponseAsync(
+ offset: offset,
+ limit: limit,
includeDisabled: includeDisabled,
includeExpired: includeExpired,
- offset: offset,
workspaceId: workspaceId,
requestOptions: requestOptions,
cancellationToken: cancellationToken
@@ -93,6 +103,16 @@ partial void ProcessListResponseContent(
/// List API keys
/// List all API keys for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required.
///
+ ///
+ /// Number of records to skip for pagination
+ /// Default Value: 0
+ /// Example: 0
+ ///
+ ///
+ /// Maximum number of records to return (max 100)
+ /// Default Value: 100
+ /// Example: 100
+ ///
///
/// Whether to include disabled API keys in the response
/// Example: false
@@ -101,10 +121,6 @@ partial void ProcessListResponseContent(
/// Whether to include expired API keys in the response. Expired keys are excluded by default and returned only when this is true.
/// Example: false
///
- ///
- /// Number of API keys to skip for pagination
- /// Example: 0
- ///
///
/// Filter API keys by workspace ID. By default, keys in the default workspace are returned.
/// Example: 0df9e665-d932-5740-b2c7-b52af166bc11
@@ -113,9 +129,10 @@ partial void ProcessListResponseContent(
/// The token to cancel the operation with
///
public async global::System.Threading.Tasks.Task> ListAsResponseAsync(
+ int? offset = default,
+ int? limit = default,
bool? includeDisabled = default,
bool? includeExpired = default,
- int? offset = default,
global::System.Guid? workspaceId = default,
global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
@@ -124,9 +141,10 @@ partial void ProcessListResponseContent(
client: HttpClient);
PrepareListArguments(
httpClient: HttpClient,
+ offset: ref offset,
+ limit: ref limit,
includeDisabled: ref includeDisabled,
includeExpired: ref includeExpired,
- offset: ref offset,
workspaceId: ref workspaceId);
@@ -156,9 +174,10 @@ partial void ProcessListResponseContent(
path: "/keys",
baseUri: HttpClient.BaseAddress ?? new global::System.Uri("https://openrouter.ai/api/v1", global::System.UriKind.RelativeOrAbsolute));
__pathBuilder
+ .AddOptionalParameter("offset", offset?.ToString())
+ .AddOptionalParameter("limit", limit?.ToString())
.AddOptionalParameter("include_disabled", includeDisabled?.ToString().ToLowerInvariant())
.AddOptionalParameter("include_expired", includeExpired?.ToString().ToLowerInvariant())
- .AddOptionalParameter("offset", offset?.ToString())
.AddOptionalParameter("workspace_id", workspaceId?.ToString())
;
var __path = __pathBuilder.ToString();
@@ -201,9 +220,10 @@ partial void ProcessListResponseContent(
PrepareListRequest(
httpClient: HttpClient,
httpRequestMessage: __httpRequest,
+ offset: offset,
+ limit: limit,
includeDisabled: includeDisabled,
includeExpired: includeExpired,
- offset: offset,
workspaceId: workspaceId);
return __httpRequest;
diff --git a/src/libs/OpenRouter/Generated/OpenRouter.GenerationsClient.GetGeneration.g.cs b/src/libs/OpenRouter/Generated/OpenRouter.GenerationsClient.GetGeneration.g.cs
index 9c2b2a2c..131675dc 100644
--- a/src/libs/OpenRouter/Generated/OpenRouter.GenerationsClient.GetGeneration.g.cs
+++ b/src/libs/OpenRouter/Generated/OpenRouter.GenerationsClient.GetGeneration.g.cs
@@ -444,6 +444,43 @@ partial void ProcessGetGenerationResponseContent(
h => h.Key,
h => h.Value));
}
+ // Forbidden - The management key does not have permission for this request
+ if ((int)__response.StatusCode == 403)
+ {
+ string? __content_403 = null;
+ global::System.Exception? __exception_403 = null;
+ global::OpenRouter.ForbiddenResponse? __value_403 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_403 = global::OpenRouter.ForbiddenResponse.FromJson(__content_403, JsonSerializerContext);
+ }
+ else
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_403 = global::OpenRouter.ForbiddenResponse.FromJson(__content_403, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_403 = __ex;
+ }
+
+
+ throw global::OpenRouter.ApiException.Create(
+ statusCode: __response.StatusCode,
+ message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_403,
+ responseBody: __content_403,
+ responseObject: __value_403,
+ responseHeaders: global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value));
+ }
// Not Found - Resource does not exist
if ((int)__response.StatusCode == 404)
{
diff --git a/src/libs/OpenRouter/Generated/OpenRouter.IApiKeysClient.List.g.cs b/src/libs/OpenRouter/Generated/OpenRouter.IApiKeysClient.List.g.cs
index 57a31410..5ccc30e4 100644
--- a/src/libs/OpenRouter/Generated/OpenRouter.IApiKeysClient.List.g.cs
+++ b/src/libs/OpenRouter/Generated/OpenRouter.IApiKeysClient.List.g.cs
@@ -8,6 +8,16 @@ public partial interface IApiKeysClient
/// List API keys
/// List all API keys for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required.
///
+ ///
+ /// Number of records to skip for pagination
+ /// Default Value: 0
+ /// Example: 0
+ ///
+ ///
+ /// Maximum number of records to return (max 100)
+ /// Default Value: 100
+ /// Example: 100
+ ///
///
/// Whether to include disabled API keys in the response
/// Example: false
@@ -16,10 +26,6 @@ public partial interface IApiKeysClient
/// Whether to include expired API keys in the response. Expired keys are excluded by default and returned only when this is true.
/// Example: false
///
- ///
- /// Number of API keys to skip for pagination
- /// Example: 0
- ///
///
/// Filter API keys by workspace ID. By default, keys in the default workspace are returned.
/// Example: 0df9e665-d932-5740-b2c7-b52af166bc11
@@ -28,9 +34,10 @@ public partial interface IApiKeysClient
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task ListAsync(
+ int? offset = default,
+ int? limit = default,
bool? includeDisabled = default,
bool? includeExpired = default,
- int? offset = default,
global::System.Guid? workspaceId = default,
global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
@@ -38,6 +45,16 @@ public partial interface IApiKeysClient
/// List API keys
/// List all API keys for the authenticated user. [Management key](/docs/guides/overview/auth/management-api-keys) required.
///
+ ///
+ /// Number of records to skip for pagination
+ /// Default Value: 0
+ /// Example: 0
+ ///
+ ///
+ /// Maximum number of records to return (max 100)
+ /// Default Value: 100
+ /// Example: 100
+ ///
///
/// Whether to include disabled API keys in the response
/// Example: false
@@ -46,10 +63,6 @@ public partial interface IApiKeysClient
/// Whether to include expired API keys in the response. Expired keys are excluded by default and returned only when this is true.
/// Example: false
///
- ///
- /// Number of API keys to skip for pagination
- /// Example: 0
- ///
///
/// Filter API keys by workspace ID. By default, keys in the default workspace are returned.
/// Example: 0df9e665-d932-5740-b2c7-b52af166bc11
@@ -58,9 +71,10 @@ public partial interface IApiKeysClient
/// The token to cancel the operation with
///
global::System.Threading.Tasks.Task> ListAsResponseAsync(
+ int? offset = default,
+ int? limit = default,
bool? includeDisabled = default,
bool? includeExpired = default,
- int? offset = default,
global::System.Guid? workspaceId = default,
global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
diff --git a/src/libs/OpenRouter/Generated/OpenRouter.IInterns2Client.Chat.g.cs b/src/libs/OpenRouter/Generated/OpenRouter.IInterns2Client.Chat.g.cs
deleted file mode 100644
index 0deda4ba..00000000
--- a/src/libs/OpenRouter/Generated/OpenRouter.IInterns2Client.Chat.g.cs
+++ /dev/null
@@ -1,96 +0,0 @@
-#nullable enable
-
-namespace OpenRouter
-{
- public partial interface IInterns2Client
- {
- ///
- /// Stream a chat completion with an intern
- /// Sends a prompt to one of your interns and streams the reply as OpenAI-compatible server-sent events ending with `[DONE]`. The run executes on the intern, which may pause to ask you something. It then streams one `openrouter.provide_input` tool call and finishes with `finish_reason: "tool_calls"`, and the run stays open on the intern.
- /// Every response, whether it ends with `stop`, `tool_calls` or `error`, is followed by a final chunk with empty `choices` that carries `session_id`, then `data: [DONE]`. That chunk carries the `usage` the intern reported for the run, after `stop` or `error`, and `null` when the intern reported none. After `tool_calls` its `usage` is `null` because the turn is not over. Read through `[DONE]`: the `session_id` you need to reply arrives after the `tool_calls` finish chunk.
- /// To answer, send a second request with the same `session_id`, the assistant message echoing that tool call, and a `tool` message whose `tool_call_id` is the tool call id and whose `content` is the answer. The answer is delivered to the run that asked and the stream continues from where it paused. A question stays open for its interaction deadline (5 minutes by default) and the run is cancelled when that passes. Rejected replies do not extend the deadline.
- /// Closing the connection after the `[DONE]` that follows `finish_reason: "tool_calls"` keeps the run alive. Disconnecting while a response is still streaming cancels the run. The stream writes a `: keepalive` comment whenever nothing else has been written for 30 seconds, so a disconnect is noticed within that interval even while the intern is silent.
- /// A run the intern ends while you are still connected, by cancellation or by a deadline, ends the stream with a `finish_reason: "error"` chunk carrying `410` and reason `run_ended`, then the final empty-`choices` chunk and `[DONE]`. That error reports only an ending the intern confirmed. A connection that breaks without that confirmation ends with reason `stream_severed`, and a client that has already disconnected is promised no final event.
- /// Set `approval_mode` to `manual` to have the intern ask before approval-bearing tools such as the shell. Omitted, the run self-drives and consents on your behalf. The mode belongs to the run started by that prompt and must be repeated on later prompts.
- /// Available to interns programme members. Callers outside the programme receive `404` for every path under `/api/v1/interns`.
- ///
- ///
- /// The intern to talk to.
- /// Example: a11e0000-0000-4000-8000-000000000005
- ///
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- global::System.Threading.Tasks.Task ChatAsync(
- string internId,
-
- global::OpenRouter.InternChatCompletionRequest request,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default);
- ///
- /// Stream a chat completion with an intern
- /// Sends a prompt to one of your interns and streams the reply as OpenAI-compatible server-sent events ending with `[DONE]`. The run executes on the intern, which may pause to ask you something. It then streams one `openrouter.provide_input` tool call and finishes with `finish_reason: "tool_calls"`, and the run stays open on the intern.
- /// Every response, whether it ends with `stop`, `tool_calls` or `error`, is followed by a final chunk with empty `choices` that carries `session_id`, then `data: [DONE]`. That chunk carries the `usage` the intern reported for the run, after `stop` or `error`, and `null` when the intern reported none. After `tool_calls` its `usage` is `null` because the turn is not over. Read through `[DONE]`: the `session_id` you need to reply arrives after the `tool_calls` finish chunk.
- /// To answer, send a second request with the same `session_id`, the assistant message echoing that tool call, and a `tool` message whose `tool_call_id` is the tool call id and whose `content` is the answer. The answer is delivered to the run that asked and the stream continues from where it paused. A question stays open for its interaction deadline (5 minutes by default) and the run is cancelled when that passes. Rejected replies do not extend the deadline.
- /// Closing the connection after the `[DONE]` that follows `finish_reason: "tool_calls"` keeps the run alive. Disconnecting while a response is still streaming cancels the run. The stream writes a `: keepalive` comment whenever nothing else has been written for 30 seconds, so a disconnect is noticed within that interval even while the intern is silent.
- /// A run the intern ends while you are still connected, by cancellation or by a deadline, ends the stream with a `finish_reason: "error"` chunk carrying `410` and reason `run_ended`, then the final empty-`choices` chunk and `[DONE]`. That error reports only an ending the intern confirmed. A connection that breaks without that confirmation ends with reason `stream_severed`, and a client that has already disconnected is promised no final event.
- /// Set `approval_mode` to `manual` to have the intern ask before approval-bearing tools such as the shell. Omitted, the run self-drives and consents on your behalf. The mode belongs to the run started by that prompt and must be repeated on later prompts.
- /// Available to interns programme members. Callers outside the programme receive `404` for every path under `/api/v1/interns`.
- ///
- ///
- /// The intern to talk to.
- /// Example: a11e0000-0000-4000-8000-000000000005
- ///
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- global::System.Threading.Tasks.Task> ChatAsResponseAsync(
- string internId,
-
- global::OpenRouter.InternChatCompletionRequest request,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default);
- ///
- /// Stream a chat completion with an intern
- /// Sends a prompt to one of your interns and streams the reply as OpenAI-compatible server-sent events ending with `[DONE]`. The run executes on the intern, which may pause to ask you something. It then streams one `openrouter.provide_input` tool call and finishes with `finish_reason: "tool_calls"`, and the run stays open on the intern.
- /// Every response, whether it ends with `stop`, `tool_calls` or `error`, is followed by a final chunk with empty `choices` that carries `session_id`, then `data: [DONE]`. That chunk carries the `usage` the intern reported for the run, after `stop` or `error`, and `null` when the intern reported none. After `tool_calls` its `usage` is `null` because the turn is not over. Read through `[DONE]`: the `session_id` you need to reply arrives after the `tool_calls` finish chunk.
- /// To answer, send a second request with the same `session_id`, the assistant message echoing that tool call, and a `tool` message whose `tool_call_id` is the tool call id and whose `content` is the answer. The answer is delivered to the run that asked and the stream continues from where it paused. A question stays open for its interaction deadline (5 minutes by default) and the run is cancelled when that passes. Rejected replies do not extend the deadline.
- /// Closing the connection after the `[DONE]` that follows `finish_reason: "tool_calls"` keeps the run alive. Disconnecting while a response is still streaming cancels the run. The stream writes a `: keepalive` comment whenever nothing else has been written for 30 seconds, so a disconnect is noticed within that interval even while the intern is silent.
- /// A run the intern ends while you are still connected, by cancellation or by a deadline, ends the stream with a `finish_reason: "error"` chunk carrying `410` and reason `run_ended`, then the final empty-`choices` chunk and `[DONE]`. That error reports only an ending the intern confirmed. A connection that breaks without that confirmation ends with reason `stream_severed`, and a client that has already disconnected is promised no final event.
- /// Set `approval_mode` to `manual` to have the intern ask before approval-bearing tools such as the shell. Omitted, the run self-drives and consents on your behalf. The mode belongs to the run started by that prompt and must be repeated on later prompts.
- /// Available to interns programme members. Callers outside the programme receive `404` for every path under `/api/v1/interns`.
- ///
- ///
- /// The intern to talk to.
- /// Example: a11e0000-0000-4000-8000-000000000005
- ///
- ///
- /// How the run started by this prompt handles tool approvals. `self-drive` (the default when omitted) consents on your behalf and runs the shell unsandboxed. `manual` asks you before an approval-bearing tool runs, as an `openrouter.provide_input` permission request, and keeps the shell sandboxed until an escalation is allowed. The mode applies to the run this prompt starts and is not remembered by the session. Repeat it on each new prompt that should use it. A `tool` reply continues the run under the mode it started with.
- /// Example: manual
- ///
- ///
- /// The conversation. Only the last message is read. A last `user` message starts a run. A last `tool` message answers the interaction named by its `tool_call_id` and requires `session_id`.
- ///
- ///
- /// Accepted for OpenAI compatibility and never used. The intern runs the model configured on it (`PATCH` the intern to change it). Streamed chunks report the runtime's identifier for that model as the intern reports it, or `openrouter/intern` on chunks whose event carries no model (before the intern reports one, and on the chunks the API emits itself: the timeout, run-ended and severed-stream error chunks, the stop chunk of a replay that ends without a terminal daemon event, and the final usage chunk after any of them). A usage chunk that follows a daemon completion event carries the model the intern reported.
- /// Example: openrouter/intern
- ///
- ///
- /// The daemon session to continue, as returned in `session_id` on the final chunk of an earlier response. Omit it to start a new session. An id the intern has not seen before is not an error: it starts a new session under that id, so a mistyped id forks the conversation. Sessions are scoped to the intern's own daemon. Required when the last message has role `tool`.
- /// Example: ses_7f3c9a
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- global::System.Threading.Tasks.Task ChatAsync(
- string internId,
- global::System.Collections.Generic.IList messages,
- global::OpenRouter.InternApprovalMode? approvalMode = default,
- string? model = default,
- string? sessionId = default,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default);
- }
-}
\ No newline at end of file
diff --git a/src/libs/OpenRouter/Generated/OpenRouter.IInterns2Client.ChatAsStream.g.cs b/src/libs/OpenRouter/Generated/OpenRouter.IInterns2Client.ChatAsStream.g.cs
deleted file mode 100644
index bb7012c2..00000000
--- a/src/libs/OpenRouter/Generated/OpenRouter.IInterns2Client.ChatAsStream.g.cs
+++ /dev/null
@@ -1,72 +0,0 @@
-#nullable enable
-
-namespace OpenRouter
-{
- public partial interface IInterns2Client
- {
- ///
- /// Stream a chat completion with an intern
- /// Sends a prompt to one of your interns and streams the reply as OpenAI-compatible server-sent events ending with `[DONE]`. The run executes on the intern, which may pause to ask you something. It then streams one `openrouter.provide_input` tool call and finishes with `finish_reason: "tool_calls"`, and the run stays open on the intern.
- /// Every response, whether it ends with `stop`, `tool_calls` or `error`, is followed by a final chunk with empty `choices` that carries `session_id`, then `data: [DONE]`. That chunk carries the `usage` the intern reported for the run, after `stop` or `error`, and `null` when the intern reported none. After `tool_calls` its `usage` is `null` because the turn is not over. Read through `[DONE]`: the `session_id` you need to reply arrives after the `tool_calls` finish chunk.
- /// To answer, send a second request with the same `session_id`, the assistant message echoing that tool call, and a `tool` message whose `tool_call_id` is the tool call id and whose `content` is the answer. The answer is delivered to the run that asked and the stream continues from where it paused. A question stays open for its interaction deadline (5 minutes by default) and the run is cancelled when that passes. Rejected replies do not extend the deadline.
- /// Closing the connection after the `[DONE]` that follows `finish_reason: "tool_calls"` keeps the run alive. Disconnecting while a response is still streaming cancels the run. The stream writes a `: keepalive` comment whenever nothing else has been written for 30 seconds, so a disconnect is noticed within that interval even while the intern is silent.
- /// A run the intern ends while you are still connected, by cancellation or by a deadline, ends the stream with a `finish_reason: "error"` chunk carrying `410` and reason `run_ended`, then the final empty-`choices` chunk and `[DONE]`. That error reports only an ending the intern confirmed. A connection that breaks without that confirmation ends with reason `stream_severed`, and a client that has already disconnected is promised no final event.
- /// Set `approval_mode` to `manual` to have the intern ask before approval-bearing tools such as the shell. Omitted, the run self-drives and consents on your behalf. The mode belongs to the run started by that prompt and must be repeated on later prompts.
- /// Available to interns programme members. Callers outside the programme receive `404` for every path under `/api/v1/interns`.
- ///
- ///
- /// The intern to talk to.
- /// Example: a11e0000-0000-4000-8000-000000000005
- ///
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- global::System.Collections.Generic.IAsyncEnumerable ChatAsStreamAsync(
- string internId,
-
- global::OpenRouter.InternChatCompletionRequest request,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default);
- ///
- /// Stream a chat completion with an intern
- /// Sends a prompt to one of your interns and streams the reply as OpenAI-compatible server-sent events ending with `[DONE]`. The run executes on the intern, which may pause to ask you something. It then streams one `openrouter.provide_input` tool call and finishes with `finish_reason: "tool_calls"`, and the run stays open on the intern.
- /// Every response, whether it ends with `stop`, `tool_calls` or `error`, is followed by a final chunk with empty `choices` that carries `session_id`, then `data: [DONE]`. That chunk carries the `usage` the intern reported for the run, after `stop` or `error`, and `null` when the intern reported none. After `tool_calls` its `usage` is `null` because the turn is not over. Read through `[DONE]`: the `session_id` you need to reply arrives after the `tool_calls` finish chunk.
- /// To answer, send a second request with the same `session_id`, the assistant message echoing that tool call, and a `tool` message whose `tool_call_id` is the tool call id and whose `content` is the answer. The answer is delivered to the run that asked and the stream continues from where it paused. A question stays open for its interaction deadline (5 minutes by default) and the run is cancelled when that passes. Rejected replies do not extend the deadline.
- /// Closing the connection after the `[DONE]` that follows `finish_reason: "tool_calls"` keeps the run alive. Disconnecting while a response is still streaming cancels the run. The stream writes a `: keepalive` comment whenever nothing else has been written for 30 seconds, so a disconnect is noticed within that interval even while the intern is silent.
- /// A run the intern ends while you are still connected, by cancellation or by a deadline, ends the stream with a `finish_reason: "error"` chunk carrying `410` and reason `run_ended`, then the final empty-`choices` chunk and `[DONE]`. That error reports only an ending the intern confirmed. A connection that breaks without that confirmation ends with reason `stream_severed`, and a client that has already disconnected is promised no final event.
- /// Set `approval_mode` to `manual` to have the intern ask before approval-bearing tools such as the shell. Omitted, the run self-drives and consents on your behalf. The mode belongs to the run started by that prompt and must be repeated on later prompts.
- /// Available to interns programme members. Callers outside the programme receive `404` for every path under `/api/v1/interns`.
- ///
- ///
- /// The intern to talk to.
- /// Example: a11e0000-0000-4000-8000-000000000005
- ///
- ///
- /// How the run started by this prompt handles tool approvals. `self-drive` (the default when omitted) consents on your behalf and runs the shell unsandboxed. `manual` asks you before an approval-bearing tool runs, as an `openrouter.provide_input` permission request, and keeps the shell sandboxed until an escalation is allowed. The mode applies to the run this prompt starts and is not remembered by the session. Repeat it on each new prompt that should use it. A `tool` reply continues the run under the mode it started with.
- /// Example: manual
- ///
- ///
- /// The conversation. Only the last message is read. A last `user` message starts a run. A last `tool` message answers the interaction named by its `tool_call_id` and requires `session_id`.
- ///
- ///
- /// Accepted for OpenAI compatibility and never used. The intern runs the model configured on it (`PATCH` the intern to change it). Streamed chunks report the runtime's identifier for that model as the intern reports it, or `openrouter/intern` on chunks whose event carries no model (before the intern reports one, and on the chunks the API emits itself: the timeout, run-ended and severed-stream error chunks, the stop chunk of a replay that ends without a terminal daemon event, and the final usage chunk after any of them). A usage chunk that follows a daemon completion event carries the model the intern reported.
- /// Example: openrouter/intern
- ///
- ///
- /// The daemon session to continue, as returned in `session_id` on the final chunk of an earlier response. Omit it to start a new session. An id the intern has not seen before is not an error: it starts a new session under that id, so a mistyped id forks the conversation. Sessions are scoped to the intern's own daemon. Required when the last message has role `tool`.
- /// Example: ses_7f3c9a
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- global::System.Collections.Generic.IAsyncEnumerable ChatAsStreamAsync(
- string internId,
- global::System.Collections.Generic.IList messages,
- global::OpenRouter.InternApprovalMode? approvalMode = default,
- string? model = default,
- string? sessionId = default,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default);
- }
-}
\ No newline at end of file
diff --git a/src/libs/OpenRouter/Generated/OpenRouter.IInterns2Client.Invoke.g.cs b/src/libs/OpenRouter/Generated/OpenRouter.IInterns2Client.Invoke.g.cs
deleted file mode 100644
index ec203e91..00000000
--- a/src/libs/OpenRouter/Generated/OpenRouter.IInterns2Client.Invoke.g.cs
+++ /dev/null
@@ -1,78 +0,0 @@
-#nullable enable
-
-namespace OpenRouter
-{
- public partial interface IInterns2Client
- {
- ///
- /// Start an intern run without waiting for it
- /// Starts a run on one of your interns and answers `202` with the `session_id` as soon as the intern accepts it. The run keeps going on the intern after the response. Nothing about its progress comes back on this request; the intern reports through its own tools, such as Slack.
- /// Send the same `session_id` later to continue the conversation, for example to hand the intern a decision on work it started. If that session already has a run going, the prompt is delivered into it and the status is `steered`. A `session_id` is accepted only from the caller it was issued to, on the same intern; any other, including sessions started from Slack or the chat endpoint, is refused with `404`.
- /// Runs started here self-drive: the intern consents to its own tool approvals, and a question it asks is answered by its own fallback. A run ends when the intern finishes it or after its execution deadline (1 hour by default).
- /// Available to interns programme members. Callers outside the programme receive `404` for every path under `/api/v1/interns`.
- ///
- ///
- /// The intern to run.
- /// Example: a11e0000-0000-4000-8000-000000000005
- ///
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- global::System.Threading.Tasks.Task InvokeAsync(
- string internId,
-
- global::OpenRouter.InternInvokeRequest request,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default);
- ///
- /// Start an intern run without waiting for it
- /// Starts a run on one of your interns and answers `202` with the `session_id` as soon as the intern accepts it. The run keeps going on the intern after the response. Nothing about its progress comes back on this request; the intern reports through its own tools, such as Slack.
- /// Send the same `session_id` later to continue the conversation, for example to hand the intern a decision on work it started. If that session already has a run going, the prompt is delivered into it and the status is `steered`. A `session_id` is accepted only from the caller it was issued to, on the same intern; any other, including sessions started from Slack or the chat endpoint, is refused with `404`.
- /// Runs started here self-drive: the intern consents to its own tool approvals, and a question it asks is answered by its own fallback. A run ends when the intern finishes it or after its execution deadline (1 hour by default).
- /// Available to interns programme members. Callers outside the programme receive `404` for every path under `/api/v1/interns`.
- ///
- ///
- /// The intern to run.
- /// Example: a11e0000-0000-4000-8000-000000000005
- ///
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- global::System.Threading.Tasks.Task> InvokeAsResponseAsync(
- string internId,
-
- global::OpenRouter.InternInvokeRequest request,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default);
- ///
- /// Start an intern run without waiting for it
- /// Starts a run on one of your interns and answers `202` with the `session_id` as soon as the intern accepts it. The run keeps going on the intern after the response. Nothing about its progress comes back on this request; the intern reports through its own tools, such as Slack.
- /// Send the same `session_id` later to continue the conversation, for example to hand the intern a decision on work it started. If that session already has a run going, the prompt is delivered into it and the status is `steered`. A `session_id` is accepted only from the caller it was issued to, on the same intern; any other, including sessions started from Slack or the chat endpoint, is refused with `404`.
- /// Runs started here self-drive: the intern consents to its own tool approvals, and a question it asks is answered by its own fallback. A run ends when the intern finishes it or after its execution deadline (1 hour by default).
- /// Available to interns programme members. Callers outside the programme receive `404` for every path under `/api/v1/interns`.
- ///
- ///
- /// The intern to run.
- /// Example: a11e0000-0000-4000-8000-000000000005
- ///
- ///
- /// The prompt for the run, at most 32000 characters.
- /// Example: New support ticket 48213. Case token: ct_9f2c. Investigate and reply.
- ///
- ///
- /// The session to run in. Send the `session_id` from an earlier `202` to continue that conversation, for example to hand the intern a decision on a case it is working. Omit it to start a new session. Only a `session_id` this endpoint issued to the same caller on the same intern is accepted; any other is refused with `404`.
- /// Example: b51a0e21-368b-4780-a220-14655bf28c55
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- global::System.Threading.Tasks.Task InvokeAsync(
- string internId,
- string input,
- string? sessionId = default,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default);
- }
-}
\ No newline at end of file
diff --git a/src/libs/OpenRouter/Generated/OpenRouter.IInterns2Client.g.cs b/src/libs/OpenRouter/Generated/OpenRouter.IInterns2Client.g.cs
deleted file mode 100644
index 67302ae7..00000000
--- a/src/libs/OpenRouter/Generated/OpenRouter.IInterns2Client.g.cs
+++ /dev/null
@@ -1,52 +0,0 @@
-
-#nullable enable
-
-namespace OpenRouter
-{
- ///
- /// If no httpClient is provided, a new one will be created.
- /// If no baseUri is provided, the default baseUri from OpenAPI spec will be used.
- ///
- public partial interface IInterns2Client : global::System.IDisposable
- {
- ///
- /// The HttpClient instance.
- ///
- public global::System.Net.Http.HttpClient HttpClient { get; }
-
- ///
- /// The base URL for the API.
- ///
- public System.Uri? BaseUri { get; }
-
- ///
- /// The authorizations to use for the requests.
- ///
- public global::System.Collections.Generic.List Authorizations { get; }
-
- ///
- /// Gets or sets a value indicating whether the response content should be read as a string.
- /// True by default in debug builds, false otherwise.
- /// When false, successful responses are deserialized directly from the response stream for better performance.
- /// Error responses are always read as strings regardless of this setting,
- /// ensuring is populated.
- ///
- public bool ReadResponseAsString { get; set; }
- ///
- /// Client-wide request defaults such as headers, query parameters, retries, and timeout.
- ///
- public global::OpenRouter.AutoSDKClientOptions Options { get; }
-
- ///
- /// Creates idempotency keys for generated idempotent requests when the caller does not provide one.
- ///
- public global::System.Func CreateIdempotencyKey { get; set; }
-
- ///
- ///
- ///
- global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext { get; set; }
-
-
- }
-}
\ No newline at end of file
diff --git a/src/libs/OpenRouter/Generated/OpenRouter.IInternsClient.CreateIntern.g.cs b/src/libs/OpenRouter/Generated/OpenRouter.IInternsClient.CreateIntern.g.cs
deleted file mode 100644
index cdf251ea..00000000
--- a/src/libs/OpenRouter/Generated/OpenRouter.IInternsClient.CreateIntern.g.cs
+++ /dev/null
@@ -1,84 +0,0 @@
-#nullable enable
-
-namespace OpenRouter
-{
- public partial interface IInternsClient
- {
- ///
- /// Create an intern
- /// Creates an intern in an explicit workspace. The operation also creates its private vault. It can start provisioning immediately or wait for a later provision call. A retry with the same idempotency key and body resumes unfinished work. The request body is capped at 1048576 bytes and a larger body is refused with 413. A non-empty body must declare `Content-Type: application/json` or it is refused with 415. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// Key that makes retries resume the same create operation, from 1 through 255 characters. An empty or longer key is refused with 400. Without the header, the server derives a stable key from the request body.
- /// Example: create-research-assistant-2026-09-16
- ///
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- global::System.Threading.Tasks.Task CreateInternAsync(
-
- global::OpenRouter.CreateInternRequest request,
- string? idempotencyKey = default,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default);
- ///
- /// Create an intern
- /// Creates an intern in an explicit workspace. The operation also creates its private vault. It can start provisioning immediately or wait for a later provision call. A retry with the same idempotency key and body resumes unfinished work. The request body is capped at 1048576 bytes and a larger body is refused with 413. A non-empty body must declare `Content-Type: application/json` or it is refused with 415. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// Key that makes retries resume the same create operation, from 1 through 255 characters. An empty or longer key is refused with 400. Without the header, the server derives a stable key from the request body.
- /// Example: create-research-assistant-2026-09-16
- ///
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- global::System.Threading.Tasks.Task> CreateInternAsResponseAsync(
-
- global::OpenRouter.CreateInternRequest request,
- string? idempotencyKey = default,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default);
- ///
- /// Create an intern
- /// Creates an intern in an explicit workspace. The operation also creates its private vault. It can start provisioning immediately or wait for a later provision call. A retry with the same idempotency key and body resumes unfinished work. The request body is capped at 1048576 bytes and a larger body is refused with 413. A non-empty body must declare `Content-Type: application/json` or it is refused with 415. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// Key that makes retries resume the same create operation, from 1 through 255 characters. An empty or longer key is refused with 400. Without the header, the server derives a stable key from the request body.
- /// Example: create-research-assistant-2026-09-16
- ///
- ///
- /// Free-form description, or null.
- ///
- ///
- /// Standing instructions the intern boots with, or null.
- ///
- ///
- /// Intern name, unique per creator within the workspace.
- ///
- ///
- /// Start provisioning during this create operation. Defaults to false.
- /// Default Value: false
- ///
- ///
- /// Vault owned by another intern in this workspace to attach as a borrowed vault.
- ///
- ///
- /// Workspace that will own the intern. Defaults to the workspace the API key resolves to. When given, it must match the API key workspace.
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- global::System.Threading.Tasks.Task CreateInternAsync(
- string name,
- string? idempotencyKey = default,
- string? description = default,
- string? instructions = default,
- bool? provision = default,
- global::System.Guid? vaultId = default,
- global::System.Guid? workspaceId = default,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default);
- }
-}
\ No newline at end of file
diff --git a/src/libs/OpenRouter/Generated/OpenRouter.IInternsClient.DeleteIntern.g.cs b/src/libs/OpenRouter/Generated/OpenRouter.IInternsClient.DeleteIntern.g.cs
deleted file mode 100644
index 8409111b..00000000
--- a/src/libs/OpenRouter/Generated/OpenRouter.IInternsClient.DeleteIntern.g.cs
+++ /dev/null
@@ -1,64 +0,0 @@
-#nullable enable
-
-namespace OpenRouter
-{
- public partial interface IInternsClient
- {
- ///
- /// Delete an intern
- /// Starts safe teardown of the intern, its runtime and its private vault. The body is optional. Send `{"acknowledge_workspace_loss": true}` to delete a `destroy_failed` intern whose `last_failure_message` names `workspace_archive_failed`, accepting that its workspace is not backed up. The request body is capped at 1048576 bytes and a larger body is refused with 413. A non-empty body must declare `Content-Type: application/json` or it is refused with 415. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// ID of an intern visible to the authenticated API key.
- /// Example: 7c9e6679-7425-40de-944b-e07fc1f90ae7
- ///
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- global::System.Threading.Tasks.Task DeleteInternAsync(
- string internId,
-
- global::OpenRouter.DeleteInternRequest request,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default);
- ///
- /// Delete an intern
- /// Starts safe teardown of the intern, its runtime and its private vault. The body is optional. Send `{"acknowledge_workspace_loss": true}` to delete a `destroy_failed` intern whose `last_failure_message` names `workspace_archive_failed`, accepting that its workspace is not backed up. The request body is capped at 1048576 bytes and a larger body is refused with 413. A non-empty body must declare `Content-Type: application/json` or it is refused with 415. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// ID of an intern visible to the authenticated API key.
- /// Example: 7c9e6679-7425-40de-944b-e07fc1f90ae7
- ///
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- global::System.Threading.Tasks.Task> DeleteInternAsResponseAsync(
- string internId,
-
- global::OpenRouter.DeleteInternRequest request,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default);
- ///
- /// Delete an intern
- /// Starts safe teardown of the intern, its runtime and its private vault. The body is optional. Send `{"acknowledge_workspace_loss": true}` to delete a `destroy_failed` intern whose `last_failure_message` names `workspace_archive_failed`, accepting that its workspace is not backed up. The request body is capped at 1048576 bytes and a larger body is refused with 413. A non-empty body must declare `Content-Type: application/json` or it is refused with 415. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// ID of an intern visible to the authenticated API key.
- /// Example: 7c9e6679-7425-40de-944b-e07fc1f90ae7
- ///
- ///
- /// Delete even though the workspace backup was not confirmed. Defaults to false, which refuses the teardown when a workspace archive is missing.
- /// Default Value: false
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- global::System.Threading.Tasks.Task DeleteInternAsync(
- string internId,
- bool? acknowledgeWorkspaceLoss = default,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default);
- }
-}
\ No newline at end of file
diff --git a/src/libs/OpenRouter/Generated/OpenRouter.IInternsClient.GetIntern.g.cs b/src/libs/OpenRouter/Generated/OpenRouter.IInternsClient.GetIntern.g.cs
deleted file mode 100644
index b3d706b3..00000000
--- a/src/libs/OpenRouter/Generated/OpenRouter.IInternsClient.GetIntern.g.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-#nullable enable
-
-namespace OpenRouter
-{
- public partial interface IInternsClient
- {
- ///
- /// Get an intern
- /// Returns the public lifecycle state and settings for one visible intern. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// ID of an intern visible to the authenticated API key.
- /// Example: 7c9e6679-7425-40de-944b-e07fc1f90ae7
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- global::System.Threading.Tasks.Task GetInternAsync(
- string internId,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default);
- ///
- /// Get an intern
- /// Returns the public lifecycle state and settings for one visible intern. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// ID of an intern visible to the authenticated API key.
- /// Example: 7c9e6679-7425-40de-944b-e07fc1f90ae7
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- global::System.Threading.Tasks.Task> GetInternAsResponseAsync(
- string internId,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default);
- }
-}
\ No newline at end of file
diff --git a/src/libs/OpenRouter/Generated/OpenRouter.IInternsClient.GetInternConnections.g.cs b/src/libs/OpenRouter/Generated/OpenRouter.IInternsClient.GetInternConnections.g.cs
deleted file mode 100644
index 67c1edeb..00000000
--- a/src/libs/OpenRouter/Generated/OpenRouter.IInternsClient.GetInternConnections.g.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-#nullable enable
-
-namespace OpenRouter
-{
- public partial interface IInternsClient
- {
- ///
- /// List an intern's connections
- /// Returns the Slack, GitHub, Google Workspace and MCP connections one visible intern can reach, and the shared ones switched off for it or disabled for the workspace. An OAuth grant needs `vault:read`, because the list names members' personal accounts; without it the route answers 403 `insufficient_scope`. The response is sent with `Cache-Control: no-store`. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// ID of an intern visible to the authenticated API key.
- /// Example: 7c9e6679-7425-40de-944b-e07fc1f90ae7
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- global::System.Threading.Tasks.Task GetInternConnectionsAsync(
- string internId,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default);
- ///
- /// List an intern's connections
- /// Returns the Slack, GitHub, Google Workspace and MCP connections one visible intern can reach, and the shared ones switched off for it or disabled for the workspace. An OAuth grant needs `vault:read`, because the list names members' personal accounts; without it the route answers 403 `insufficient_scope`. The response is sent with `Cache-Control: no-store`. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// ID of an intern visible to the authenticated API key.
- /// Example: 7c9e6679-7425-40de-944b-e07fc1f90ae7
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- global::System.Threading.Tasks.Task> GetInternConnectionsAsResponseAsync(
- string internId,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default);
- }
-}
\ No newline at end of file
diff --git a/src/libs/OpenRouter/Generated/OpenRouter.IInternsClient.GetInternDaemon.g.cs b/src/libs/OpenRouter/Generated/OpenRouter.IInternsClient.GetInternDaemon.g.cs
deleted file mode 100644
index d362c2d2..00000000
--- a/src/libs/OpenRouter/Generated/OpenRouter.IInternsClient.GetInternDaemon.g.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-#nullable enable
-
-namespace OpenRouter
-{
- public partial interface IInternsClient
- {
- ///
- /// Get an intern's daemon access
- /// Returns the origin and daemon token that attach `ori tui --host` to one visible, running intern. The token is a credential: only an OAuth-token caller (`ori login --oidc`) may read it, the response is sent with `Cache-Control: no-store`, and each reveal is logged by caller and intern. API keys get 403 `personal_identity_required`. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// ID of an intern visible to the authenticated API key.
- /// Example: 7c9e6679-7425-40de-944b-e07fc1f90ae7
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- global::System.Threading.Tasks.Task GetInternDaemonAsync(
- string internId,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default);
- ///
- /// Get an intern's daemon access
- /// Returns the origin and daemon token that attach `ori tui --host` to one visible, running intern. The token is a credential: only an OAuth-token caller (`ori login --oidc`) may read it, the response is sent with `Cache-Control: no-store`, and each reveal is logged by caller and intern. API keys get 403 `personal_identity_required`. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// ID of an intern visible to the authenticated API key.
- /// Example: 7c9e6679-7425-40de-944b-e07fc1f90ae7
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- global::System.Threading.Tasks.Task> GetInternDaemonAsResponseAsync(
- string internId,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default);
- }
-}
\ No newline at end of file
diff --git a/src/libs/OpenRouter/Generated/OpenRouter.IInternsClient.GetInternIcon.g.cs b/src/libs/OpenRouter/Generated/OpenRouter.IInternsClient.GetInternIcon.g.cs
deleted file mode 100644
index 14eabe2d..00000000
--- a/src/libs/OpenRouter/Generated/OpenRouter.IInternsClient.GetInternIcon.g.cs
+++ /dev/null
@@ -1,65 +0,0 @@
-#nullable enable
-
-namespace OpenRouter
-{
- public partial interface IInternsClient
- {
- ///
- /// Get an intern's icon
- /// Returns the icon image of one visible intern. Pass the intern's `icon_sha256` as `v` to receive a response that can be cached indefinitely. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// ID of an intern visible to the authenticated API key.
- /// Example: 7c9e6679-7425-40de-944b-e07fc1f90ae7
- ///
- ///
- /// The `icon_sha256` the caller expects.
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- global::System.Threading.Tasks.Task GetInternIconAsync(
- string internId,
- string? v = default,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default);
- ///
- /// Get an intern's icon
- /// Returns the icon image of one visible intern. Pass the intern's `icon_sha256` as `v` to receive a response that can be cached indefinitely. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// ID of an intern visible to the authenticated API key.
- /// Example: 7c9e6679-7425-40de-944b-e07fc1f90ae7
- ///
- ///
- /// The `icon_sha256` the caller expects.
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- global::System.Threading.Tasks.Task GetInternIconAsStreamAsync(
- string internId,
- string? v = default,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default);
- ///
- /// Get an intern's icon
- /// Returns the icon image of one visible intern. Pass the intern's `icon_sha256` as `v` to receive a response that can be cached indefinitely. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// ID of an intern visible to the authenticated API key.
- /// Example: 7c9e6679-7425-40de-944b-e07fc1f90ae7
- ///
- ///
- /// The `icon_sha256` the caller expects.
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- global::System.Threading.Tasks.Task> GetInternIconAsResponseAsync(
- string internId,
- string? v = default,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default);
- }
-}
\ No newline at end of file
diff --git a/src/libs/OpenRouter/Generated/OpenRouter.IInternsClient.ListInterns.g.cs b/src/libs/OpenRouter/Generated/OpenRouter.IInternsClient.ListInterns.g.cs
deleted file mode 100644
index 58a161c6..00000000
--- a/src/libs/OpenRouter/Generated/OpenRouter.IInternsClient.ListInterns.g.cs
+++ /dev/null
@@ -1,68 +0,0 @@
-#nullable enable
-
-namespace OpenRouter
-{
- public partial interface IInternsClient
- {
- ///
- /// List interns
- /// Lists interns visible to the authenticated key, newest first. Filter by workspace and one or more lifecycle statuses. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// Maximum number of interns to return, from 1 through 500.
- /// Example: 50
- ///
- ///
- /// Comma-separated lifecycle statuses to include, at most 8. Repeats are collapsed.
- /// Example: [queued, running]
- ///
- ///
- /// The opaque `next_cursor` of the previous page. Returns the interns that come after it in the newest-first order. A malformed cursor is a 400.
- /// Example: MjAyNi0wOS0xNlQwODozMDowMC4wMDAwMDBafDdjOWU2Njc5LTc0MjUtNDBkZS05NDRiLWUwN2ZjMWY5MGFlNw
- ///
- ///
- /// Only return interns in this workspace. It must match the API key workspace.
- /// Example: 89f9f5b2-3f89-4eaf-83ca-5ceae149e8bb
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- global::System.Threading.Tasks.Task ListInternsAsync(
- int? limit = default,
- global::System.Collections.Generic.IList? status = default,
- string? startingAfter = default,
- global::System.Guid? workspaceId = default,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default);
- ///
- /// List interns
- /// Lists interns visible to the authenticated key, newest first. Filter by workspace and one or more lifecycle statuses. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// Maximum number of interns to return, from 1 through 500.
- /// Example: 50
- ///
- ///
- /// Comma-separated lifecycle statuses to include, at most 8. Repeats are collapsed.
- /// Example: [queued, running]
- ///
- ///
- /// The opaque `next_cursor` of the previous page. Returns the interns that come after it in the newest-first order. A malformed cursor is a 400.
- /// Example: MjAyNi0wOS0xNlQwODozMDowMC4wMDAwMDBafDdjOWU2Njc5LTc0MjUtNDBkZS05NDRiLWUwN2ZjMWY5MGFlNw
- ///
- ///
- /// Only return interns in this workspace. It must match the API key workspace.
- /// Example: 89f9f5b2-3f89-4eaf-83ca-5ceae149e8bb
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- global::System.Threading.Tasks.Task> ListInternsAsResponseAsync(
- int? limit = default,
- global::System.Collections.Generic.IList? status = default,
- string? startingAfter = default,
- global::System.Guid? workspaceId = default,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default);
- }
-}
\ No newline at end of file
diff --git a/src/libs/OpenRouter/Generated/OpenRouter.IInternsClient.ProvisionIntern.g.cs b/src/libs/OpenRouter/Generated/OpenRouter.IInternsClient.ProvisionIntern.g.cs
deleted file mode 100644
index 1df012ff..00000000
--- a/src/libs/OpenRouter/Generated/OpenRouter.IInternsClient.ProvisionIntern.g.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-#nullable enable
-
-namespace OpenRouter
-{
- public partial interface IInternsClient
- {
- ///
- /// Provision an intern
- /// Starts the first boot, or resumes an intern after suspension. This operation takes no request body. A body carrying any field is refused with 400 rather than ignored. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// ID of an intern visible to the authenticated API key.
- /// Example: 7c9e6679-7425-40de-944b-e07fc1f90ae7
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- global::System.Threading.Tasks.Task ProvisionInternAsync(
- string internId,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default);
- ///
- /// Provision an intern
- /// Starts the first boot, or resumes an intern after suspension. This operation takes no request body. A body carrying any field is refused with 400 rather than ignored. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// ID of an intern visible to the authenticated API key.
- /// Example: 7c9e6679-7425-40de-944b-e07fc1f90ae7
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- global::System.Threading.Tasks.Task> ProvisionInternAsResponseAsync(
- string internId,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default);
- }
-}
\ No newline at end of file
diff --git a/src/libs/OpenRouter/Generated/OpenRouter.IInternsClient.SignInternDaemonRequest.g.cs b/src/libs/OpenRouter/Generated/OpenRouter.IInternsClient.SignInternDaemonRequest.g.cs
deleted file mode 100644
index 0386e6af..00000000
--- a/src/libs/OpenRouter/Generated/OpenRouter.IInternsClient.SignInternDaemonRequest.g.cs
+++ /dev/null
@@ -1,68 +0,0 @@
-#nullable enable
-
-namespace OpenRouter
-{
- public partial interface IInternsClient
- {
- ///
- /// Sign a daemon request with the caller's identity
- /// Signs the SHA-256 digest of one request the CLI is about to send to the intern daemon, binding it to the intern and to the signed-in member so personal connections resolve. Only an OAuth session from `ori login --oidc` whose grant carries `vault:read` can sign: an API key is refused with 403 because it names no person, and an `interns`-only grant is refused with 403 because a proof releases that user's personal connections. The route is behind the same gate as chat and counts against the chat turn limiter. The response is sent with `Cache-Control: no-store`. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// ID of an intern visible to the authenticated API key.
- /// Example: 7c9e6679-7425-40de-944b-e07fc1f90ae7
- ///
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- global::System.Threading.Tasks.Task SignInternDaemonRequestAsync(
- string internId,
-
- global::OpenRouter.SignInternDaemonRequest request,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default);
- ///
- /// Sign a daemon request with the caller's identity
- /// Signs the SHA-256 digest of one request the CLI is about to send to the intern daemon, binding it to the intern and to the signed-in member so personal connections resolve. Only an OAuth session from `ori login --oidc` whose grant carries `vault:read` can sign: an API key is refused with 403 because it names no person, and an `interns`-only grant is refused with 403 because a proof releases that user's personal connections. The route is behind the same gate as chat and counts against the chat turn limiter. The response is sent with `Cache-Control: no-store`. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// ID of an intern visible to the authenticated API key.
- /// Example: 7c9e6679-7425-40de-944b-e07fc1f90ae7
- ///
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- global::System.Threading.Tasks.Task> SignInternDaemonRequestAsResponseAsync(
- string internId,
-
- global::OpenRouter.SignInternDaemonRequest request,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default);
- ///
- /// Sign a daemon request with the caller's identity
- /// Signs the SHA-256 digest of one request the CLI is about to send to the intern daemon, binding it to the intern and to the signed-in member so personal connections resolve. Only an OAuth session from `ori login --oidc` whose grant carries `vault:read` can sign: an API key is refused with 403 because it names no person, and an `interns`-only grant is refused with 403 because a proof releases that user's personal connections. The route is behind the same gate as chat and counts against the chat turn limiter. The response is sent with `Cache-Control: no-store`. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// ID of an intern visible to the authenticated API key.
- /// Example: 7c9e6679-7425-40de-944b-e07fc1f90ae7
- ///
- ///
- /// Lower-case hex SHA-256 of the exact bytes the CLI will send as the daemon request body.
- /// Example: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
- ///
- ///
- /// The daemon request the proof is for. When present the response also carries the single-use, route-bound proof (`x-ori-invoke-signature-v2`, `x-ori-invoke-nonce`).
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- global::System.Threading.Tasks.Task SignInternDaemonRequestAsync(
- string internId,
- string bodySha256,
- global::OpenRouter.SignInternDaemonRequestRoute? route = default,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default);
- }
-}
\ No newline at end of file
diff --git a/src/libs/OpenRouter/Generated/OpenRouter.IInternsClient.SuspendIntern.g.cs b/src/libs/OpenRouter/Generated/OpenRouter.IInternsClient.SuspendIntern.g.cs
deleted file mode 100644
index 7e905e84..00000000
--- a/src/libs/OpenRouter/Generated/OpenRouter.IInternsClient.SuspendIntern.g.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-#nullable enable
-
-namespace OpenRouter
-{
- public partial interface IInternsClient
- {
- ///
- /// Suspend an intern
- /// Stops the intern runtime while keeping its disk and configuration for a later provision call. This operation takes no request body. A body carrying any field is refused with 400 rather than ignored. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// ID of an intern visible to the authenticated API key.
- /// Example: 7c9e6679-7425-40de-944b-e07fc1f90ae7
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- global::System.Threading.Tasks.Task SuspendInternAsync(
- string internId,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default);
- ///
- /// Suspend an intern
- /// Stops the intern runtime while keeping its disk and configuration for a later provision call. This operation takes no request body. A body carrying any field is refused with 400 rather than ignored. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// ID of an intern visible to the authenticated API key.
- /// Example: 7c9e6679-7425-40de-944b-e07fc1f90ae7
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- global::System.Threading.Tasks.Task> SuspendInternAsResponseAsync(
- string internId,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default);
- }
-}
\ No newline at end of file
diff --git a/src/libs/OpenRouter/Generated/OpenRouter.IInternsClient.UpdateIntern.g.cs b/src/libs/OpenRouter/Generated/OpenRouter.IInternsClient.UpdateIntern.g.cs
deleted file mode 100644
index 6b252e1a..00000000
--- a/src/libs/OpenRouter/Generated/OpenRouter.IInternsClient.UpdateIntern.g.cs
+++ /dev/null
@@ -1,75 +0,0 @@
-#nullable enable
-
-namespace OpenRouter
-{
- public partial interface IInternsClient
- {
- ///
- /// Update an intern
- /// Changes the intern name, description, instructions or model. Omitted fields stay unchanged. The request body is capped at 1048576 bytes and a larger body is refused with 413. A non-empty body must declare `Content-Type: application/json` or it is refused with 415. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// ID of an intern visible to the authenticated API key.
- /// Example: 7c9e6679-7425-40de-944b-e07fc1f90ae7
- ///
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- global::System.Threading.Tasks.Task UpdateInternAsync(
- string internId,
-
- global::OpenRouter.UpdateInternRequest request,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default);
- ///
- /// Update an intern
- /// Changes the intern name, description, instructions or model. Omitted fields stay unchanged. The request body is capped at 1048576 bytes and a larger body is refused with 413. A non-empty body must declare `Content-Type: application/json` or it is refused with 415. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// ID of an intern visible to the authenticated API key.
- /// Example: 7c9e6679-7425-40de-944b-e07fc1f90ae7
- ///
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- global::System.Threading.Tasks.Task> UpdateInternAsResponseAsync(
- string internId,
-
- global::OpenRouter.UpdateInternRequest request,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default);
- ///
- /// Update an intern
- /// Changes the intern name, description, instructions or model. Omitted fields stay unchanged. The request body is capped at 1048576 bytes and a larger body is refused with 413. A non-empty body must declare `Content-Type: application/json` or it is refused with 415. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// ID of an intern visible to the authenticated API key.
- /// Example: 7c9e6679-7425-40de-944b-e07fc1f90ae7
- ///
- ///
- /// New free-form description. Null clears it.
- ///
- ///
- /// New standing instructions. Null clears them.
- ///
- ///
- /// New OpenRouter model slug in `author/slug` form (an optional `:variant` suffix is accepted). Other shapes are refused with 400. Null restores the workspace default. Takes effect on the next provision: until then `GET` shows this configured model while chat chunks show the model the running intern reports.
- ///
- ///
- /// New intern name, unique per creator within the workspace.
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- global::System.Threading.Tasks.Task UpdateInternAsync(
- string internId,
- string? description = default,
- string? instructions = default,
- string? model = default,
- string? name = default,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default);
- }
-}
\ No newline at end of file
diff --git a/src/libs/OpenRouter/Generated/OpenRouter.IInternsClient.g.cs b/src/libs/OpenRouter/Generated/OpenRouter.IInternsClient.g.cs
deleted file mode 100644
index 51b14783..00000000
--- a/src/libs/OpenRouter/Generated/OpenRouter.IInternsClient.g.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-
-#nullable enable
-
-namespace OpenRouter
-{
- ///
- /// Create, inspect, update, provision, suspend and delete OpenRouter interns through an API key, and talk to them: the chat route streams OpenAI-compatible completions from one intern, pausing as an `openrouter.provide_input` tool call when the intern needs your permission or an answer. Available to interns programme members; other callers receive 404. See https://openrouter.ai/docs/guides/ori/intern-chat.
- /// If no httpClient is provided, a new one will be created.
- /// If no baseUri is provided, the default baseUri from OpenAPI spec will be used.
- ///
- public partial interface IInternsClient : global::System.IDisposable
- {
- ///
- /// The HttpClient instance.
- ///
- public global::System.Net.Http.HttpClient HttpClient { get; }
-
- ///
- /// The base URL for the API.
- ///
- public System.Uri? BaseUri { get; }
-
- ///
- /// The authorizations to use for the requests.
- ///
- public global::System.Collections.Generic.List Authorizations { get; }
-
- ///
- /// Gets or sets a value indicating whether the response content should be read as a string.
- /// True by default in debug builds, false otherwise.
- /// When false, successful responses are deserialized directly from the response stream for better performance.
- /// Error responses are always read as strings regardless of this setting,
- /// ensuring is populated.
- ///
- public bool ReadResponseAsString { get; set; }
- ///
- /// Client-wide request defaults such as headers, query parameters, retries, and timeout.
- ///
- public global::OpenRouter.AutoSDKClientOptions Options { get; }
-
- ///
- /// Creates idempotency keys for generated idempotent requests when the caller does not provide one.
- ///
- public global::System.Func CreateIdempotencyKey { get; set; }
-
- ///
- ///
- ///
- global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext { get; set; }
-
-
- }
-}
\ No newline at end of file
diff --git a/src/libs/OpenRouter/Generated/OpenRouter.IOpenRouterClient.g.cs b/src/libs/OpenRouter/Generated/OpenRouter.IOpenRouterClient.g.cs
index bbec6f37..577c5ed4 100644
--- a/src/libs/OpenRouter/Generated/OpenRouter.IOpenRouterClient.g.cs
+++ b/src/libs/OpenRouter/Generated/OpenRouter.IOpenRouterClient.g.cs
@@ -160,16 +160,6 @@ public partial interface IOpenRouterClient : global::System.IDisposable
///
public ImagesClient Images { get; }
- ///
- /// Create, inspect, update, provision, suspend and delete OpenRouter interns through an API key, and talk to them: the chat route streams OpenAI-compatible completions from one intern, pausing as an `openrouter.provide_input` tool call when the intern needs your permission or an answer. Available to interns programme members; other callers receive 404. See https://openrouter.ai/docs/guides/ori/intern-chat.
- ///
- public InternsClient Interns { get; }
-
- ///
- ///
- ///
- public Interns2Client Interns2 { get; }
-
///
/// Model information endpoints.
///
diff --git a/src/libs/OpenRouter/Generated/OpenRouter.Interns.JsonSerializerContext.g.cs b/src/libs/OpenRouter/Generated/OpenRouter.Interns.JsonSerializerContext.g.cs
deleted file mode 100644
index aebe27ed..00000000
--- a/src/libs/OpenRouter/Generated/OpenRouter.Interns.JsonSerializerContext.g.cs
+++ /dev/null
@@ -1,109 +0,0 @@
-
-#nullable enable
-
-namespace OpenRouter
-{ ///
- ///
- ///
- public sealed partial class InternsSourceGenerationContext : global::System.Text.Json.Serialization.JsonSerializerContext
- {
- private static readonly global::System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver Resolver = new LazyChunkResolver();
-
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- internal static global::System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver TypeInfoResolver => Resolver;
-
-
- private static readonly global::System.Text.Json.JsonSerializerOptions DefaultOptions = CreateDefaultOptions();
-
- ///
- ///
- ///
- public static InternsSourceGenerationContext Default { get; } = new(DefaultOptions);
-
- private InternsSourceGenerationContext(global::System.Text.Json.JsonSerializerOptions options)
- : base(options)
- {
- }
-
- ///
- protected override global::System.Text.Json.JsonSerializerOptions? GeneratedSerializerOptions => DefaultOptions;
-
- ///
- public override global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? GetTypeInfo(global::System.Type type)
- {
- return Resolver.GetTypeInfo(type, Options);
- }
-
- ///
- /// Adds this package's converters to .
- ///
- ///
- /// A converter has to be on the options a chained resolver builds its JsonTypeInfo against,
- /// and a context resolves types from every package below it. Each package contributes only
- /// what it owns and calls down the chain for the rest, so the family's converter table is
- /// written once rather than copied into all of them.
- ///
- [global::System.ComponentModel.EditorBrowsable(global::System.ComponentModel.EditorBrowsableState.Never)]
- public static void AddConverters(global::System.Text.Json.JsonSerializerOptions options)
- {
- global::OpenRouter.SourceGenerationContext.AddConverters(options);
- }
-
- private static global::System.Text.Json.JsonSerializerOptions CreateDefaultOptions()
- {
- var options = new global::System.Text.Json.JsonSerializerOptions
- {
- DefaultIgnoreCondition = global::System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull,
- TypeInfoResolver = Resolver,
- };
- AddConverters(options);
-
- return options;
- }
-
- private sealed class LazyChunkResolver : global::System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver
- {
- private readonly object _gate = new();
- private readonly global::System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver?[] _resolvers = new global::System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver?[1];
-
- public global::System.Text.Json.Serialization.Metadata.JsonTypeInfo? GetTypeInfo(
- global::System.Type type,
- global::System.Text.Json.JsonSerializerOptions options)
- {
- for (var index = 0; index < _resolvers.Length; index++)
- {
- var typeInfo = GetResolver(index).GetTypeInfo(type, options);
- if (typeInfo is not null)
- {
- return typeInfo;
- }
- }
-
- return null;
- }
-
- private global::System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver GetResolver(int index)
- {
- var resolver = global::System.Threading.Volatile.Read(ref _resolvers[index]);
- if (resolver is not null)
- {
- return resolver;
- }
-
- lock (_gate)
- {
- return _resolvers[index] ??= CreateResolver(index);
- }
- }
-
- private static global::System.Text.Json.Serialization.Metadata.IJsonTypeInfoResolver CreateResolver(int index)
- {
- return index switch
- {
- 0 => global::OpenRouter.SourceGenerationContext.TypeInfoResolver,
- _ => throw new global::System.ArgumentOutOfRangeException(nameof(index)),
- };
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/libs/OpenRouter/Generated/OpenRouter.Interns2Client.Chat.g.cs b/src/libs/OpenRouter/Generated/OpenRouter.Interns2Client.Chat.g.cs
deleted file mode 100644
index 6eddfda9..00000000
--- a/src/libs/OpenRouter/Generated/OpenRouter.Interns2Client.Chat.g.cs
+++ /dev/null
@@ -1,978 +0,0 @@
-
-#nullable enable
-
-namespace OpenRouter
-{
- public partial class Interns2Client
- {
-
-
- private static readonly global::OpenRouter.EndPointSecurityRequirement s_ChatSecurityRequirement0 =
- new global::OpenRouter.EndPointSecurityRequirement
- {
- Authorizations = new global::OpenRouter.EndPointAuthorizationRequirement[]
- { new global::OpenRouter.EndPointAuthorizationRequirement
- {
- Type = "Http",
- SchemeId = "Bearer",
- Location = "Header",
- Name = "Bearer",
- FriendlyName = "Bearer",
- },
- },
- };
- private static readonly global::OpenRouter.EndPointSecurityRequirement[] s_ChatSecurityRequirements =
- new global::OpenRouter.EndPointSecurityRequirement[]
- { s_ChatSecurityRequirement0,
- };
- partial void PrepareChatArguments(
- global::System.Net.Http.HttpClient httpClient,
- ref string internId,
- global::OpenRouter.InternChatCompletionRequest request);
- partial void PrepareChatRequest(
- global::System.Net.Http.HttpClient httpClient,
- global::System.Net.Http.HttpRequestMessage httpRequestMessage,
- string internId,
- global::OpenRouter.InternChatCompletionRequest request);
- partial void ProcessChatResponse(
- global::System.Net.Http.HttpClient httpClient,
- global::System.Net.Http.HttpResponseMessage httpResponseMessage);
-
- partial void ProcessChatResponseContent(
- global::System.Net.Http.HttpClient httpClient,
- global::System.Net.Http.HttpResponseMessage httpResponseMessage,
- ref string content);
-
- ///
- /// Stream a chat completion with an intern
- /// Sends a prompt to one of your interns and streams the reply as OpenAI-compatible server-sent events ending with `[DONE]`. The run executes on the intern, which may pause to ask you something. It then streams one `openrouter.provide_input` tool call and finishes with `finish_reason: "tool_calls"`, and the run stays open on the intern.
- /// Every response, whether it ends with `stop`, `tool_calls` or `error`, is followed by a final chunk with empty `choices` that carries `session_id`, then `data: [DONE]`. That chunk carries the `usage` the intern reported for the run, after `stop` or `error`, and `null` when the intern reported none. After `tool_calls` its `usage` is `null` because the turn is not over. Read through `[DONE]`: the `session_id` you need to reply arrives after the `tool_calls` finish chunk.
- /// To answer, send a second request with the same `session_id`, the assistant message echoing that tool call, and a `tool` message whose `tool_call_id` is the tool call id and whose `content` is the answer. The answer is delivered to the run that asked and the stream continues from where it paused. A question stays open for its interaction deadline (5 minutes by default) and the run is cancelled when that passes. Rejected replies do not extend the deadline.
- /// Closing the connection after the `[DONE]` that follows `finish_reason: "tool_calls"` keeps the run alive. Disconnecting while a response is still streaming cancels the run. The stream writes a `: keepalive` comment whenever nothing else has been written for 30 seconds, so a disconnect is noticed within that interval even while the intern is silent.
- /// A run the intern ends while you are still connected, by cancellation or by a deadline, ends the stream with a `finish_reason: "error"` chunk carrying `410` and reason `run_ended`, then the final empty-`choices` chunk and `[DONE]`. That error reports only an ending the intern confirmed. A connection that breaks without that confirmation ends with reason `stream_severed`, and a client that has already disconnected is promised no final event.
- /// Set `approval_mode` to `manual` to have the intern ask before approval-bearing tools such as the shell. Omitted, the run self-drives and consents on your behalf. The mode belongs to the run started by that prompt and must be repeated on later prompts.
- /// Available to interns programme members. Callers outside the programme receive `404` for every path under `/api/v1/interns`.
- ///
- ///
- /// The intern to talk to.
- /// Example: a11e0000-0000-4000-8000-000000000005
- ///
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- public async global::System.Threading.Tasks.Task ChatAsync(
- string internId,
-
- global::OpenRouter.InternChatCompletionRequest request,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default)
- {
- var __response = await ChatAsResponseAsync(
- internId: internId,
-
- request: request,
- requestOptions: requestOptions,
- cancellationToken: cancellationToken
- ).ConfigureAwait(false);
-
- return __response.Body;
- }
- ///
- /// Stream a chat completion with an intern
- /// Sends a prompt to one of your interns and streams the reply as OpenAI-compatible server-sent events ending with `[DONE]`. The run executes on the intern, which may pause to ask you something. It then streams one `openrouter.provide_input` tool call and finishes with `finish_reason: "tool_calls"`, and the run stays open on the intern.
- /// Every response, whether it ends with `stop`, `tool_calls` or `error`, is followed by a final chunk with empty `choices` that carries `session_id`, then `data: [DONE]`. That chunk carries the `usage` the intern reported for the run, after `stop` or `error`, and `null` when the intern reported none. After `tool_calls` its `usage` is `null` because the turn is not over. Read through `[DONE]`: the `session_id` you need to reply arrives after the `tool_calls` finish chunk.
- /// To answer, send a second request with the same `session_id`, the assistant message echoing that tool call, and a `tool` message whose `tool_call_id` is the tool call id and whose `content` is the answer. The answer is delivered to the run that asked and the stream continues from where it paused. A question stays open for its interaction deadline (5 minutes by default) and the run is cancelled when that passes. Rejected replies do not extend the deadline.
- /// Closing the connection after the `[DONE]` that follows `finish_reason: "tool_calls"` keeps the run alive. Disconnecting while a response is still streaming cancels the run. The stream writes a `: keepalive` comment whenever nothing else has been written for 30 seconds, so a disconnect is noticed within that interval even while the intern is silent.
- /// A run the intern ends while you are still connected, by cancellation or by a deadline, ends the stream with a `finish_reason: "error"` chunk carrying `410` and reason `run_ended`, then the final empty-`choices` chunk and `[DONE]`. That error reports only an ending the intern confirmed. A connection that breaks without that confirmation ends with reason `stream_severed`, and a client that has already disconnected is promised no final event.
- /// Set `approval_mode` to `manual` to have the intern ask before approval-bearing tools such as the shell. Omitted, the run self-drives and consents on your behalf. The mode belongs to the run started by that prompt and must be repeated on later prompts.
- /// Available to interns programme members. Callers outside the programme receive `404` for every path under `/api/v1/interns`.
- ///
- ///
- /// The intern to talk to.
- /// Example: a11e0000-0000-4000-8000-000000000005
- ///
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- public async global::System.Threading.Tasks.Task> ChatAsResponseAsync(
- string internId,
-
- global::OpenRouter.InternChatCompletionRequest request,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default)
- {
- request = request ?? throw new global::System.ArgumentNullException(nameof(request));
-
- request = new global::OpenRouter.InternChatCompletionRequest
- {
- ApprovalMode = request.ApprovalMode,
- Messages = request.Messages,
- Model = request.Model,
- SessionId = request.SessionId,
- Stream = false,
- };
- PrepareArguments(
- client: HttpClient);
- PrepareChatArguments(
- httpClient: HttpClient,
- internId: ref internId,
- request: request);
-
-
- var __authorizations = global::OpenRouter.EndPointSecurityResolver.ResolveAuthorizations(
- availableAuthorizations: Authorizations,
- securityRequirements: s_ChatSecurityRequirements,
- operationName: "ChatAsync");
-
- using var __timeoutCancellationTokenSource = global::OpenRouter.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
- clientOptions: Options,
- requestOptions: requestOptions,
- cancellationToken: cancellationToken);
- var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
- var __effectiveReadResponseAsString = global::OpenRouter.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
- clientOptions: Options,
- requestOptions: requestOptions,
- fallbackValue: ReadResponseAsString);
- var __maxAttempts = global::OpenRouter.AutoSDKRequestOptionsSupport.GetMaxAttempts(
- clientOptions: Options,
- requestOptions: requestOptions,
- supportsRetry: false);
-
- global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
- {
-
- var __pathBuilder = new global::OpenRouter.PathBuilder(
- path: $"/interns/{internId}/chat/completions",
- baseUri: HttpClient.BaseAddress ?? new global::System.Uri("https://openrouter.ai/api/v1", global::System.UriKind.RelativeOrAbsolute));
- var __path = __pathBuilder.ToString();
- __path = global::OpenRouter.AutoSDKRequestOptionsSupport.AppendQueryParameters(
- path: __path,
- clientParameters: Options.QueryParameters,
- requestParameters: requestOptions?.QueryParameters);
- var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
-#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
-#endif
-
- __httpRequest.Headers.TryAddWithoutValidation(
- "Accept",
- "application/json");
-
- foreach (var __authorization in __authorizations)
- {
- if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2" ||
- __authorization.Type == "OpenIdConnect")
- {
- __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
- scheme: __authorization.Name,
- parameter: __authorization.Value);
- }
- else if (__authorization.Type == "ApiKey" &&
- __authorization.Location == "Header")
- {
- __httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
- }
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
- global::OpenRouter.AutoSDKRequestOptionsSupport.ApplyHeaders(
- request: __httpRequest,
- clientHeaders: Options.Headers,
- requestHeaders: requestOptions?.Headers);
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareChatRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- internId: internId,
- request: request);
-
- global::OpenRouter.AutoSDKHttpRequestOptions.StampAuthorizationOverride(__httpRequest);
-
- return __httpRequest;
- }
-
- global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
- global::System.Net.Http.HttpResponseMessage? __response = null;
- var __attemptNumber = 0;
- try
- {
- for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
- {
- __attemptNumber = __attempt;
- __httpRequest = __CreateHttpRequest();
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "Chat",
- methodName: "ChatAsync",
- pathTemplate: "$\"/interns/{internId}/chat/completions\"",
- httpMethod: "POST",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: null,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- try
- {
- __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- }
- catch (global::System.Net.Http.HttpRequestException __exception)
- {
- var __retryDelay = global::OpenRouter.AutoSDKRequestOptionsSupport.GetRetryDelay(
- clientOptions: Options,
- requestOptions: requestOptions,
- response: null,
- attempt: __attempt);
- var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "Chat",
- methodName: "ChatAsync",
- pathTemplate: "$\"/interns/{internId}/chat/completions\"",
- httpMethod: "POST",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: null,
- exception: __exception,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: __willRetry,
- retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
- retryReason: "exception",
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- if (!__willRetry)
- {
- throw;
- }
-
- __httpRequest.Dispose();
- __httpRequest = null;
- await global::OpenRouter.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- retryDelay: __retryDelay,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- continue;
- }
-
- if (__response != null &&
- __attempt < __maxAttempts &&
- global::OpenRouter.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
- {
- var __retryDelay = global::OpenRouter.AutoSDKRequestOptionsSupport.GetRetryDelay(
- clientOptions: Options,
- requestOptions: requestOptions,
- response: __response,
- attempt: __attempt);
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "Chat",
- methodName: "ChatAsync",
- pathTemplate: "$\"/interns/{internId}/chat/completions\"",
- httpMethod: "POST",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: true,
- retryDelay: __retryDelay,
- retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- __response.Dispose();
- __response = null;
- __httpRequest.Dispose();
- __httpRequest = null;
- await global::OpenRouter.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- retryDelay: __retryDelay,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- continue;
- }
-
- break;
- }
-
- if (__response == null)
- {
- throw new global::System.InvalidOperationException("No response received.");
- }
-
- using (__response)
- {
-
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessChatResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- if (__response.IsSuccessStatusCode)
- {
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "Chat",
- methodName: "ChatAsync",
- pathTemplate: "$\"/interns/{internId}/chat/completions\"",
- httpMethod: "POST",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attemptNumber,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- }
- else
- {
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "Chat",
- methodName: "ChatAsync",
- pathTemplate: "$\"/interns/{internId}/chat/completions\"",
- httpMethod: "POST",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attemptNumber,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- }
- // The body is not a valid request (`bad_request`), or the intern did not accept the answer for the pending question, such as a permission option it did not offer.
- if ((int)__response.StatusCode == 400)
- {
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::OpenRouter.InternChatErrorResponse? __value_400 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_400 = global::OpenRouter.InternChatErrorResponse.FromJson(__content_400, JsonSerializerContext);
- }
- else
- {
- __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_400 = global::OpenRouter.InternChatErrorResponse.FromJson(__content_400, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- responseBody: __content_400,
- responseObject: __value_400,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // No valid API key.
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::OpenRouter.InternChatErrorResponse? __value_401 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_401 = global::OpenRouter.InternChatErrorResponse.FromJson(__content_401, JsonSerializerContext);
- }
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_401 = global::OpenRouter.InternChatErrorResponse.FromJson(__content_401, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_401 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- responseBody: __content_401,
- responseObject: __value_401,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The key belongs to a member who has left the organization and holds no grant.
- if ((int)__response.StatusCode == 403)
- {
- string? __content_403 = null;
- global::System.Exception? __exception_403 = null;
- global::OpenRouter.InternChatErrorResponse? __value_403 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_403 = global::OpenRouter.InternChatErrorResponse.FromJson(__content_403, JsonSerializerContext);
- }
- else
- {
- __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_403 = global::OpenRouter.InternChatErrorResponse.FromJson(__content_403, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_403 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_403,
- responseBody: __content_403,
- responseObject: __value_403,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The caller is outside the interns programme, the intern does not exist for this key (`not_found`), or no pending question has this `tool_call_id` in this session (`interaction_unknown`).
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::OpenRouter.InternChatErrorResponse? __value_404 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_404 = global::OpenRouter.InternChatErrorResponse.FromJson(__content_404, JsonSerializerContext);
- }
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_404 = global::OpenRouter.InternChatErrorResponse.FromJson(__content_404, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_404 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- responseBody: __content_404,
- responseObject: __value_404,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The request exceeded the route's own deadline before the handler answered (`timeout`). Distinct from the 504, which is the intern failing to answer within the turn budget.
- if ((int)__response.StatusCode == 408)
- {
- string? __content_408 = null;
- global::System.Exception? __exception_408 = null;
- global::OpenRouter.InternChatErrorResponse? __value_408 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_408 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_408 = global::OpenRouter.InternChatErrorResponse.FromJson(__content_408, JsonSerializerContext);
- }
- else
- {
- __content_408 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_408 = global::OpenRouter.InternChatErrorResponse.FromJson(__content_408, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_408 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_408 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_408,
- responseBody: __content_408,
- responseObject: __value_408,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The intern is not running (`intern_not_ready`), a turn is already running in this session and did not take the message within 15 seconds (`busy`, also sent when the turn is waiting on a question of its own), the question is no longer waiting (`interaction_not_pending`), or another request is already attached to the run (`attachment_failed`). Turns in different sessions on the same intern run in parallel. `intern_not_ready` and `busy` report `retryable: true`, and a `busy` refusal carries `Retry-After`.
- if ((int)__response.StatusCode == 409)
- {
- string? __content_409 = null;
- global::System.Exception? __exception_409 = null;
- global::OpenRouter.InternChatErrorResponse? __value_409 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_409 = global::OpenRouter.InternChatErrorResponse.FromJson(__content_409, JsonSerializerContext);
- }
- else
- {
- __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_409 = global::OpenRouter.InternChatErrorResponse.FromJson(__content_409, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_409 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_409 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_409,
- responseBody: __content_409,
- responseObject: __value_409,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The run produced more output than the intern retains, so the paused stream cannot be resumed (`attachment_failed`).
- if ((int)__response.StatusCode == 410)
- {
- string? __content_410 = null;
- global::System.Exception? __exception_410 = null;
- global::OpenRouter.InternChatErrorResponse? __value_410 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_410 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_410 = global::OpenRouter.InternChatErrorResponse.FromJson(__content_410, JsonSerializerContext);
- }
- else
- {
- __content_410 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_410 = global::OpenRouter.InternChatErrorResponse.FromJson(__content_410, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_410 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_410 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_410,
- responseBody: __content_410,
- responseObject: __value_410,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The body exceeds 1 MiB (`payload_too_large`).
- if ((int)__response.StatusCode == 413)
- {
- string? __content_413 = null;
- global::System.Exception? __exception_413 = null;
- global::OpenRouter.InternChatErrorResponse? __value_413 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_413 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_413 = global::OpenRouter.InternChatErrorResponse.FromJson(__content_413, JsonSerializerContext);
- }
- else
- {
- __content_413 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_413 = global::OpenRouter.InternChatErrorResponse.FromJson(__content_413, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_413 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_413 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_413,
- responseBody: __content_413,
- responseObject: __value_413,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // Too many turns for the user or organization this key acts as (`rate_limited`). It reports `retryable: true` and carries `Retry-After`.
- if ((int)__response.StatusCode == 429)
- {
- string? __content_429 = null;
- global::System.Exception? __exception_429 = null;
- global::OpenRouter.InternChatErrorResponse? __value_429 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_429 = global::OpenRouter.InternChatErrorResponse.FromJson(__content_429, JsonSerializerContext);
- }
- else
- {
- __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_429 = global::OpenRouter.InternChatErrorResponse.FromJson(__content_429, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_429 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_429,
- responseBody: __content_429,
- responseObject: __value_429,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The intern could not be reached or rejected the request (`intern_unreachable`, `intern_rejected`), the intern refused the turn before any output (`turn_failed`), or its stream ended before the turn started (`stream_severed`). `intern_unreachable` and `stream_severed` are transient and report `retryable: true`; `intern_rejected` reports `false`. A `turn_failed` varies by failure and carries the intern's own classification of what went wrong, so read `metadata.retryable` rather than assuming from the reason.
- if ((int)__response.StatusCode == 502)
- {
- string? __content_502 = null;
- global::System.Exception? __exception_502 = null;
- global::OpenRouter.InternChatErrorResponse? __value_502 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_502 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_502 = global::OpenRouter.InternChatErrorResponse.FromJson(__content_502, JsonSerializerContext);
- }
- else
- {
- __content_502 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_502 = global::OpenRouter.InternChatErrorResponse.FromJson(__content_502, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_502 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_502 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_502,
- responseBody: __content_502,
- responseObject: __value_502,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The intern cannot hold another run open across a question right now (`busy`). It reports `retryable: true` and carries `Retry-After`.
- if ((int)__response.StatusCode == 503)
- {
- string? __content_503 = null;
- global::System.Exception? __exception_503 = null;
- global::OpenRouter.InternChatErrorResponse? __value_503 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_503 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_503 = global::OpenRouter.InternChatErrorResponse.FromJson(__content_503, JsonSerializerContext);
- }
- else
- {
- __content_503 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_503 = global::OpenRouter.InternChatErrorResponse.FromJson(__content_503, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_503 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_503 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_503,
- responseBody: __content_503,
- responseObject: __value_503,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The intern did not answer within the request budget (`timeout`).
- if ((int)__response.StatusCode == 504)
- {
- string? __content_504 = null;
- global::System.Exception? __exception_504 = null;
- global::OpenRouter.InternChatErrorResponse? __value_504 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_504 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_504 = global::OpenRouter.InternChatErrorResponse.FromJson(__content_504, JsonSerializerContext);
- }
- else
- {
- __content_504 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_504 = global::OpenRouter.InternChatErrorResponse.FromJson(__content_504, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_504 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_504 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_504,
- responseBody: __content_504,
- responseObject: __value_504,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
-
- if (__effectiveReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
-
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessChatResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
- {
- __response.EnsureSuccessStatusCode();
-
- var __value = global::OpenRouter.InternChatSteeredResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- return new global::OpenRouter.AutoSDKHttpResponse(
- statusCode: __response.StatusCode,
- headers: global::OpenRouter.AutoSDKHttpResponse.CreateHeaders(__response),
- requestUri: __response.RequestMessage?.RequestUri,
- body: __value);
- }
- catch (global::System.Exception __ex)
- {
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- responseBody: __content,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
-
- var __value = await global::OpenRouter.InternChatSteeredResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- return new global::OpenRouter.AutoSDKHttpResponse(
- statusCode: __response.StatusCode,
- headers: global::OpenRouter.AutoSDKHttpResponse.CreateHeaders(__response),
- requestUri: __response.RequestMessage?.RequestUri,
- body: __value);
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- responseBody: __content,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- }
-
- }
- }
- finally
- {
- __httpRequest?.Dispose();
- }
- }
- ///
- /// Stream a chat completion with an intern
- /// Sends a prompt to one of your interns and streams the reply as OpenAI-compatible server-sent events ending with `[DONE]`. The run executes on the intern, which may pause to ask you something. It then streams one `openrouter.provide_input` tool call and finishes with `finish_reason: "tool_calls"`, and the run stays open on the intern.
- /// Every response, whether it ends with `stop`, `tool_calls` or `error`, is followed by a final chunk with empty `choices` that carries `session_id`, then `data: [DONE]`. That chunk carries the `usage` the intern reported for the run, after `stop` or `error`, and `null` when the intern reported none. After `tool_calls` its `usage` is `null` because the turn is not over. Read through `[DONE]`: the `session_id` you need to reply arrives after the `tool_calls` finish chunk.
- /// To answer, send a second request with the same `session_id`, the assistant message echoing that tool call, and a `tool` message whose `tool_call_id` is the tool call id and whose `content` is the answer. The answer is delivered to the run that asked and the stream continues from where it paused. A question stays open for its interaction deadline (5 minutes by default) and the run is cancelled when that passes. Rejected replies do not extend the deadline.
- /// Closing the connection after the `[DONE]` that follows `finish_reason: "tool_calls"` keeps the run alive. Disconnecting while a response is still streaming cancels the run. The stream writes a `: keepalive` comment whenever nothing else has been written for 30 seconds, so a disconnect is noticed within that interval even while the intern is silent.
- /// A run the intern ends while you are still connected, by cancellation or by a deadline, ends the stream with a `finish_reason: "error"` chunk carrying `410` and reason `run_ended`, then the final empty-`choices` chunk and `[DONE]`. That error reports only an ending the intern confirmed. A connection that breaks without that confirmation ends with reason `stream_severed`, and a client that has already disconnected is promised no final event.
- /// Set `approval_mode` to `manual` to have the intern ask before approval-bearing tools such as the shell. Omitted, the run self-drives and consents on your behalf. The mode belongs to the run started by that prompt and must be repeated on later prompts.
- /// Available to interns programme members. Callers outside the programme receive `404` for every path under `/api/v1/interns`.
- ///
- ///
- /// The intern to talk to.
- /// Example: a11e0000-0000-4000-8000-000000000005
- ///
- ///
- /// How the run started by this prompt handles tool approvals. `self-drive` (the default when omitted) consents on your behalf and runs the shell unsandboxed. `manual` asks you before an approval-bearing tool runs, as an `openrouter.provide_input` permission request, and keeps the shell sandboxed until an escalation is allowed. The mode applies to the run this prompt starts and is not remembered by the session. Repeat it on each new prompt that should use it. A `tool` reply continues the run under the mode it started with.
- /// Example: manual
- ///
- ///
- /// The conversation. Only the last message is read. A last `user` message starts a run. A last `tool` message answers the interaction named by its `tool_call_id` and requires `session_id`.
- ///
- ///
- /// Accepted for OpenAI compatibility and never used. The intern runs the model configured on it (`PATCH` the intern to change it). Streamed chunks report the runtime's identifier for that model as the intern reports it, or `openrouter/intern` on chunks whose event carries no model (before the intern reports one, and on the chunks the API emits itself: the timeout, run-ended and severed-stream error chunks, the stop chunk of a replay that ends without a terminal daemon event, and the final usage chunk after any of them). A usage chunk that follows a daemon completion event carries the model the intern reported.
- /// Example: openrouter/intern
- ///
- ///
- /// The daemon session to continue, as returned in `session_id` on the final chunk of an earlier response. Omit it to start a new session. An id the intern has not seen before is not an error: it starts a new session under that id, so a mistyped id forks the conversation. Sessions are scoped to the intern's own daemon. Required when the last message has role `tool`.
- /// Example: ses_7f3c9a
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- public async global::System.Threading.Tasks.Task ChatAsync(
- string internId,
- global::System.Collections.Generic.IList messages,
- global::OpenRouter.InternApprovalMode? approvalMode = default,
- string? model = default,
- string? sessionId = default,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default)
- {
- var __request = new global::OpenRouter.InternChatCompletionRequest
- {
- ApprovalMode = approvalMode,
- Messages = messages,
- Model = model,
- SessionId = sessionId,
- Stream = false,
- };
-
- return await ChatAsync(
- internId: internId,
- request: __request,
- requestOptions: requestOptions,
- cancellationToken: cancellationToken).ConfigureAwait(false);
- }
- }
-}
\ No newline at end of file
diff --git a/src/libs/OpenRouter/Generated/OpenRouter.Interns2Client.ChatAsStream.g.cs b/src/libs/OpenRouter/Generated/OpenRouter.Interns2Client.ChatAsStream.g.cs
deleted file mode 100644
index 7c7db16e..00000000
--- a/src/libs/OpenRouter/Generated/OpenRouter.Interns2Client.ChatAsStream.g.cs
+++ /dev/null
@@ -1,470 +0,0 @@
-
-#nullable enable
-
-namespace OpenRouter
-{
- public partial class Interns2Client
- {
-
-
- private static readonly global::OpenRouter.EndPointSecurityRequirement s_ChatAsStreamSecurityRequirement0 =
- new global::OpenRouter.EndPointSecurityRequirement
- {
- Authorizations = new global::OpenRouter.EndPointAuthorizationRequirement[]
- { new global::OpenRouter.EndPointAuthorizationRequirement
- {
- Type = "Http",
- SchemeId = "Bearer",
- Location = "Header",
- Name = "Bearer",
- FriendlyName = "Bearer",
- },
- },
- };
- private static readonly global::OpenRouter.EndPointSecurityRequirement[] s_ChatAsStreamSecurityRequirements =
- new global::OpenRouter.EndPointSecurityRequirement[]
- { s_ChatAsStreamSecurityRequirement0,
- };
- partial void PrepareChatAsStreamArguments(
- global::System.Net.Http.HttpClient httpClient,
- ref string internId,
- global::OpenRouter.InternChatCompletionRequest request);
- partial void PrepareChatAsStreamRequest(
- global::System.Net.Http.HttpClient httpClient,
- global::System.Net.Http.HttpRequestMessage httpRequestMessage,
- string internId,
- global::OpenRouter.InternChatCompletionRequest request);
- partial void ProcessChatAsStreamResponse(
- global::System.Net.Http.HttpClient httpClient,
- global::System.Net.Http.HttpResponseMessage httpResponseMessage);
-
- ///
- /// Stream a chat completion with an intern
- /// Sends a prompt to one of your interns and streams the reply as OpenAI-compatible server-sent events ending with `[DONE]`. The run executes on the intern, which may pause to ask you something. It then streams one `openrouter.provide_input` tool call and finishes with `finish_reason: "tool_calls"`, and the run stays open on the intern.
- /// Every response, whether it ends with `stop`, `tool_calls` or `error`, is followed by a final chunk with empty `choices` that carries `session_id`, then `data: [DONE]`. That chunk carries the `usage` the intern reported for the run, after `stop` or `error`, and `null` when the intern reported none. After `tool_calls` its `usage` is `null` because the turn is not over. Read through `[DONE]`: the `session_id` you need to reply arrives after the `tool_calls` finish chunk.
- /// To answer, send a second request with the same `session_id`, the assistant message echoing that tool call, and a `tool` message whose `tool_call_id` is the tool call id and whose `content` is the answer. The answer is delivered to the run that asked and the stream continues from where it paused. A question stays open for its interaction deadline (5 minutes by default) and the run is cancelled when that passes. Rejected replies do not extend the deadline.
- /// Closing the connection after the `[DONE]` that follows `finish_reason: "tool_calls"` keeps the run alive. Disconnecting while a response is still streaming cancels the run. The stream writes a `: keepalive` comment whenever nothing else has been written for 30 seconds, so a disconnect is noticed within that interval even while the intern is silent.
- /// A run the intern ends while you are still connected, by cancellation or by a deadline, ends the stream with a `finish_reason: "error"` chunk carrying `410` and reason `run_ended`, then the final empty-`choices` chunk and `[DONE]`. That error reports only an ending the intern confirmed. A connection that breaks without that confirmation ends with reason `stream_severed`, and a client that has already disconnected is promised no final event.
- /// Set `approval_mode` to `manual` to have the intern ask before approval-bearing tools such as the shell. Omitted, the run self-drives and consents on your behalf. The mode belongs to the run started by that prompt and must be repeated on later prompts.
- /// Available to interns programme members. Callers outside the programme receive `404` for every path under `/api/v1/interns`.
- ///
- ///
- /// The intern to talk to.
- /// Example: a11e0000-0000-4000-8000-000000000005
- ///
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- public async global::System.Collections.Generic.IAsyncEnumerable ChatAsStreamAsync(
- string internId,
-
- global::OpenRouter.InternChatCompletionRequest request,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- [global::System.Runtime.CompilerServices.EnumeratorCancellation] global::System.Threading.CancellationToken cancellationToken = default)
- {
- request = request ?? throw new global::System.ArgumentNullException(nameof(request));
-
- request = new global::OpenRouter.InternChatCompletionRequest
- {
- ApprovalMode = request.ApprovalMode,
- Messages = request.Messages,
- Model = request.Model,
- SessionId = request.SessionId,
- Stream = true,
- };
- PrepareArguments(
- client: HttpClient);
- PrepareChatAsStreamArguments(
- httpClient: HttpClient,
- internId: ref internId,
- request: request);
-
-
- var __authorizations = global::OpenRouter.EndPointSecurityResolver.ResolveAuthorizations(
- availableAuthorizations: Authorizations,
- securityRequirements: s_ChatAsStreamSecurityRequirements,
- operationName: "ChatAsStreamAsync");
-
- using var __timeoutCancellationTokenSource = global::OpenRouter.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
- clientOptions: Options,
- requestOptions: requestOptions,
- cancellationToken: cancellationToken);
- var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
- var __effectiveReadResponseAsString = global::OpenRouter.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
- clientOptions: Options,
- requestOptions: requestOptions,
- fallbackValue: ReadResponseAsString);
- var __maxAttempts = global::OpenRouter.AutoSDKRequestOptionsSupport.GetMaxAttempts(
- clientOptions: Options,
- requestOptions: requestOptions,
- supportsRetry: false);
-
- global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
- {
-
- var __pathBuilder = new global::OpenRouter.PathBuilder(
- path: $"/interns/{internId}/chat/completions",
- baseUri: HttpClient.BaseAddress ?? new global::System.Uri("https://openrouter.ai/api/v1", global::System.UriKind.RelativeOrAbsolute));
- var __path = __pathBuilder.ToString();
- __path = global::OpenRouter.AutoSDKRequestOptionsSupport.AppendQueryParameters(
- path: __path,
- clientParameters: Options.QueryParameters,
- requestParameters: requestOptions?.QueryParameters);
- var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
-#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
-#endif
-
- __httpRequest.Headers.TryAddWithoutValidation(
- "Accept",
- "text/event-stream");
-
- foreach (var __authorization in __authorizations)
- {
- if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2" ||
- __authorization.Type == "OpenIdConnect")
- {
- __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
- scheme: __authorization.Name,
- parameter: __authorization.Value);
- }
- else if (__authorization.Type == "ApiKey" &&
- __authorization.Location == "Header")
- {
- __httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
- }
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
- global::OpenRouter.AutoSDKRequestOptionsSupport.ApplyHeaders(
- request: __httpRequest,
- clientHeaders: Options.Headers,
- requestHeaders: requestOptions?.Headers);
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareChatAsStreamRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- internId: internId,
- request: request);
-
- global::OpenRouter.AutoSDKHttpRequestOptions.StampAuthorizationOverride(__httpRequest);
-
- return __httpRequest;
- }
-
- global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
- global::System.Net.Http.HttpResponseMessage? __response = null;
- var __attemptNumber = 0;
- try
- {
- for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
- {
- __attemptNumber = __attempt;
- __httpRequest = __CreateHttpRequest();
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "ChatAsStream",
- methodName: "ChatAsStreamAsync",
- pathTemplate: "$\"/interns/{internId}/chat/completions\"",
- httpMethod: "POST",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: null,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- try
- {
- __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseHeadersRead,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- }
- catch (global::System.Net.Http.HttpRequestException __exception)
- {
- var __retryDelay = global::OpenRouter.AutoSDKRequestOptionsSupport.GetRetryDelay(
- clientOptions: Options,
- requestOptions: requestOptions,
- response: null,
- attempt: __attempt);
- var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "ChatAsStream",
- methodName: "ChatAsStreamAsync",
- pathTemplate: "$\"/interns/{internId}/chat/completions\"",
- httpMethod: "POST",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: null,
- exception: __exception,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: __willRetry,
- retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
- retryReason: "exception",
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- if (!__willRetry)
- {
- throw;
- }
-
- __httpRequest.Dispose();
- __httpRequest = null;
- await global::OpenRouter.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- retryDelay: __retryDelay,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- continue;
- }
-
- if (__response != null &&
- __attempt < __maxAttempts &&
- global::OpenRouter.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
- {
- var __retryDelay = global::OpenRouter.AutoSDKRequestOptionsSupport.GetRetryDelay(
- clientOptions: Options,
- requestOptions: requestOptions,
- response: __response,
- attempt: __attempt);
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "ChatAsStream",
- methodName: "ChatAsStreamAsync",
- pathTemplate: "$\"/interns/{internId}/chat/completions\"",
- httpMethod: "POST",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: true,
- retryDelay: __retryDelay,
- retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- __response.Dispose();
- __response = null;
- __httpRequest.Dispose();
- __httpRequest = null;
- await global::OpenRouter.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- retryDelay: __retryDelay,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- continue;
- }
-
- break;
- }
-
- if (__response == null)
- {
- throw new global::System.InvalidOperationException("No response received.");
- }
-
- using (__response)
- {
-
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessChatAsStreamResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- if (__response.IsSuccessStatusCode)
- {
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "ChatAsStream",
- methodName: "ChatAsStreamAsync",
- pathTemplate: "$\"/interns/{internId}/chat/completions\"",
- httpMethod: "POST",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attemptNumber,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- }
- else
- {
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "ChatAsStream",
- methodName: "ChatAsStreamAsync",
- pathTemplate: "$\"/interns/{internId}/chat/completions\"",
- httpMethod: "POST",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attemptNumber,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- }
-
- try
- {
- __response.EnsureSuccessStatusCode();
- }
- catch (global::System.Net.Http.HttpRequestException __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- responseBody: __content,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
-
- using var __stream = await __response.Content.ReadAsStreamAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
-
- await foreach (var __sseEvent in global::System.Net.ServerSentEvents.SseParser
- .Create(__stream).EnumerateAsync(__effectiveCancellationToken))
- {
- var __content = __sseEvent.Data;
- if (__content == "[DONE]")
- {
- yield break;
- }
-
- var __streamedResponse = global::OpenRouter.InternChatStreamingResponse.FromJson(__content, JsonSerializerContext) ??
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: $"Response deserialization failed for \"{__content}\" ",
- innerException: null,
- responseBody: __content,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
-
- yield return __streamedResponse;
- }
-
- }
- }
- finally
- {
- __httpRequest?.Dispose();
- }
- }
- ///
- /// Stream a chat completion with an intern
- /// Sends a prompt to one of your interns and streams the reply as OpenAI-compatible server-sent events ending with `[DONE]`. The run executes on the intern, which may pause to ask you something. It then streams one `openrouter.provide_input` tool call and finishes with `finish_reason: "tool_calls"`, and the run stays open on the intern.
- /// Every response, whether it ends with `stop`, `tool_calls` or `error`, is followed by a final chunk with empty `choices` that carries `session_id`, then `data: [DONE]`. That chunk carries the `usage` the intern reported for the run, after `stop` or `error`, and `null` when the intern reported none. After `tool_calls` its `usage` is `null` because the turn is not over. Read through `[DONE]`: the `session_id` you need to reply arrives after the `tool_calls` finish chunk.
- /// To answer, send a second request with the same `session_id`, the assistant message echoing that tool call, and a `tool` message whose `tool_call_id` is the tool call id and whose `content` is the answer. The answer is delivered to the run that asked and the stream continues from where it paused. A question stays open for its interaction deadline (5 minutes by default) and the run is cancelled when that passes. Rejected replies do not extend the deadline.
- /// Closing the connection after the `[DONE]` that follows `finish_reason: "tool_calls"` keeps the run alive. Disconnecting while a response is still streaming cancels the run. The stream writes a `: keepalive` comment whenever nothing else has been written for 30 seconds, so a disconnect is noticed within that interval even while the intern is silent.
- /// A run the intern ends while you are still connected, by cancellation or by a deadline, ends the stream with a `finish_reason: "error"` chunk carrying `410` and reason `run_ended`, then the final empty-`choices` chunk and `[DONE]`. That error reports only an ending the intern confirmed. A connection that breaks without that confirmation ends with reason `stream_severed`, and a client that has already disconnected is promised no final event.
- /// Set `approval_mode` to `manual` to have the intern ask before approval-bearing tools such as the shell. Omitted, the run self-drives and consents on your behalf. The mode belongs to the run started by that prompt and must be repeated on later prompts.
- /// Available to interns programme members. Callers outside the programme receive `404` for every path under `/api/v1/interns`.
- ///
- ///
- /// The intern to talk to.
- /// Example: a11e0000-0000-4000-8000-000000000005
- ///
- ///
- /// How the run started by this prompt handles tool approvals. `self-drive` (the default when omitted) consents on your behalf and runs the shell unsandboxed. `manual` asks you before an approval-bearing tool runs, as an `openrouter.provide_input` permission request, and keeps the shell sandboxed until an escalation is allowed. The mode applies to the run this prompt starts and is not remembered by the session. Repeat it on each new prompt that should use it. A `tool` reply continues the run under the mode it started with.
- /// Example: manual
- ///
- ///
- /// The conversation. Only the last message is read. A last `user` message starts a run. A last `tool` message answers the interaction named by its `tool_call_id` and requires `session_id`.
- ///
- ///
- /// Accepted for OpenAI compatibility and never used. The intern runs the model configured on it (`PATCH` the intern to change it). Streamed chunks report the runtime's identifier for that model as the intern reports it, or `openrouter/intern` on chunks whose event carries no model (before the intern reports one, and on the chunks the API emits itself: the timeout, run-ended and severed-stream error chunks, the stop chunk of a replay that ends without a terminal daemon event, and the final usage chunk after any of them). A usage chunk that follows a daemon completion event carries the model the intern reported.
- /// Example: openrouter/intern
- ///
- ///
- /// The daemon session to continue, as returned in `session_id` on the final chunk of an earlier response. Omit it to start a new session. An id the intern has not seen before is not an error: it starts a new session under that id, so a mistyped id forks the conversation. Sessions are scoped to the intern's own daemon. Required when the last message has role `tool`.
- /// Example: ses_7f3c9a
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- public async global::System.Collections.Generic.IAsyncEnumerable ChatAsStreamAsync(
- string internId,
- global::System.Collections.Generic.IList messages,
- global::OpenRouter.InternApprovalMode? approvalMode = default,
- string? model = default,
- string? sessionId = default,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- [global::System.Runtime.CompilerServices.EnumeratorCancellation] global::System.Threading.CancellationToken cancellationToken = default)
- {
- var __request = new global::OpenRouter.InternChatCompletionRequest
- {
- ApprovalMode = approvalMode,
- Messages = messages,
- Model = model,
- SessionId = sessionId,
- Stream = true,
- };
-
- var __enumerable = ChatAsStreamAsync(
- internId: internId,
- request: __request,
- requestOptions: requestOptions,
- cancellationToken: cancellationToken);
-
- await foreach (var __response in __enumerable)
- {
- yield return __response;
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/libs/OpenRouter/Generated/OpenRouter.Interns2Client.Invoke.g.cs b/src/libs/OpenRouter/Generated/OpenRouter.Interns2Client.Invoke.g.cs
deleted file mode 100644
index c67ec655..00000000
--- a/src/libs/OpenRouter/Generated/OpenRouter.Interns2Client.Invoke.g.cs
+++ /dev/null
@@ -1,945 +0,0 @@
-
-#nullable enable
-
-namespace OpenRouter
-{
- public partial class Interns2Client
- {
-
-
- private static readonly global::OpenRouter.EndPointSecurityRequirement s_InvokeSecurityRequirement0 =
- new global::OpenRouter.EndPointSecurityRequirement
- {
- Authorizations = new global::OpenRouter.EndPointAuthorizationRequirement[]
- { new global::OpenRouter.EndPointAuthorizationRequirement
- {
- Type = "Http",
- SchemeId = "Bearer",
- Location = "Header",
- Name = "Bearer",
- FriendlyName = "Bearer",
- },
- },
- };
- private static readonly global::OpenRouter.EndPointSecurityRequirement[] s_InvokeSecurityRequirements =
- new global::OpenRouter.EndPointSecurityRequirement[]
- { s_InvokeSecurityRequirement0,
- };
- partial void PrepareInvokeArguments(
- global::System.Net.Http.HttpClient httpClient,
- ref string internId,
- global::OpenRouter.InternInvokeRequest request);
- partial void PrepareInvokeRequest(
- global::System.Net.Http.HttpClient httpClient,
- global::System.Net.Http.HttpRequestMessage httpRequestMessage,
- string internId,
- global::OpenRouter.InternInvokeRequest request);
- partial void ProcessInvokeResponse(
- global::System.Net.Http.HttpClient httpClient,
- global::System.Net.Http.HttpResponseMessage httpResponseMessage);
-
- partial void ProcessInvokeResponseContent(
- global::System.Net.Http.HttpClient httpClient,
- global::System.Net.Http.HttpResponseMessage httpResponseMessage,
- ref string content);
-
- ///
- /// Start an intern run without waiting for it
- /// Starts a run on one of your interns and answers `202` with the `session_id` as soon as the intern accepts it. The run keeps going on the intern after the response. Nothing about its progress comes back on this request; the intern reports through its own tools, such as Slack.
- /// Send the same `session_id` later to continue the conversation, for example to hand the intern a decision on work it started. If that session already has a run going, the prompt is delivered into it and the status is `steered`. A `session_id` is accepted only from the caller it was issued to, on the same intern; any other, including sessions started from Slack or the chat endpoint, is refused with `404`.
- /// Runs started here self-drive: the intern consents to its own tool approvals, and a question it asks is answered by its own fallback. A run ends when the intern finishes it or after its execution deadline (1 hour by default).
- /// Available to interns programme members. Callers outside the programme receive `404` for every path under `/api/v1/interns`.
- ///
- ///
- /// The intern to run.
- /// Example: a11e0000-0000-4000-8000-000000000005
- ///
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- public async global::System.Threading.Tasks.Task InvokeAsync(
- string internId,
-
- global::OpenRouter.InternInvokeRequest request,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default)
- {
- var __response = await InvokeAsResponseAsync(
- internId: internId,
-
- request: request,
- requestOptions: requestOptions,
- cancellationToken: cancellationToken
- ).ConfigureAwait(false);
-
- return __response.Body;
- }
- ///
- /// Start an intern run without waiting for it
- /// Starts a run on one of your interns and answers `202` with the `session_id` as soon as the intern accepts it. The run keeps going on the intern after the response. Nothing about its progress comes back on this request; the intern reports through its own tools, such as Slack.
- /// Send the same `session_id` later to continue the conversation, for example to hand the intern a decision on work it started. If that session already has a run going, the prompt is delivered into it and the status is `steered`. A `session_id` is accepted only from the caller it was issued to, on the same intern; any other, including sessions started from Slack or the chat endpoint, is refused with `404`.
- /// Runs started here self-drive: the intern consents to its own tool approvals, and a question it asks is answered by its own fallback. A run ends when the intern finishes it or after its execution deadline (1 hour by default).
- /// Available to interns programme members. Callers outside the programme receive `404` for every path under `/api/v1/interns`.
- ///
- ///
- /// The intern to run.
- /// Example: a11e0000-0000-4000-8000-000000000005
- ///
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- public async global::System.Threading.Tasks.Task> InvokeAsResponseAsync(
- string internId,
-
- global::OpenRouter.InternInvokeRequest request,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default)
- {
- request = request ?? throw new global::System.ArgumentNullException(nameof(request));
-
- PrepareArguments(
- client: HttpClient);
- PrepareInvokeArguments(
- httpClient: HttpClient,
- internId: ref internId,
- request: request);
-
-
- var __authorizations = global::OpenRouter.EndPointSecurityResolver.ResolveAuthorizations(
- availableAuthorizations: Authorizations,
- securityRequirements: s_InvokeSecurityRequirements,
- operationName: "InvokeAsync");
-
- using var __timeoutCancellationTokenSource = global::OpenRouter.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
- clientOptions: Options,
- requestOptions: requestOptions,
- cancellationToken: cancellationToken);
- var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
- var __effectiveReadResponseAsString = global::OpenRouter.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
- clientOptions: Options,
- requestOptions: requestOptions,
- fallbackValue: ReadResponseAsString);
- var __maxAttempts = global::OpenRouter.AutoSDKRequestOptionsSupport.GetMaxAttempts(
- clientOptions: Options,
- requestOptions: requestOptions,
- supportsRetry: true);
-
- global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
- {
-
- var __pathBuilder = new global::OpenRouter.PathBuilder(
- path: $"/interns/{internId}/invoke",
- baseUri: HttpClient.BaseAddress ?? new global::System.Uri("https://openrouter.ai/api/v1", global::System.UriKind.RelativeOrAbsolute));
- var __path = __pathBuilder.ToString();
- __path = global::OpenRouter.AutoSDKRequestOptionsSupport.AppendQueryParameters(
- path: __path,
- clientParameters: Options.QueryParameters,
- requestParameters: requestOptions?.QueryParameters);
- var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
-#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
-#endif
-
- foreach (var __authorization in __authorizations)
- {
- if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2" ||
- __authorization.Type == "OpenIdConnect")
- {
- __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
- scheme: __authorization.Name,
- parameter: __authorization.Value);
- }
- else if (__authorization.Type == "ApiKey" &&
- __authorization.Location == "Header")
- {
- __httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
- }
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
- global::OpenRouter.AutoSDKRequestOptionsSupport.ApplyHeaders(
- request: __httpRequest,
- clientHeaders: Options.Headers,
- requestHeaders: requestOptions?.Headers);
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareInvokeRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- internId: internId,
- request: request);
-
- global::OpenRouter.AutoSDKHttpRequestOptions.StampAuthorizationOverride(__httpRequest);
-
- return __httpRequest;
- }
-
- global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
- global::System.Net.Http.HttpResponseMessage? __response = null;
- var __attemptNumber = 0;
- try
- {
- for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
- {
- __attemptNumber = __attempt;
- __httpRequest = __CreateHttpRequest();
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "Invoke",
- methodName: "InvokeAsync",
- pathTemplate: "$\"/interns/{internId}/invoke\"",
- httpMethod: "POST",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: null,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- try
- {
- __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- }
- catch (global::System.Net.Http.HttpRequestException __exception)
- {
- var __retryDelay = global::OpenRouter.AutoSDKRequestOptionsSupport.GetRetryDelay(
- clientOptions: Options,
- requestOptions: requestOptions,
- response: null,
- attempt: __attempt);
- var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "Invoke",
- methodName: "InvokeAsync",
- pathTemplate: "$\"/interns/{internId}/invoke\"",
- httpMethod: "POST",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: null,
- exception: __exception,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: __willRetry,
- retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
- retryReason: "exception",
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- if (!__willRetry)
- {
- throw;
- }
-
- __httpRequest.Dispose();
- __httpRequest = null;
- await global::OpenRouter.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- retryDelay: __retryDelay,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- continue;
- }
-
- if (__response != null &&
- __attempt < __maxAttempts &&
- global::OpenRouter.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
- {
- var __retryDelay = global::OpenRouter.AutoSDKRequestOptionsSupport.GetRetryDelay(
- clientOptions: Options,
- requestOptions: requestOptions,
- response: __response,
- attempt: __attempt);
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "Invoke",
- methodName: "InvokeAsync",
- pathTemplate: "$\"/interns/{internId}/invoke\"",
- httpMethod: "POST",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: true,
- retryDelay: __retryDelay,
- retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- __response.Dispose();
- __response = null;
- __httpRequest.Dispose();
- __httpRequest = null;
- await global::OpenRouter.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- retryDelay: __retryDelay,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- continue;
- }
-
- break;
- }
-
- if (__response == null)
- {
- throw new global::System.InvalidOperationException("No response received.");
- }
-
- using (__response)
- {
-
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessInvokeResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- if (__response.IsSuccessStatusCode)
- {
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "Invoke",
- methodName: "InvokeAsync",
- pathTemplate: "$\"/interns/{internId}/invoke\"",
- httpMethod: "POST",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attemptNumber,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- }
- else
- {
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "Invoke",
- methodName: "InvokeAsync",
- pathTemplate: "$\"/interns/{internId}/invoke\"",
- httpMethod: "POST",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attemptNumber,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- }
- // The body is not a valid request (`bad_request`).
- if ((int)__response.StatusCode == 400)
- {
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::OpenRouter.InternChatErrorResponse? __value_400 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_400 = global::OpenRouter.InternChatErrorResponse.FromJson(__content_400, JsonSerializerContext);
- }
- else
- {
- __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_400 = global::OpenRouter.InternChatErrorResponse.FromJson(__content_400, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- responseBody: __content_400,
- responseObject: __value_400,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // No valid API key.
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::OpenRouter.InternChatErrorResponse? __value_401 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_401 = global::OpenRouter.InternChatErrorResponse.FromJson(__content_401, JsonSerializerContext);
- }
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_401 = global::OpenRouter.InternChatErrorResponse.FromJson(__content_401, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_401 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- responseBody: __content_401,
- responseObject: __value_401,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The key belongs to a member who has left the organization and holds no grant.
- if ((int)__response.StatusCode == 403)
- {
- string? __content_403 = null;
- global::System.Exception? __exception_403 = null;
- global::OpenRouter.InternChatErrorResponse? __value_403 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_403 = global::OpenRouter.InternChatErrorResponse.FromJson(__content_403, JsonSerializerContext);
- }
- else
- {
- __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_403 = global::OpenRouter.InternChatErrorResponse.FromJson(__content_403, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_403 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_403,
- responseBody: __content_403,
- responseObject: __value_403,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The caller is outside the interns programme, the intern does not exist for this key, or the `session_id` was not issued to this caller on this intern (`not_found`).
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::OpenRouter.InternChatErrorResponse? __value_404 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_404 = global::OpenRouter.InternChatErrorResponse.FromJson(__content_404, JsonSerializerContext);
- }
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_404 = global::OpenRouter.InternChatErrorResponse.FromJson(__content_404, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_404 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- responseBody: __content_404,
- responseObject: __value_404,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The request exceeded the route's own deadline before the handler answered (`timeout`).
- if ((int)__response.StatusCode == 408)
- {
- string? __content_408 = null;
- global::System.Exception? __exception_408 = null;
- global::OpenRouter.InternChatErrorResponse? __value_408 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_408 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_408 = global::OpenRouter.InternChatErrorResponse.FromJson(__content_408, JsonSerializerContext);
- }
- else
- {
- __content_408 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_408 = global::OpenRouter.InternChatErrorResponse.FromJson(__content_408, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_408 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_408 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_408,
- responseBody: __content_408,
- responseObject: __value_408,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The intern is not running or its runtime is too old to keep a run going without a connection (`intern_not_ready`), or the session already has a run that did not take the prompt (`busy`). A `busy` refusal carries `Retry-After`.
- if ((int)__response.StatusCode == 409)
- {
- string? __content_409 = null;
- global::System.Exception? __exception_409 = null;
- global::OpenRouter.InternChatErrorResponse? __value_409 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_409 = global::OpenRouter.InternChatErrorResponse.FromJson(__content_409, JsonSerializerContext);
- }
- else
- {
- __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_409 = global::OpenRouter.InternChatErrorResponse.FromJson(__content_409, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_409 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_409 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_409,
- responseBody: __content_409,
- responseObject: __value_409,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The body exceeds 1 MiB (`payload_too_large`).
- if ((int)__response.StatusCode == 413)
- {
- string? __content_413 = null;
- global::System.Exception? __exception_413 = null;
- global::OpenRouter.InternChatErrorResponse? __value_413 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_413 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_413 = global::OpenRouter.InternChatErrorResponse.FromJson(__content_413, JsonSerializerContext);
- }
- else
- {
- __content_413 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_413 = global::OpenRouter.InternChatErrorResponse.FromJson(__content_413, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_413 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_413 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_413,
- responseBody: __content_413,
- responseObject: __value_413,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // Too many turns for the user or organization this key acts as (`rate_limited`). It carries `Retry-After`.
- if ((int)__response.StatusCode == 429)
- {
- string? __content_429 = null;
- global::System.Exception? __exception_429 = null;
- global::OpenRouter.InternChatErrorResponse? __value_429 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_429 = global::OpenRouter.InternChatErrorResponse.FromJson(__content_429, JsonSerializerContext);
- }
- else
- {
- __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_429 = global::OpenRouter.InternChatErrorResponse.FromJson(__content_429, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_429 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_429,
- responseBody: __content_429,
- responseObject: __value_429,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The intern could not be looked up, or authenticating the key failed.
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::OpenRouter.InternChatErrorResponse? __value_500 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_500 = global::OpenRouter.InternChatErrorResponse.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_500 = global::OpenRouter.InternChatErrorResponse.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- responseBody: __content_500,
- responseObject: __value_500,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The intern could not be reached, rejected the request, or refused the turn before it started.
- if ((int)__response.StatusCode == 502)
- {
- string? __content_502 = null;
- global::System.Exception? __exception_502 = null;
- global::OpenRouter.InternChatErrorResponse? __value_502 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_502 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_502 = global::OpenRouter.InternChatErrorResponse.FromJson(__content_502, JsonSerializerContext);
- }
- else
- {
- __content_502 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_502 = global::OpenRouter.InternChatErrorResponse.FromJson(__content_502, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_502 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_502 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_502,
- responseBody: __content_502,
- responseObject: __value_502,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The intern cannot take another run right now (`busy`). It reports `retryable: true` and carries `Retry-After`.
- if ((int)__response.StatusCode == 503)
- {
- string? __content_503 = null;
- global::System.Exception? __exception_503 = null;
- global::OpenRouter.InternChatErrorResponse? __value_503 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_503 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_503 = global::OpenRouter.InternChatErrorResponse.FromJson(__content_503, JsonSerializerContext);
- }
- else
- {
- __content_503 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_503 = global::OpenRouter.InternChatErrorResponse.FromJson(__content_503, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_503 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_503 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_503,
- responseBody: __content_503,
- responseObject: __value_503,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The intern did not accept the turn in time (`timeout`).
- if ((int)__response.StatusCode == 504)
- {
- string? __content_504 = null;
- global::System.Exception? __exception_504 = null;
- global::OpenRouter.InternChatErrorResponse? __value_504 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_504 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_504 = global::OpenRouter.InternChatErrorResponse.FromJson(__content_504, JsonSerializerContext);
- }
- else
- {
- __content_504 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_504 = global::OpenRouter.InternChatErrorResponse.FromJson(__content_504, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_504 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_504 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_504,
- responseBody: __content_504,
- responseObject: __value_504,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
-
- if (__effectiveReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
-
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessInvokeResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
- {
- __response.EnsureSuccessStatusCode();
-
- var __value = global::OpenRouter.InternInvokeAcceptedResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- return new global::OpenRouter.AutoSDKHttpResponse(
- statusCode: __response.StatusCode,
- headers: global::OpenRouter.AutoSDKHttpResponse.CreateHeaders(__response),
- requestUri: __response.RequestMessage?.RequestUri,
- body: __value);
- }
- catch (global::System.Exception __ex)
- {
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- responseBody: __content,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
-
- var __value = await global::OpenRouter.InternInvokeAcceptedResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- return new global::OpenRouter.AutoSDKHttpResponse(
- statusCode: __response.StatusCode,
- headers: global::OpenRouter.AutoSDKHttpResponse.CreateHeaders(__response),
- requestUri: __response.RequestMessage?.RequestUri,
- body: __value);
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- responseBody: __content,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- }
-
- }
- }
- finally
- {
- __httpRequest?.Dispose();
- }
- }
- ///
- /// Start an intern run without waiting for it
- /// Starts a run on one of your interns and answers `202` with the `session_id` as soon as the intern accepts it. The run keeps going on the intern after the response. Nothing about its progress comes back on this request; the intern reports through its own tools, such as Slack.
- /// Send the same `session_id` later to continue the conversation, for example to hand the intern a decision on work it started. If that session already has a run going, the prompt is delivered into it and the status is `steered`. A `session_id` is accepted only from the caller it was issued to, on the same intern; any other, including sessions started from Slack or the chat endpoint, is refused with `404`.
- /// Runs started here self-drive: the intern consents to its own tool approvals, and a question it asks is answered by its own fallback. A run ends when the intern finishes it or after its execution deadline (1 hour by default).
- /// Available to interns programme members. Callers outside the programme receive `404` for every path under `/api/v1/interns`.
- ///
- ///
- /// The intern to run.
- /// Example: a11e0000-0000-4000-8000-000000000005
- ///
- ///
- /// The prompt for the run, at most 32000 characters.
- /// Example: New support ticket 48213. Case token: ct_9f2c. Investigate and reply.
- ///
- ///
- /// The session to run in. Send the `session_id` from an earlier `202` to continue that conversation, for example to hand the intern a decision on a case it is working. Omit it to start a new session. Only a `session_id` this endpoint issued to the same caller on the same intern is accepted; any other is refused with `404`.
- /// Example: b51a0e21-368b-4780-a220-14655bf28c55
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- public async global::System.Threading.Tasks.Task InvokeAsync(
- string internId,
- string input,
- string? sessionId = default,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default)
- {
- var __request = new global::OpenRouter.InternInvokeRequest
- {
- Input = input,
- SessionId = sessionId,
- };
-
- return await InvokeAsync(
- internId: internId,
- request: __request,
- requestOptions: requestOptions,
- cancellationToken: cancellationToken).ConfigureAwait(false);
- }
- }
-}
\ No newline at end of file
diff --git a/src/libs/OpenRouter/Generated/OpenRouter.Interns2Client.g.cs b/src/libs/OpenRouter/Generated/OpenRouter.Interns2Client.g.cs
deleted file mode 100644
index 77cea3df..00000000
--- a/src/libs/OpenRouter/Generated/OpenRouter.Interns2Client.g.cs
+++ /dev/null
@@ -1,155 +0,0 @@
-
-#nullable enable
-
-namespace OpenRouter
-{
- ///
- /// If no httpClient is provided, a new one will be created.
- /// If no baseUri is provided, the default baseUri from OpenAPI spec will be used.
- ///
- public sealed partial class Interns2Client : global::OpenRouter.IInterns2Client, global::System.IDisposable
- {
- ///
- /// Production server
- ///
- public const string DefaultBaseUrl = "https://openrouter.ai/api/v1";
-
- private bool _disposeHttpClient = true;
-
- ///
- public global::System.Net.Http.HttpClient HttpClient { get; }
-
- ///
- public System.Uri? BaseUri => HttpClient.BaseAddress;
-
- ///
- public global::System.Collections.Generic.List Authorizations { get; }
-
- ///
- public bool ReadResponseAsString { get; set; }
-#if DEBUG
- = true;
-#endif
-
- ///
- public global::OpenRouter.AutoSDKClientOptions Options { get; }
-
-
- ///
- public global::System.Func CreateIdempotencyKey { get; set; } = () => global::System.Guid.NewGuid().ToString("D");
-
-
- internal global::OpenRouter.AutoSDKServerConfiguration AutoSDKServerConfiguration { get; set; } = new global::OpenRouter.AutoSDKServerConfiguration();
-
- internal global::System.Lazy? JsonSerializerContextProvider { get; set; }
-
- ///
- ///
- ///
- public global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext
- {
- get => JsonSerializerContextProvider?.Value ?? global::OpenRouter.SourceGenerationContext.Default;
- set => JsonSerializerContextProvider = new(() => value);
- }
-
-
- ///
- /// Creates a new instance of the Interns2Client.
- /// If no httpClient is provided, a new one will be created.
- /// If no baseUri is provided, the default baseUri from OpenAPI spec will be used.
- ///
- /// The HttpClient instance. If not provided, a new one will be created.
- /// The base URL for the API. If not provided, the default baseUri from OpenAPI spec will be used.
- /// The authorizations to use for the requests.
- /// Dispose the HttpClient when the instance is disposed. True by default.
- public Interns2Client(
- global::System.Net.Http.HttpClient? httpClient = null,
- global::System.Uri? baseUri = null,
- global::System.Collections.Generic.List? authorizations = null,
- bool disposeHttpClient = true) : this(
- httpClient,
- baseUri,
- authorizations,
- options: null,
- disposeHttpClient: disposeHttpClient)
- {
- }
-
- ///
- /// Creates a new instance of the Interns2Client with explicit options but no base URL override.
- /// Skips passing baseUri so the default base URL from the OpenAPI spec applies.
- ///
- /// The HttpClient instance. If not provided, a new one will be created.
- /// The authorizations to use for the requests.
- /// Client-wide request defaults such as headers, query parameters, retries, and timeout.
- /// Dispose the HttpClient when the instance is disposed. True by default.
- public Interns2Client(
- global::System.Net.Http.HttpClient? httpClient,
- global::System.Collections.Generic.List? authorizations,
- global::OpenRouter.AutoSDKClientOptions? options,
- bool disposeHttpClient = true) : this(
- httpClient,
- baseUri: null,
- authorizations,
- options,
- disposeHttpClient: disposeHttpClient)
- {
- }
-
- ///
- /// Creates a new instance of the Interns2Client.
- /// If no httpClient is provided, a new one will be created.
- /// If no baseUri is provided, the default baseUri from OpenAPI spec will be used.
- ///
- /// The HttpClient instance. If not provided, a new one will be created.
- /// The base URL for the API. If not provided, the default baseUri from OpenAPI spec will be used.
- /// The authorizations to use for the requests.
- /// Client-wide request defaults such as headers, query parameters, retries, and timeout.
- /// Dispose the HttpClient when the instance is disposed. True by default.
- public Interns2Client(
- global::System.Net.Http.HttpClient? httpClient,
- global::System.Uri? baseUri,
- global::System.Collections.Generic.List? authorizations,
- global::OpenRouter.AutoSDKClientOptions? options,
- bool disposeHttpClient = true)
- {
-
- HttpClient = httpClient ?? new global::System.Net.Http.HttpClient();
- if (baseUri is not null)
- {
- HttpClient.BaseAddress ??= baseUri;
- }
- Authorizations = authorizations ?? new global::System.Collections.Generic.List();
- Options = options ?? new global::OpenRouter.AutoSDKClientOptions();
- _disposeHttpClient = disposeHttpClient;
-
- AutoSDKServerConfiguration.ExplicitBaseUri = baseUri ?? httpClient?.BaseAddress;
-
- Initialized(HttpClient);
- }
-
- ///
- public void Dispose()
- {
- if (_disposeHttpClient)
- {
- HttpClient.Dispose();
- }
- }
-
- partial void Initialized(
- global::System.Net.Http.HttpClient client);
- partial void PrepareArguments(
- global::System.Net.Http.HttpClient client);
- partial void PrepareRequest(
- global::System.Net.Http.HttpClient client,
- global::System.Net.Http.HttpRequestMessage request);
- partial void ProcessResponse(
- global::System.Net.Http.HttpClient client,
- global::System.Net.Http.HttpResponseMessage response);
- partial void ProcessResponseContent(
- global::System.Net.Http.HttpClient client,
- global::System.Net.Http.HttpResponseMessage response,
- ref string content);
- }
-}
\ No newline at end of file
diff --git a/src/libs/OpenRouter/Generated/OpenRouter.InternsClient.CreateIntern.g.cs b/src/libs/OpenRouter/Generated/OpenRouter.InternsClient.CreateIntern.g.cs
deleted file mode 100644
index 8a4b419e..00000000
--- a/src/libs/OpenRouter/Generated/OpenRouter.InternsClient.CreateIntern.g.cs
+++ /dev/null
@@ -1,887 +0,0 @@
-
-#nullable enable
-
-namespace OpenRouter
-{
- public partial class InternsClient
- {
-
-
- private static readonly global::OpenRouter.EndPointSecurityRequirement s_CreateInternSecurityRequirement0 =
- new global::OpenRouter.EndPointSecurityRequirement
- {
- Authorizations = new global::OpenRouter.EndPointAuthorizationRequirement[]
- { new global::OpenRouter.EndPointAuthorizationRequirement
- {
- Type = "Http",
- SchemeId = "Bearer",
- Location = "Header",
- Name = "Bearer",
- FriendlyName = "Bearer",
- },
- },
- };
- private static readonly global::OpenRouter.EndPointSecurityRequirement[] s_CreateInternSecurityRequirements =
- new global::OpenRouter.EndPointSecurityRequirement[]
- { s_CreateInternSecurityRequirement0,
- };
- partial void PrepareCreateInternArguments(
- global::System.Net.Http.HttpClient httpClient,
- ref string? idempotencyKey,
- global::OpenRouter.CreateInternRequest request);
- partial void PrepareCreateInternRequest(
- global::System.Net.Http.HttpClient httpClient,
- global::System.Net.Http.HttpRequestMessage httpRequestMessage,
- string? idempotencyKey,
- global::OpenRouter.CreateInternRequest request);
- partial void ProcessCreateInternResponse(
- global::System.Net.Http.HttpClient httpClient,
- global::System.Net.Http.HttpResponseMessage httpResponseMessage);
-
- partial void ProcessCreateInternResponseContent(
- global::System.Net.Http.HttpClient httpClient,
- global::System.Net.Http.HttpResponseMessage httpResponseMessage,
- ref string content);
-
- ///
- /// Create an intern
- /// Creates an intern in an explicit workspace. The operation also creates its private vault. It can start provisioning immediately or wait for a later provision call. A retry with the same idempotency key and body resumes unfinished work. The request body is capped at 1048576 bytes and a larger body is refused with 413. A non-empty body must declare `Content-Type: application/json` or it is refused with 415. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// Key that makes retries resume the same create operation, from 1 through 255 characters. An empty or longer key is refused with 400. Without the header, the server derives a stable key from the request body.
- /// Example: create-research-assistant-2026-09-16
- ///
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- public async global::System.Threading.Tasks.Task CreateInternAsync(
-
- global::OpenRouter.CreateInternRequest request,
- string? idempotencyKey = default,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default)
- {
- var __response = await CreateInternAsResponseAsync(
-
- request: request,
- idempotencyKey: idempotencyKey,
- requestOptions: requestOptions,
- cancellationToken: cancellationToken
- ).ConfigureAwait(false);
-
- return __response.Body;
- }
- ///
- /// Create an intern
- /// Creates an intern in an explicit workspace. The operation also creates its private vault. It can start provisioning immediately or wait for a later provision call. A retry with the same idempotency key and body resumes unfinished work. The request body is capped at 1048576 bytes and a larger body is refused with 413. A non-empty body must declare `Content-Type: application/json` or it is refused with 415. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// Key that makes retries resume the same create operation, from 1 through 255 characters. An empty or longer key is refused with 400. Without the header, the server derives a stable key from the request body.
- /// Example: create-research-assistant-2026-09-16
- ///
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- public async global::System.Threading.Tasks.Task> CreateInternAsResponseAsync(
-
- global::OpenRouter.CreateInternRequest request,
- string? idempotencyKey = default,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default)
- {
- request = request ?? throw new global::System.ArgumentNullException(nameof(request));
-
- PrepareArguments(
- client: HttpClient);
- PrepareCreateInternArguments(
- httpClient: HttpClient,
- idempotencyKey: ref idempotencyKey,
- request: request);
-
-
- var __authorizations = global::OpenRouter.EndPointSecurityResolver.ResolveAuthorizations(
- availableAuthorizations: Authorizations,
- securityRequirements: s_CreateInternSecurityRequirements,
- operationName: "CreateInternAsync");
-
- using var __timeoutCancellationTokenSource = global::OpenRouter.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
- clientOptions: Options,
- requestOptions: requestOptions,
- cancellationToken: cancellationToken);
- var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
- var __effectiveReadResponseAsString = global::OpenRouter.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
- clientOptions: Options,
- requestOptions: requestOptions,
- fallbackValue: ReadResponseAsString);
- var __maxAttempts = global::OpenRouter.AutoSDKRequestOptionsSupport.GetMaxAttempts(
- clientOptions: Options,
- requestOptions: requestOptions,
- supportsRetry: true);
-
- global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
- {
-
- var __pathBuilder = new global::OpenRouter.PathBuilder(
- path: "/interns",
- baseUri: HttpClient.BaseAddress ?? new global::System.Uri("https://openrouter.ai/api/v1", global::System.UriKind.RelativeOrAbsolute));
- var __path = __pathBuilder.ToString();
- __path = global::OpenRouter.AutoSDKRequestOptionsSupport.AppendQueryParameters(
- path: __path,
- clientParameters: Options.QueryParameters,
- requestParameters: requestOptions?.QueryParameters);
- var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
-#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
-#endif
-
- foreach (var __authorization in __authorizations)
- {
- if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2" ||
- __authorization.Type == "OpenIdConnect")
- {
- __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
- scheme: __authorization.Name,
- parameter: __authorization.Value);
- }
- else if (__authorization.Type == "ApiKey" &&
- __authorization.Location == "Header")
- {
- __httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
- }
-
- var __idempotencyKey = global::System.String.IsNullOrWhiteSpace(idempotencyKey)
- ? CreateIdempotencyKey()
- : idempotencyKey;
- __httpRequest.Headers.TryAddWithoutValidation("Idempotency-Key", __idempotencyKey);
-
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
- global::OpenRouter.AutoSDKRequestOptionsSupport.ApplyHeaders(
- request: __httpRequest,
- clientHeaders: Options.Headers,
- requestHeaders: requestOptions?.Headers);
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareCreateInternRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- idempotencyKey: idempotencyKey,
- request: request);
-
- global::OpenRouter.AutoSDKHttpRequestOptions.StampAuthorizationOverride(__httpRequest);
-
- return __httpRequest;
- }
-
- global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
- global::System.Net.Http.HttpResponseMessage? __response = null;
- var __attemptNumber = 0;
- try
- {
- for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
- {
- __attemptNumber = __attempt;
- __httpRequest = __CreateHttpRequest();
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "CreateIntern",
- methodName: "CreateInternAsync",
- pathTemplate: "\"/interns\"",
- httpMethod: "POST",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: null,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- try
- {
- __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- }
- catch (global::System.Net.Http.HttpRequestException __exception)
- {
- var __retryDelay = global::OpenRouter.AutoSDKRequestOptionsSupport.GetRetryDelay(
- clientOptions: Options,
- requestOptions: requestOptions,
- response: null,
- attempt: __attempt);
- var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "CreateIntern",
- methodName: "CreateInternAsync",
- pathTemplate: "\"/interns\"",
- httpMethod: "POST",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: null,
- exception: __exception,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: __willRetry,
- retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
- retryReason: "exception",
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- if (!__willRetry)
- {
- throw;
- }
-
- __httpRequest.Dispose();
- __httpRequest = null;
- await global::OpenRouter.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- retryDelay: __retryDelay,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- continue;
- }
-
- if (__response != null &&
- __attempt < __maxAttempts &&
- global::OpenRouter.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
- {
- var __retryDelay = global::OpenRouter.AutoSDKRequestOptionsSupport.GetRetryDelay(
- clientOptions: Options,
- requestOptions: requestOptions,
- response: __response,
- attempt: __attempt);
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "CreateIntern",
- methodName: "CreateInternAsync",
- pathTemplate: "\"/interns\"",
- httpMethod: "POST",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: true,
- retryDelay: __retryDelay,
- retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- __response.Dispose();
- __response = null;
- __httpRequest.Dispose();
- __httpRequest = null;
- await global::OpenRouter.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- retryDelay: __retryDelay,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- continue;
- }
-
- break;
- }
-
- if (__response == null)
- {
- throw new global::System.InvalidOperationException("No response received.");
- }
-
- using (__response)
- {
-
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessCreateInternResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- if (__response.IsSuccessStatusCode)
- {
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "CreateIntern",
- methodName: "CreateInternAsync",
- pathTemplate: "\"/interns\"",
- httpMethod: "POST",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attemptNumber,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- }
- else
- {
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "CreateIntern",
- methodName: "CreateInternAsync",
- pathTemplate: "\"/interns\"",
- httpMethod: "POST",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attemptNumber,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- }
- // The request body is invalid.
- if ((int)__response.StatusCode == 400)
- {
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::OpenRouter.InternLifecycleError? __value_400 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_400 = global::OpenRouter.InternLifecycleError.FromJson(__content_400, JsonSerializerContext);
- }
- else
- {
- __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_400 = global::OpenRouter.InternLifecycleError.FromJson(__content_400, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- responseBody: __content_400,
- responseObject: __value_400,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // Missing, unknown or provisioning API key.
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::OpenRouter.InternLifecycleError? __value_401 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_401 = global::OpenRouter.InternLifecycleError.FromJson(__content_401, JsonSerializerContext);
- }
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_401 = global::OpenRouter.InternLifecycleError.FromJson(__content_401, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_401 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- responseBody: __content_401,
- responseObject: __value_401,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The key acts as an organization and has no member who can own the intern, the workspace does not allow interns, lifecycle writes are not enabled for the caller, or regional access is refused.
- if ((int)__response.StatusCode == 403)
- {
- string? __content_403 = null;
- global::System.Exception? __exception_403 = null;
- global::OpenRouter.InternLifecycleError? __value_403 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_403 = global::OpenRouter.InternLifecycleError.FromJson(__content_403, JsonSerializerContext);
- }
- else
- {
- __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_403 = global::OpenRouter.InternLifecycleError.FromJson(__content_403, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_403 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_403,
- responseBody: __content_403,
- responseObject: __value_403,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The caller is outside the Intern API programme, or the intern is hidden.
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::OpenRouter.InternLifecycleError? __value_404 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_404 = global::OpenRouter.InternLifecycleError.FromJson(__content_404, JsonSerializerContext);
- }
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_404 = global::OpenRouter.InternLifecycleError.FromJson(__content_404, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_404 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- responseBody: __content_404,
- responseObject: __value_404,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The request exceeded its route deadline. The deadline quoted in the message is the route's own, so it differs between operations.
- if ((int)__response.StatusCode == 408)
- {
- string? __content_408 = null;
- global::System.Exception? __exception_408 = null;
- global::OpenRouter.InternLifecycleError? __value_408 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_408 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_408 = global::OpenRouter.InternLifecycleError.FromJson(__content_408, JsonSerializerContext);
- }
- else
- {
- __content_408 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_408 = global::OpenRouter.InternLifecycleError.FromJson(__content_408, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_408 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_408 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_408,
- responseBody: __content_408,
- responseObject: __value_408,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The idempotency key was reused, the intern name is already taken in the workspace, the member reached the intern limit, or the requested vault cannot be attached.
- if ((int)__response.StatusCode == 409)
- {
- string? __content_409 = null;
- global::System.Exception? __exception_409 = null;
- global::OpenRouter.InternLifecycleError? __value_409 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_409 = global::OpenRouter.InternLifecycleError.FromJson(__content_409, JsonSerializerContext);
- }
- else
- {
- __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_409 = global::OpenRouter.InternLifecycleError.FromJson(__content_409, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_409 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_409 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_409,
- responseBody: __content_409,
- responseObject: __value_409,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The request body is larger than 1048576 bytes.
- if ((int)__response.StatusCode == 413)
- {
- string? __content_413 = null;
- global::System.Exception? __exception_413 = null;
- global::OpenRouter.InternLifecycleError? __value_413 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_413 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_413 = global::OpenRouter.InternLifecycleError.FromJson(__content_413, JsonSerializerContext);
- }
- else
- {
- __content_413 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_413 = global::OpenRouter.InternLifecycleError.FromJson(__content_413, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_413 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_413 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_413,
- responseBody: __content_413,
- responseObject: __value_413,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The request body is non-empty and its Content-Type is not application/json.
- if ((int)__response.StatusCode == 415)
- {
- string? __content_415 = null;
- global::System.Exception? __exception_415 = null;
- global::OpenRouter.InternLifecycleError? __value_415 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_415 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_415 = global::OpenRouter.InternLifecycleError.FromJson(__content_415, JsonSerializerContext);
- }
- else
- {
- __content_415 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_415 = global::OpenRouter.InternLifecycleError.FromJson(__content_415, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_415 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_415 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_415,
- responseBody: __content_415,
- responseObject: __value_415,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The request could not be completed. `metadata.reason` says whether to try again: `internal_error` is a transient failure and carries `metadata.retryable: true`, so the same request may be sent again, while `configuration_error` carries `retryable: false` because the next attempt reads the same missing binding or unusable stored credential.
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::OpenRouter.InternLifecycleError? __value_500 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_500 = global::OpenRouter.InternLifecycleError.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_500 = global::OpenRouter.InternLifecycleError.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- responseBody: __content_500,
- responseObject: __value_500,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The vault or provisioner did not complete a recoverable create step. Retry the same request.
- if ((int)__response.StatusCode == 502)
- {
- string? __content_502 = null;
- global::System.Exception? __exception_502 = null;
- global::OpenRouter.InternLifecycleError? __value_502 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_502 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_502 = global::OpenRouter.InternLifecycleError.FromJson(__content_502, JsonSerializerContext);
- }
- else
- {
- __content_502 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_502 = global::OpenRouter.InternLifecycleError.FromJson(__content_502, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_502 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_502 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_502,
- responseBody: __content_502,
- responseObject: __value_502,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
-
- if (__effectiveReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
-
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessCreateInternResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
- {
- __response.EnsureSuccessStatusCode();
-
- var __value = global::OpenRouter.Intern.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- return new global::OpenRouter.AutoSDKHttpResponse(
- statusCode: __response.StatusCode,
- headers: global::OpenRouter.AutoSDKHttpResponse.CreateHeaders(__response),
- requestUri: __response.RequestMessage?.RequestUri,
- body: __value);
- }
- catch (global::System.Exception __ex)
- {
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- responseBody: __content,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
-
- var __value = await global::OpenRouter.Intern.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- return new global::OpenRouter.AutoSDKHttpResponse(
- statusCode: __response.StatusCode,
- headers: global::OpenRouter.AutoSDKHttpResponse.CreateHeaders(__response),
- requestUri: __response.RequestMessage?.RequestUri,
- body: __value);
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- responseBody: __content,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- }
-
- }
- }
- finally
- {
- __httpRequest?.Dispose();
- }
- }
- ///
- /// Create an intern
- /// Creates an intern in an explicit workspace. The operation also creates its private vault. It can start provisioning immediately or wait for a later provision call. A retry with the same idempotency key and body resumes unfinished work. The request body is capped at 1048576 bytes and a larger body is refused with 413. A non-empty body must declare `Content-Type: application/json` or it is refused with 415. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// Key that makes retries resume the same create operation, from 1 through 255 characters. An empty or longer key is refused with 400. Without the header, the server derives a stable key from the request body.
- /// Example: create-research-assistant-2026-09-16
- ///
- ///
- /// Free-form description, or null.
- ///
- ///
- /// Standing instructions the intern boots with, or null.
- ///
- ///
- /// Intern name, unique per creator within the workspace.
- ///
- ///
- /// Start provisioning during this create operation. Defaults to false.
- /// Default Value: false
- ///
- ///
- /// Vault owned by another intern in this workspace to attach as a borrowed vault.
- ///
- ///
- /// Workspace that will own the intern. Defaults to the workspace the API key resolves to. When given, it must match the API key workspace.
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- public async global::System.Threading.Tasks.Task CreateInternAsync(
- string name,
- string? idempotencyKey = default,
- string? description = default,
- string? instructions = default,
- bool? provision = default,
- global::System.Guid? vaultId = default,
- global::System.Guid? workspaceId = default,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default)
- {
- var __request = new global::OpenRouter.CreateInternRequest
- {
- Description = description,
- Instructions = instructions,
- Name = name,
- Provision = provision,
- VaultId = vaultId,
- WorkspaceId = workspaceId,
- };
-
- return await CreateInternAsync(
- idempotencyKey: idempotencyKey,
- request: __request,
- requestOptions: requestOptions,
- cancellationToken: cancellationToken).ConfigureAwait(false);
- }
- }
-}
\ No newline at end of file
diff --git a/src/libs/OpenRouter/Generated/OpenRouter.InternsClient.DeleteIntern.g.cs b/src/libs/OpenRouter/Generated/OpenRouter.InternsClient.DeleteIntern.g.cs
deleted file mode 100644
index 9c648e8d..00000000
--- a/src/libs/OpenRouter/Generated/OpenRouter.InternsClient.DeleteIntern.g.cs
+++ /dev/null
@@ -1,856 +0,0 @@
-
-#nullable enable
-
-namespace OpenRouter
-{
- public partial class InternsClient
- {
-
-
- private static readonly global::OpenRouter.EndPointSecurityRequirement s_DeleteInternSecurityRequirement0 =
- new global::OpenRouter.EndPointSecurityRequirement
- {
- Authorizations = new global::OpenRouter.EndPointAuthorizationRequirement[]
- { new global::OpenRouter.EndPointAuthorizationRequirement
- {
- Type = "Http",
- SchemeId = "Bearer",
- Location = "Header",
- Name = "Bearer",
- FriendlyName = "Bearer",
- },
- },
- };
- private static readonly global::OpenRouter.EndPointSecurityRequirement[] s_DeleteInternSecurityRequirements =
- new global::OpenRouter.EndPointSecurityRequirement[]
- { s_DeleteInternSecurityRequirement0,
- };
- partial void PrepareDeleteInternArguments(
- global::System.Net.Http.HttpClient httpClient,
- ref string internId,
- global::OpenRouter.DeleteInternRequest request);
- partial void PrepareDeleteInternRequest(
- global::System.Net.Http.HttpClient httpClient,
- global::System.Net.Http.HttpRequestMessage httpRequestMessage,
- string internId,
- global::OpenRouter.DeleteInternRequest request);
- partial void ProcessDeleteInternResponse(
- global::System.Net.Http.HttpClient httpClient,
- global::System.Net.Http.HttpResponseMessage httpResponseMessage);
-
- partial void ProcessDeleteInternResponseContent(
- global::System.Net.Http.HttpClient httpClient,
- global::System.Net.Http.HttpResponseMessage httpResponseMessage,
- ref string content);
-
- ///
- /// Delete an intern
- /// Starts safe teardown of the intern, its runtime and its private vault. The body is optional. Send `{"acknowledge_workspace_loss": true}` to delete a `destroy_failed` intern whose `last_failure_message` names `workspace_archive_failed`, accepting that its workspace is not backed up. The request body is capped at 1048576 bytes and a larger body is refused with 413. A non-empty body must declare `Content-Type: application/json` or it is refused with 415. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// ID of an intern visible to the authenticated API key.
- /// Example: 7c9e6679-7425-40de-944b-e07fc1f90ae7
- ///
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- public async global::System.Threading.Tasks.Task DeleteInternAsync(
- string internId,
-
- global::OpenRouter.DeleteInternRequest request,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default)
- {
- var __response = await DeleteInternAsResponseAsync(
- internId: internId,
-
- request: request,
- requestOptions: requestOptions,
- cancellationToken: cancellationToken
- ).ConfigureAwait(false);
-
- return __response.Body;
- }
- ///
- /// Delete an intern
- /// Starts safe teardown of the intern, its runtime and its private vault. The body is optional. Send `{"acknowledge_workspace_loss": true}` to delete a `destroy_failed` intern whose `last_failure_message` names `workspace_archive_failed`, accepting that its workspace is not backed up. The request body is capped at 1048576 bytes and a larger body is refused with 413. A non-empty body must declare `Content-Type: application/json` or it is refused with 415. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// ID of an intern visible to the authenticated API key.
- /// Example: 7c9e6679-7425-40de-944b-e07fc1f90ae7
- ///
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- public async global::System.Threading.Tasks.Task> DeleteInternAsResponseAsync(
- string internId,
-
- global::OpenRouter.DeleteInternRequest request,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default)
- {
- request = request ?? throw new global::System.ArgumentNullException(nameof(request));
-
- PrepareArguments(
- client: HttpClient);
- PrepareDeleteInternArguments(
- httpClient: HttpClient,
- internId: ref internId,
- request: request);
-
-
- var __authorizations = global::OpenRouter.EndPointSecurityResolver.ResolveAuthorizations(
- availableAuthorizations: Authorizations,
- securityRequirements: s_DeleteInternSecurityRequirements,
- operationName: "DeleteInternAsync");
-
- using var __timeoutCancellationTokenSource = global::OpenRouter.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
- clientOptions: Options,
- requestOptions: requestOptions,
- cancellationToken: cancellationToken);
- var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
- var __effectiveReadResponseAsString = global::OpenRouter.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
- clientOptions: Options,
- requestOptions: requestOptions,
- fallbackValue: ReadResponseAsString);
- var __maxAttempts = global::OpenRouter.AutoSDKRequestOptionsSupport.GetMaxAttempts(
- clientOptions: Options,
- requestOptions: requestOptions,
- supportsRetry: true);
-
- global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
- {
-
- var __pathBuilder = new global::OpenRouter.PathBuilder(
- path: $"/interns/{internId}",
- baseUri: HttpClient.BaseAddress ?? new global::System.Uri("https://openrouter.ai/api/v1", global::System.UriKind.RelativeOrAbsolute));
- var __path = __pathBuilder.ToString();
- __path = global::OpenRouter.AutoSDKRequestOptionsSupport.AppendQueryParameters(
- path: __path,
- clientParameters: Options.QueryParameters,
- requestParameters: requestOptions?.QueryParameters);
- var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Delete,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
-#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
-#endif
-
- foreach (var __authorization in __authorizations)
- {
- if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2" ||
- __authorization.Type == "OpenIdConnect")
- {
- __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
- scheme: __authorization.Name,
- parameter: __authorization.Value);
- }
- else if (__authorization.Type == "ApiKey" &&
- __authorization.Location == "Header")
- {
- __httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
- }
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
- global::OpenRouter.AutoSDKRequestOptionsSupport.ApplyHeaders(
- request: __httpRequest,
- clientHeaders: Options.Headers,
- requestHeaders: requestOptions?.Headers);
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareDeleteInternRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- internId: internId,
- request: request);
-
- global::OpenRouter.AutoSDKHttpRequestOptions.StampAuthorizationOverride(__httpRequest);
-
- return __httpRequest;
- }
-
- global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
- global::System.Net.Http.HttpResponseMessage? __response = null;
- var __attemptNumber = 0;
- try
- {
- for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
- {
- __attemptNumber = __attempt;
- __httpRequest = __CreateHttpRequest();
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "DeleteIntern",
- methodName: "DeleteInternAsync",
- pathTemplate: "$\"/interns/{internId}\"",
- httpMethod: "DELETE",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: null,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- try
- {
- __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- }
- catch (global::System.Net.Http.HttpRequestException __exception)
- {
- var __retryDelay = global::OpenRouter.AutoSDKRequestOptionsSupport.GetRetryDelay(
- clientOptions: Options,
- requestOptions: requestOptions,
- response: null,
- attempt: __attempt);
- var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "DeleteIntern",
- methodName: "DeleteInternAsync",
- pathTemplate: "$\"/interns/{internId}\"",
- httpMethod: "DELETE",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: null,
- exception: __exception,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: __willRetry,
- retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
- retryReason: "exception",
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- if (!__willRetry)
- {
- throw;
- }
-
- __httpRequest.Dispose();
- __httpRequest = null;
- await global::OpenRouter.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- retryDelay: __retryDelay,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- continue;
- }
-
- if (__response != null &&
- __attempt < __maxAttempts &&
- global::OpenRouter.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
- {
- var __retryDelay = global::OpenRouter.AutoSDKRequestOptionsSupport.GetRetryDelay(
- clientOptions: Options,
- requestOptions: requestOptions,
- response: __response,
- attempt: __attempt);
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "DeleteIntern",
- methodName: "DeleteInternAsync",
- pathTemplate: "$\"/interns/{internId}\"",
- httpMethod: "DELETE",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: true,
- retryDelay: __retryDelay,
- retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- __response.Dispose();
- __response = null;
- __httpRequest.Dispose();
- __httpRequest = null;
- await global::OpenRouter.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- retryDelay: __retryDelay,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- continue;
- }
-
- break;
- }
-
- if (__response == null)
- {
- throw new global::System.InvalidOperationException("No response received.");
- }
-
- using (__response)
- {
-
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessDeleteInternResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- if (__response.IsSuccessStatusCode)
- {
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "DeleteIntern",
- methodName: "DeleteInternAsync",
- pathTemplate: "$\"/interns/{internId}\"",
- httpMethod: "DELETE",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attemptNumber,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- }
- else
- {
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "DeleteIntern",
- methodName: "DeleteInternAsync",
- pathTemplate: "$\"/interns/{internId}\"",
- httpMethod: "DELETE",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attemptNumber,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- }
- // The request body is invalid.
- if ((int)__response.StatusCode == 400)
- {
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::OpenRouter.InternLifecycleError? __value_400 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_400 = global::OpenRouter.InternLifecycleError.FromJson(__content_400, JsonSerializerContext);
- }
- else
- {
- __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_400 = global::OpenRouter.InternLifecycleError.FromJson(__content_400, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- responseBody: __content_400,
- responseObject: __value_400,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // Missing, unknown or provisioning API key.
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::OpenRouter.InternLifecycleError? __value_401 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_401 = global::OpenRouter.InternLifecycleError.FromJson(__content_401, JsonSerializerContext);
- }
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_401 = global::OpenRouter.InternLifecycleError.FromJson(__content_401, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_401 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- responseBody: __content_401,
- responseObject: __value_401,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The key owner no longer has access, the request used a regional hostname, or lifecycle writes are not enabled for the caller (`metadata.reason` is `lifecycle_writes_disabled`).
- if ((int)__response.StatusCode == 403)
- {
- string? __content_403 = null;
- global::System.Exception? __exception_403 = null;
- global::OpenRouter.InternLifecycleError? __value_403 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_403 = global::OpenRouter.InternLifecycleError.FromJson(__content_403, JsonSerializerContext);
- }
- else
- {
- __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_403 = global::OpenRouter.InternLifecycleError.FromJson(__content_403, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_403 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_403,
- responseBody: __content_403,
- responseObject: __value_403,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The caller is outside the Intern API programme, or the intern is hidden.
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::OpenRouter.InternLifecycleError? __value_404 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_404 = global::OpenRouter.InternLifecycleError.FromJson(__content_404, JsonSerializerContext);
- }
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_404 = global::OpenRouter.InternLifecycleError.FromJson(__content_404, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_404 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- responseBody: __content_404,
- responseObject: __value_404,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The request exceeded its route deadline. The deadline quoted in the message is the route's own, so it differs between operations.
- if ((int)__response.StatusCode == 408)
- {
- string? __content_408 = null;
- global::System.Exception? __exception_408 = null;
- global::OpenRouter.InternLifecycleError? __value_408 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_408 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_408 = global::OpenRouter.InternLifecycleError.FromJson(__content_408, JsonSerializerContext);
- }
- else
- {
- __content_408 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_408 = global::OpenRouter.InternLifecycleError.FromJson(__content_408, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_408 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_408 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_408,
- responseBody: __content_408,
- responseObject: __value_408,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The intern is not in a state that allows this operation. `metadata.reason` says whether to try again: `intern_busy` means another operation still holds the intern and carries `metadata.retryable: true`, so the same request may be sent again once it settles. A duplicate delete of an intern already being deleted is not a conflict and is accepted with 202.
- if ((int)__response.StatusCode == 409)
- {
- string? __content_409 = null;
- global::System.Exception? __exception_409 = null;
- global::OpenRouter.InternLifecycleError? __value_409 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_409 = global::OpenRouter.InternLifecycleError.FromJson(__content_409, JsonSerializerContext);
- }
- else
- {
- __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_409 = global::OpenRouter.InternLifecycleError.FromJson(__content_409, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_409 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_409 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_409,
- responseBody: __content_409,
- responseObject: __value_409,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The request body is larger than 1048576 bytes.
- if ((int)__response.StatusCode == 413)
- {
- string? __content_413 = null;
- global::System.Exception? __exception_413 = null;
- global::OpenRouter.InternLifecycleError? __value_413 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_413 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_413 = global::OpenRouter.InternLifecycleError.FromJson(__content_413, JsonSerializerContext);
- }
- else
- {
- __content_413 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_413 = global::OpenRouter.InternLifecycleError.FromJson(__content_413, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_413 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_413 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_413,
- responseBody: __content_413,
- responseObject: __value_413,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The request body is non-empty and its Content-Type is not application/json.
- if ((int)__response.StatusCode == 415)
- {
- string? __content_415 = null;
- global::System.Exception? __exception_415 = null;
- global::OpenRouter.InternLifecycleError? __value_415 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_415 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_415 = global::OpenRouter.InternLifecycleError.FromJson(__content_415, JsonSerializerContext);
- }
- else
- {
- __content_415 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_415 = global::OpenRouter.InternLifecycleError.FromJson(__content_415, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_415 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_415 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_415,
- responseBody: __content_415,
- responseObject: __value_415,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The request could not be completed. `metadata.reason` says whether to try again: `internal_error` is a transient failure and carries `metadata.retryable: true`, so the same request may be sent again, while `configuration_error` carries `retryable: false` because the next attempt reads the same missing binding or unusable stored credential.
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::OpenRouter.InternLifecycleError? __value_500 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_500 = global::OpenRouter.InternLifecycleError.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_500 = global::OpenRouter.InternLifecycleError.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- responseBody: __content_500,
- responseObject: __value_500,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The intern service could not accept the operation.
- if ((int)__response.StatusCode == 502)
- {
- string? __content_502 = null;
- global::System.Exception? __exception_502 = null;
- global::OpenRouter.InternLifecycleError? __value_502 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_502 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_502 = global::OpenRouter.InternLifecycleError.FromJson(__content_502, JsonSerializerContext);
- }
- else
- {
- __content_502 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_502 = global::OpenRouter.InternLifecycleError.FromJson(__content_502, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_502 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_502 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_502,
- responseBody: __content_502,
- responseObject: __value_502,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
-
- if (__effectiveReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
-
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessDeleteInternResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
- {
- __response.EnsureSuccessStatusCode();
-
- var __value = global::OpenRouter.DeleteInternResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- return new global::OpenRouter.AutoSDKHttpResponse(
- statusCode: __response.StatusCode,
- headers: global::OpenRouter.AutoSDKHttpResponse.CreateHeaders(__response),
- requestUri: __response.RequestMessage?.RequestUri,
- body: __value);
- }
- catch (global::System.Exception __ex)
- {
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- responseBody: __content,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
-
- var __value = await global::OpenRouter.DeleteInternResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- return new global::OpenRouter.AutoSDKHttpResponse(
- statusCode: __response.StatusCode,
- headers: global::OpenRouter.AutoSDKHttpResponse.CreateHeaders(__response),
- requestUri: __response.RequestMessage?.RequestUri,
- body: __value);
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- responseBody: __content,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- }
-
- }
- }
- finally
- {
- __httpRequest?.Dispose();
- }
- }
- ///
- /// Delete an intern
- /// Starts safe teardown of the intern, its runtime and its private vault. The body is optional. Send `{"acknowledge_workspace_loss": true}` to delete a `destroy_failed` intern whose `last_failure_message` names `workspace_archive_failed`, accepting that its workspace is not backed up. The request body is capped at 1048576 bytes and a larger body is refused with 413. A non-empty body must declare `Content-Type: application/json` or it is refused with 415. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// ID of an intern visible to the authenticated API key.
- /// Example: 7c9e6679-7425-40de-944b-e07fc1f90ae7
- ///
- ///
- /// Delete even though the workspace backup was not confirmed. Defaults to false, which refuses the teardown when a workspace archive is missing.
- /// Default Value: false
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- public async global::System.Threading.Tasks.Task DeleteInternAsync(
- string internId,
- bool? acknowledgeWorkspaceLoss = default,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default)
- {
- var __request = new global::OpenRouter.DeleteInternRequest
- {
- AcknowledgeWorkspaceLoss = acknowledgeWorkspaceLoss,
- };
-
- return await DeleteInternAsync(
- internId: internId,
- request: __request,
- requestOptions: requestOptions,
- cancellationToken: cancellationToken).ConfigureAwait(false);
- }
- }
-}
\ No newline at end of file
diff --git a/src/libs/OpenRouter/Generated/OpenRouter.InternsClient.GetIntern.g.cs b/src/libs/OpenRouter/Generated/OpenRouter.InternsClient.GetIntern.g.cs
deleted file mode 100644
index e45246f4..00000000
--- a/src/libs/OpenRouter/Generated/OpenRouter.InternsClient.GetIntern.g.cs
+++ /dev/null
@@ -1,619 +0,0 @@
-
-#nullable enable
-
-namespace OpenRouter
-{
- public partial class InternsClient
- {
-
-
- private static readonly global::OpenRouter.EndPointSecurityRequirement s_GetInternSecurityRequirement0 =
- new global::OpenRouter.EndPointSecurityRequirement
- {
- Authorizations = new global::OpenRouter.EndPointAuthorizationRequirement[]
- { new global::OpenRouter.EndPointAuthorizationRequirement
- {
- Type = "Http",
- SchemeId = "Bearer",
- Location = "Header",
- Name = "Bearer",
- FriendlyName = "Bearer",
- },
- },
- };
- private static readonly global::OpenRouter.EndPointSecurityRequirement[] s_GetInternSecurityRequirements =
- new global::OpenRouter.EndPointSecurityRequirement[]
- { s_GetInternSecurityRequirement0,
- };
- partial void PrepareGetInternArguments(
- global::System.Net.Http.HttpClient httpClient,
- ref string internId);
- partial void PrepareGetInternRequest(
- global::System.Net.Http.HttpClient httpClient,
- global::System.Net.Http.HttpRequestMessage httpRequestMessage,
- string internId);
- partial void ProcessGetInternResponse(
- global::System.Net.Http.HttpClient httpClient,
- global::System.Net.Http.HttpResponseMessage httpResponseMessage);
-
- partial void ProcessGetInternResponseContent(
- global::System.Net.Http.HttpClient httpClient,
- global::System.Net.Http.HttpResponseMessage httpResponseMessage,
- ref string content);
-
- ///
- /// Get an intern
- /// Returns the public lifecycle state and settings for one visible intern. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// ID of an intern visible to the authenticated API key.
- /// Example: 7c9e6679-7425-40de-944b-e07fc1f90ae7
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- public async global::System.Threading.Tasks.Task GetInternAsync(
- string internId,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default)
- {
- var __response = await GetInternAsResponseAsync(
- internId: internId,
- requestOptions: requestOptions,
- cancellationToken: cancellationToken
- ).ConfigureAwait(false);
-
- return __response.Body;
- }
- ///
- /// Get an intern
- /// Returns the public lifecycle state and settings for one visible intern. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// ID of an intern visible to the authenticated API key.
- /// Example: 7c9e6679-7425-40de-944b-e07fc1f90ae7
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- public async global::System.Threading.Tasks.Task> GetInternAsResponseAsync(
- string internId,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default)
- {
- PrepareArguments(
- client: HttpClient);
- PrepareGetInternArguments(
- httpClient: HttpClient,
- internId: ref internId);
-
-
- var __authorizations = global::OpenRouter.EndPointSecurityResolver.ResolveAuthorizations(
- availableAuthorizations: Authorizations,
- securityRequirements: s_GetInternSecurityRequirements,
- operationName: "GetInternAsync");
-
- using var __timeoutCancellationTokenSource = global::OpenRouter.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
- clientOptions: Options,
- requestOptions: requestOptions,
- cancellationToken: cancellationToken);
- var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
- var __effectiveReadResponseAsString = global::OpenRouter.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
- clientOptions: Options,
- requestOptions: requestOptions,
- fallbackValue: ReadResponseAsString);
- var __maxAttempts = global::OpenRouter.AutoSDKRequestOptionsSupport.GetMaxAttempts(
- clientOptions: Options,
- requestOptions: requestOptions,
- supportsRetry: true);
-
- global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
- {
-
- var __pathBuilder = new global::OpenRouter.PathBuilder(
- path: $"/interns/{internId}",
- baseUri: HttpClient.BaseAddress ?? new global::System.Uri("https://openrouter.ai/api/v1", global::System.UriKind.RelativeOrAbsolute));
- var __path = __pathBuilder.ToString();
- __path = global::OpenRouter.AutoSDKRequestOptionsSupport.AppendQueryParameters(
- path: __path,
- clientParameters: Options.QueryParameters,
- requestParameters: requestOptions?.QueryParameters);
- var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Get,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
-#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
-#endif
-
- foreach (var __authorization in __authorizations)
- {
- if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2" ||
- __authorization.Type == "OpenIdConnect")
- {
- __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
- scheme: __authorization.Name,
- parameter: __authorization.Value);
- }
- else if (__authorization.Type == "ApiKey" &&
- __authorization.Location == "Header")
- {
- __httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
- }
- global::OpenRouter.AutoSDKRequestOptionsSupport.ApplyHeaders(
- request: __httpRequest,
- clientHeaders: Options.Headers,
- requestHeaders: requestOptions?.Headers);
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareGetInternRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- internId: internId);
-
- global::OpenRouter.AutoSDKHttpRequestOptions.StampAuthorizationOverride(__httpRequest);
-
- return __httpRequest;
- }
-
- global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
- global::System.Net.Http.HttpResponseMessage? __response = null;
- var __attemptNumber = 0;
- try
- {
- for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
- {
- __attemptNumber = __attempt;
- __httpRequest = __CreateHttpRequest();
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "GetIntern",
- methodName: "GetInternAsync",
- pathTemplate: "$\"/interns/{internId}\"",
- httpMethod: "GET",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: null,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- try
- {
- __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- }
- catch (global::System.Net.Http.HttpRequestException __exception)
- {
- var __retryDelay = global::OpenRouter.AutoSDKRequestOptionsSupport.GetRetryDelay(
- clientOptions: Options,
- requestOptions: requestOptions,
- response: null,
- attempt: __attempt);
- var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "GetIntern",
- methodName: "GetInternAsync",
- pathTemplate: "$\"/interns/{internId}\"",
- httpMethod: "GET",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: null,
- exception: __exception,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: __willRetry,
- retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
- retryReason: "exception",
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- if (!__willRetry)
- {
- throw;
- }
-
- __httpRequest.Dispose();
- __httpRequest = null;
- await global::OpenRouter.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- retryDelay: __retryDelay,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- continue;
- }
-
- if (__response != null &&
- __attempt < __maxAttempts &&
- global::OpenRouter.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
- {
- var __retryDelay = global::OpenRouter.AutoSDKRequestOptionsSupport.GetRetryDelay(
- clientOptions: Options,
- requestOptions: requestOptions,
- response: __response,
- attempt: __attempt);
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "GetIntern",
- methodName: "GetInternAsync",
- pathTemplate: "$\"/interns/{internId}\"",
- httpMethod: "GET",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: true,
- retryDelay: __retryDelay,
- retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- __response.Dispose();
- __response = null;
- __httpRequest.Dispose();
- __httpRequest = null;
- await global::OpenRouter.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- retryDelay: __retryDelay,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- continue;
- }
-
- break;
- }
-
- if (__response == null)
- {
- throw new global::System.InvalidOperationException("No response received.");
- }
-
- using (__response)
- {
-
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessGetInternResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- if (__response.IsSuccessStatusCode)
- {
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "GetIntern",
- methodName: "GetInternAsync",
- pathTemplate: "$\"/interns/{internId}\"",
- httpMethod: "GET",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attemptNumber,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- }
- else
- {
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "GetIntern",
- methodName: "GetInternAsync",
- pathTemplate: "$\"/interns/{internId}\"",
- httpMethod: "GET",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attemptNumber,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- }
- // Missing, unknown or provisioning API key.
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::OpenRouter.InternLifecycleError? __value_401 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_401 = global::OpenRouter.InternLifecycleError.FromJson(__content_401, JsonSerializerContext);
- }
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_401 = global::OpenRouter.InternLifecycleError.FromJson(__content_401, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_401 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- responseBody: __content_401,
- responseObject: __value_401,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The key owner no longer has access, or the request used a regional hostname.
- if ((int)__response.StatusCode == 403)
- {
- string? __content_403 = null;
- global::System.Exception? __exception_403 = null;
- global::OpenRouter.InternLifecycleError? __value_403 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_403 = global::OpenRouter.InternLifecycleError.FromJson(__content_403, JsonSerializerContext);
- }
- else
- {
- __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_403 = global::OpenRouter.InternLifecycleError.FromJson(__content_403, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_403 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_403,
- responseBody: __content_403,
- responseObject: __value_403,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The caller is outside the Intern API programme, or the intern is hidden.
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::OpenRouter.InternLifecycleError? __value_404 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_404 = global::OpenRouter.InternLifecycleError.FromJson(__content_404, JsonSerializerContext);
- }
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_404 = global::OpenRouter.InternLifecycleError.FromJson(__content_404, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_404 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- responseBody: __content_404,
- responseObject: __value_404,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The request exceeded its route deadline. The deadline quoted in the message is the route's own, so it differs between operations.
- if ((int)__response.StatusCode == 408)
- {
- string? __content_408 = null;
- global::System.Exception? __exception_408 = null;
- global::OpenRouter.InternLifecycleError? __value_408 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_408 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_408 = global::OpenRouter.InternLifecycleError.FromJson(__content_408, JsonSerializerContext);
- }
- else
- {
- __content_408 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_408 = global::OpenRouter.InternLifecycleError.FromJson(__content_408, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_408 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_408 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_408,
- responseBody: __content_408,
- responseObject: __value_408,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The request could not be completed. `metadata.reason` says whether to try again: `internal_error` is a transient failure and carries `metadata.retryable: true`, so the same request may be sent again, while `configuration_error` carries `retryable: false` because the next attempt reads the same missing binding or unusable stored credential.
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::OpenRouter.InternLifecycleError? __value_500 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_500 = global::OpenRouter.InternLifecycleError.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_500 = global::OpenRouter.InternLifecycleError.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- responseBody: __content_500,
- responseObject: __value_500,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
-
- if (__effectiveReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
-
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessGetInternResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
- {
- __response.EnsureSuccessStatusCode();
-
- var __value = global::OpenRouter.Intern.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- return new global::OpenRouter.AutoSDKHttpResponse(
- statusCode: __response.StatusCode,
- headers: global::OpenRouter.AutoSDKHttpResponse.CreateHeaders(__response),
- requestUri: __response.RequestMessage?.RequestUri,
- body: __value);
- }
- catch (global::System.Exception __ex)
- {
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- responseBody: __content,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
-
- var __value = await global::OpenRouter.Intern.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- return new global::OpenRouter.AutoSDKHttpResponse(
- statusCode: __response.StatusCode,
- headers: global::OpenRouter.AutoSDKHttpResponse.CreateHeaders(__response),
- requestUri: __response.RequestMessage?.RequestUri,
- body: __value);
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- responseBody: __content,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- }
-
- }
- }
- finally
- {
- __httpRequest?.Dispose();
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/libs/OpenRouter/Generated/OpenRouter.InternsClient.GetInternConnections.g.cs b/src/libs/OpenRouter/Generated/OpenRouter.InternsClient.GetInternConnections.g.cs
deleted file mode 100644
index afe9b4d8..00000000
--- a/src/libs/OpenRouter/Generated/OpenRouter.InternsClient.GetInternConnections.g.cs
+++ /dev/null
@@ -1,619 +0,0 @@
-
-#nullable enable
-
-namespace OpenRouter
-{
- public partial class InternsClient
- {
-
-
- private static readonly global::OpenRouter.EndPointSecurityRequirement s_GetInternConnectionsSecurityRequirement0 =
- new global::OpenRouter.EndPointSecurityRequirement
- {
- Authorizations = new global::OpenRouter.EndPointAuthorizationRequirement[]
- { new global::OpenRouter.EndPointAuthorizationRequirement
- {
- Type = "Http",
- SchemeId = "Bearer",
- Location = "Header",
- Name = "Bearer",
- FriendlyName = "Bearer",
- },
- },
- };
- private static readonly global::OpenRouter.EndPointSecurityRequirement[] s_GetInternConnectionsSecurityRequirements =
- new global::OpenRouter.EndPointSecurityRequirement[]
- { s_GetInternConnectionsSecurityRequirement0,
- };
- partial void PrepareGetInternConnectionsArguments(
- global::System.Net.Http.HttpClient httpClient,
- ref string internId);
- partial void PrepareGetInternConnectionsRequest(
- global::System.Net.Http.HttpClient httpClient,
- global::System.Net.Http.HttpRequestMessage httpRequestMessage,
- string internId);
- partial void ProcessGetInternConnectionsResponse(
- global::System.Net.Http.HttpClient httpClient,
- global::System.Net.Http.HttpResponseMessage httpResponseMessage);
-
- partial void ProcessGetInternConnectionsResponseContent(
- global::System.Net.Http.HttpClient httpClient,
- global::System.Net.Http.HttpResponseMessage httpResponseMessage,
- ref string content);
-
- ///
- /// List an intern's connections
- /// Returns the Slack, GitHub, Google Workspace and MCP connections one visible intern can reach, and the shared ones switched off for it or disabled for the workspace. An OAuth grant needs `vault:read`, because the list names members' personal accounts; without it the route answers 403 `insufficient_scope`. The response is sent with `Cache-Control: no-store`. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// ID of an intern visible to the authenticated API key.
- /// Example: 7c9e6679-7425-40de-944b-e07fc1f90ae7
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- public async global::System.Threading.Tasks.Task GetInternConnectionsAsync(
- string internId,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default)
- {
- var __response = await GetInternConnectionsAsResponseAsync(
- internId: internId,
- requestOptions: requestOptions,
- cancellationToken: cancellationToken
- ).ConfigureAwait(false);
-
- return __response.Body;
- }
- ///
- /// List an intern's connections
- /// Returns the Slack, GitHub, Google Workspace and MCP connections one visible intern can reach, and the shared ones switched off for it or disabled for the workspace. An OAuth grant needs `vault:read`, because the list names members' personal accounts; without it the route answers 403 `insufficient_scope`. The response is sent with `Cache-Control: no-store`. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// ID of an intern visible to the authenticated API key.
- /// Example: 7c9e6679-7425-40de-944b-e07fc1f90ae7
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- public async global::System.Threading.Tasks.Task> GetInternConnectionsAsResponseAsync(
- string internId,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default)
- {
- PrepareArguments(
- client: HttpClient);
- PrepareGetInternConnectionsArguments(
- httpClient: HttpClient,
- internId: ref internId);
-
-
- var __authorizations = global::OpenRouter.EndPointSecurityResolver.ResolveAuthorizations(
- availableAuthorizations: Authorizations,
- securityRequirements: s_GetInternConnectionsSecurityRequirements,
- operationName: "GetInternConnectionsAsync");
-
- using var __timeoutCancellationTokenSource = global::OpenRouter.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
- clientOptions: Options,
- requestOptions: requestOptions,
- cancellationToken: cancellationToken);
- var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
- var __effectiveReadResponseAsString = global::OpenRouter.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
- clientOptions: Options,
- requestOptions: requestOptions,
- fallbackValue: ReadResponseAsString);
- var __maxAttempts = global::OpenRouter.AutoSDKRequestOptionsSupport.GetMaxAttempts(
- clientOptions: Options,
- requestOptions: requestOptions,
- supportsRetry: true);
-
- global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
- {
-
- var __pathBuilder = new global::OpenRouter.PathBuilder(
- path: $"/interns/{internId}/connections",
- baseUri: HttpClient.BaseAddress ?? new global::System.Uri("https://openrouter.ai/api/v1", global::System.UriKind.RelativeOrAbsolute));
- var __path = __pathBuilder.ToString();
- __path = global::OpenRouter.AutoSDKRequestOptionsSupport.AppendQueryParameters(
- path: __path,
- clientParameters: Options.QueryParameters,
- requestParameters: requestOptions?.QueryParameters);
- var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Get,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
-#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
-#endif
-
- foreach (var __authorization in __authorizations)
- {
- if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2" ||
- __authorization.Type == "OpenIdConnect")
- {
- __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
- scheme: __authorization.Name,
- parameter: __authorization.Value);
- }
- else if (__authorization.Type == "ApiKey" &&
- __authorization.Location == "Header")
- {
- __httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
- }
- global::OpenRouter.AutoSDKRequestOptionsSupport.ApplyHeaders(
- request: __httpRequest,
- clientHeaders: Options.Headers,
- requestHeaders: requestOptions?.Headers);
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareGetInternConnectionsRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- internId: internId);
-
- global::OpenRouter.AutoSDKHttpRequestOptions.StampAuthorizationOverride(__httpRequest);
-
- return __httpRequest;
- }
-
- global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
- global::System.Net.Http.HttpResponseMessage? __response = null;
- var __attemptNumber = 0;
- try
- {
- for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
- {
- __attemptNumber = __attempt;
- __httpRequest = __CreateHttpRequest();
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "GetInternConnections",
- methodName: "GetInternConnectionsAsync",
- pathTemplate: "$\"/interns/{internId}/connections\"",
- httpMethod: "GET",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: null,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- try
- {
- __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- }
- catch (global::System.Net.Http.HttpRequestException __exception)
- {
- var __retryDelay = global::OpenRouter.AutoSDKRequestOptionsSupport.GetRetryDelay(
- clientOptions: Options,
- requestOptions: requestOptions,
- response: null,
- attempt: __attempt);
- var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "GetInternConnections",
- methodName: "GetInternConnectionsAsync",
- pathTemplate: "$\"/interns/{internId}/connections\"",
- httpMethod: "GET",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: null,
- exception: __exception,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: __willRetry,
- retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
- retryReason: "exception",
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- if (!__willRetry)
- {
- throw;
- }
-
- __httpRequest.Dispose();
- __httpRequest = null;
- await global::OpenRouter.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- retryDelay: __retryDelay,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- continue;
- }
-
- if (__response != null &&
- __attempt < __maxAttempts &&
- global::OpenRouter.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
- {
- var __retryDelay = global::OpenRouter.AutoSDKRequestOptionsSupport.GetRetryDelay(
- clientOptions: Options,
- requestOptions: requestOptions,
- response: __response,
- attempt: __attempt);
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "GetInternConnections",
- methodName: "GetInternConnectionsAsync",
- pathTemplate: "$\"/interns/{internId}/connections\"",
- httpMethod: "GET",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: true,
- retryDelay: __retryDelay,
- retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- __response.Dispose();
- __response = null;
- __httpRequest.Dispose();
- __httpRequest = null;
- await global::OpenRouter.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- retryDelay: __retryDelay,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- continue;
- }
-
- break;
- }
-
- if (__response == null)
- {
- throw new global::System.InvalidOperationException("No response received.");
- }
-
- using (__response)
- {
-
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessGetInternConnectionsResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- if (__response.IsSuccessStatusCode)
- {
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "GetInternConnections",
- methodName: "GetInternConnectionsAsync",
- pathTemplate: "$\"/interns/{internId}/connections\"",
- httpMethod: "GET",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attemptNumber,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- }
- else
- {
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "GetInternConnections",
- methodName: "GetInternConnectionsAsync",
- pathTemplate: "$\"/interns/{internId}/connections\"",
- httpMethod: "GET",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attemptNumber,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- }
- // Missing, unknown or provisioning API key.
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::OpenRouter.InternLifecycleError? __value_401 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_401 = global::OpenRouter.InternLifecycleError.FromJson(__content_401, JsonSerializerContext);
- }
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_401 = global::OpenRouter.InternLifecycleError.FromJson(__content_401, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_401 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- responseBody: __content_401,
- responseObject: __value_401,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The key owner no longer has access, or the request used a regional hostname.
- if ((int)__response.StatusCode == 403)
- {
- string? __content_403 = null;
- global::System.Exception? __exception_403 = null;
- global::OpenRouter.InternLifecycleError? __value_403 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_403 = global::OpenRouter.InternLifecycleError.FromJson(__content_403, JsonSerializerContext);
- }
- else
- {
- __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_403 = global::OpenRouter.InternLifecycleError.FromJson(__content_403, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_403 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_403,
- responseBody: __content_403,
- responseObject: __value_403,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The caller is outside the Intern API programme, or the intern is hidden.
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::OpenRouter.InternLifecycleError? __value_404 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_404 = global::OpenRouter.InternLifecycleError.FromJson(__content_404, JsonSerializerContext);
- }
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_404 = global::OpenRouter.InternLifecycleError.FromJson(__content_404, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_404 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- responseBody: __content_404,
- responseObject: __value_404,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The request exceeded its route deadline. The deadline quoted in the message is the route's own, so it differs between operations.
- if ((int)__response.StatusCode == 408)
- {
- string? __content_408 = null;
- global::System.Exception? __exception_408 = null;
- global::OpenRouter.InternLifecycleError? __value_408 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_408 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_408 = global::OpenRouter.InternLifecycleError.FromJson(__content_408, JsonSerializerContext);
- }
- else
- {
- __content_408 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_408 = global::OpenRouter.InternLifecycleError.FromJson(__content_408, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_408 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_408 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_408,
- responseBody: __content_408,
- responseObject: __value_408,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The request could not be completed. `metadata.reason` says whether to try again: `internal_error` is a transient failure and carries `metadata.retryable: true`, so the same request may be sent again, while `configuration_error` carries `retryable: false` because the next attempt reads the same missing binding or unusable stored credential.
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::OpenRouter.InternLifecycleError? __value_500 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_500 = global::OpenRouter.InternLifecycleError.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_500 = global::OpenRouter.InternLifecycleError.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- responseBody: __content_500,
- responseObject: __value_500,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
-
- if (__effectiveReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
-
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessGetInternConnectionsResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
- {
- __response.EnsureSuccessStatusCode();
-
- var __value = global::OpenRouter.InternConnectionList.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- return new global::OpenRouter.AutoSDKHttpResponse(
- statusCode: __response.StatusCode,
- headers: global::OpenRouter.AutoSDKHttpResponse.CreateHeaders(__response),
- requestUri: __response.RequestMessage?.RequestUri,
- body: __value);
- }
- catch (global::System.Exception __ex)
- {
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- responseBody: __content,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
-
- var __value = await global::OpenRouter.InternConnectionList.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- return new global::OpenRouter.AutoSDKHttpResponse(
- statusCode: __response.StatusCode,
- headers: global::OpenRouter.AutoSDKHttpResponse.CreateHeaders(__response),
- requestUri: __response.RequestMessage?.RequestUri,
- body: __value);
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- responseBody: __content,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- }
-
- }
- }
- finally
- {
- __httpRequest?.Dispose();
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/libs/OpenRouter/Generated/OpenRouter.InternsClient.GetInternDaemon.g.cs b/src/libs/OpenRouter/Generated/OpenRouter.InternsClient.GetInternDaemon.g.cs
deleted file mode 100644
index 052e4660..00000000
--- a/src/libs/OpenRouter/Generated/OpenRouter.InternsClient.GetInternDaemon.g.cs
+++ /dev/null
@@ -1,656 +0,0 @@
-
-#nullable enable
-
-namespace OpenRouter
-{
- public partial class InternsClient
- {
-
-
- private static readonly global::OpenRouter.EndPointSecurityRequirement s_GetInternDaemonSecurityRequirement0 =
- new global::OpenRouter.EndPointSecurityRequirement
- {
- Authorizations = new global::OpenRouter.EndPointAuthorizationRequirement[]
- { new global::OpenRouter.EndPointAuthorizationRequirement
- {
- Type = "Http",
- SchemeId = "Bearer",
- Location = "Header",
- Name = "Bearer",
- FriendlyName = "Bearer",
- },
- },
- };
- private static readonly global::OpenRouter.EndPointSecurityRequirement[] s_GetInternDaemonSecurityRequirements =
- new global::OpenRouter.EndPointSecurityRequirement[]
- { s_GetInternDaemonSecurityRequirement0,
- };
- partial void PrepareGetInternDaemonArguments(
- global::System.Net.Http.HttpClient httpClient,
- ref string internId);
- partial void PrepareGetInternDaemonRequest(
- global::System.Net.Http.HttpClient httpClient,
- global::System.Net.Http.HttpRequestMessage httpRequestMessage,
- string internId);
- partial void ProcessGetInternDaemonResponse(
- global::System.Net.Http.HttpClient httpClient,
- global::System.Net.Http.HttpResponseMessage httpResponseMessage);
-
- partial void ProcessGetInternDaemonResponseContent(
- global::System.Net.Http.HttpClient httpClient,
- global::System.Net.Http.HttpResponseMessage httpResponseMessage,
- ref string content);
-
- ///
- /// Get an intern's daemon access
- /// Returns the origin and daemon token that attach `ori tui --host` to one visible, running intern. The token is a credential: only an OAuth-token caller (`ori login --oidc`) may read it, the response is sent with `Cache-Control: no-store`, and each reveal is logged by caller and intern. API keys get 403 `personal_identity_required`. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// ID of an intern visible to the authenticated API key.
- /// Example: 7c9e6679-7425-40de-944b-e07fc1f90ae7
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- public async global::System.Threading.Tasks.Task GetInternDaemonAsync(
- string internId,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default)
- {
- var __response = await GetInternDaemonAsResponseAsync(
- internId: internId,
- requestOptions: requestOptions,
- cancellationToken: cancellationToken
- ).ConfigureAwait(false);
-
- return __response.Body;
- }
- ///
- /// Get an intern's daemon access
- /// Returns the origin and daemon token that attach `ori tui --host` to one visible, running intern. The token is a credential: only an OAuth-token caller (`ori login --oidc`) may read it, the response is sent with `Cache-Control: no-store`, and each reveal is logged by caller and intern. API keys get 403 `personal_identity_required`. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// ID of an intern visible to the authenticated API key.
- /// Example: 7c9e6679-7425-40de-944b-e07fc1f90ae7
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- public async global::System.Threading.Tasks.Task> GetInternDaemonAsResponseAsync(
- string internId,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default)
- {
- PrepareArguments(
- client: HttpClient);
- PrepareGetInternDaemonArguments(
- httpClient: HttpClient,
- internId: ref internId);
-
-
- var __authorizations = global::OpenRouter.EndPointSecurityResolver.ResolveAuthorizations(
- availableAuthorizations: Authorizations,
- securityRequirements: s_GetInternDaemonSecurityRequirements,
- operationName: "GetInternDaemonAsync");
-
- using var __timeoutCancellationTokenSource = global::OpenRouter.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
- clientOptions: Options,
- requestOptions: requestOptions,
- cancellationToken: cancellationToken);
- var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
- var __effectiveReadResponseAsString = global::OpenRouter.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
- clientOptions: Options,
- requestOptions: requestOptions,
- fallbackValue: ReadResponseAsString);
- var __maxAttempts = global::OpenRouter.AutoSDKRequestOptionsSupport.GetMaxAttempts(
- clientOptions: Options,
- requestOptions: requestOptions,
- supportsRetry: true);
-
- global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
- {
-
- var __pathBuilder = new global::OpenRouter.PathBuilder(
- path: $"/interns/{internId}/daemon",
- baseUri: HttpClient.BaseAddress ?? new global::System.Uri("https://openrouter.ai/api/v1", global::System.UriKind.RelativeOrAbsolute));
- var __path = __pathBuilder.ToString();
- __path = global::OpenRouter.AutoSDKRequestOptionsSupport.AppendQueryParameters(
- path: __path,
- clientParameters: Options.QueryParameters,
- requestParameters: requestOptions?.QueryParameters);
- var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Get,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
-#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
-#endif
-
- foreach (var __authorization in __authorizations)
- {
- if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2" ||
- __authorization.Type == "OpenIdConnect")
- {
- __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
- scheme: __authorization.Name,
- parameter: __authorization.Value);
- }
- else if (__authorization.Type == "ApiKey" &&
- __authorization.Location == "Header")
- {
- __httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
- }
- global::OpenRouter.AutoSDKRequestOptionsSupport.ApplyHeaders(
- request: __httpRequest,
- clientHeaders: Options.Headers,
- requestHeaders: requestOptions?.Headers);
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareGetInternDaemonRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- internId: internId);
-
- global::OpenRouter.AutoSDKHttpRequestOptions.StampAuthorizationOverride(__httpRequest);
-
- return __httpRequest;
- }
-
- global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
- global::System.Net.Http.HttpResponseMessage? __response = null;
- var __attemptNumber = 0;
- try
- {
- for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
- {
- __attemptNumber = __attempt;
- __httpRequest = __CreateHttpRequest();
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "GetInternDaemon",
- methodName: "GetInternDaemonAsync",
- pathTemplate: "$\"/interns/{internId}/daemon\"",
- httpMethod: "GET",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: null,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- try
- {
- __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- }
- catch (global::System.Net.Http.HttpRequestException __exception)
- {
- var __retryDelay = global::OpenRouter.AutoSDKRequestOptionsSupport.GetRetryDelay(
- clientOptions: Options,
- requestOptions: requestOptions,
- response: null,
- attempt: __attempt);
- var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "GetInternDaemon",
- methodName: "GetInternDaemonAsync",
- pathTemplate: "$\"/interns/{internId}/daemon\"",
- httpMethod: "GET",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: null,
- exception: __exception,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: __willRetry,
- retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
- retryReason: "exception",
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- if (!__willRetry)
- {
- throw;
- }
-
- __httpRequest.Dispose();
- __httpRequest = null;
- await global::OpenRouter.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- retryDelay: __retryDelay,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- continue;
- }
-
- if (__response != null &&
- __attempt < __maxAttempts &&
- global::OpenRouter.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
- {
- var __retryDelay = global::OpenRouter.AutoSDKRequestOptionsSupport.GetRetryDelay(
- clientOptions: Options,
- requestOptions: requestOptions,
- response: __response,
- attempt: __attempt);
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "GetInternDaemon",
- methodName: "GetInternDaemonAsync",
- pathTemplate: "$\"/interns/{internId}/daemon\"",
- httpMethod: "GET",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: true,
- retryDelay: __retryDelay,
- retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- __response.Dispose();
- __response = null;
- __httpRequest.Dispose();
- __httpRequest = null;
- await global::OpenRouter.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- retryDelay: __retryDelay,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- continue;
- }
-
- break;
- }
-
- if (__response == null)
- {
- throw new global::System.InvalidOperationException("No response received.");
- }
-
- using (__response)
- {
-
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessGetInternDaemonResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- if (__response.IsSuccessStatusCode)
- {
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "GetInternDaemon",
- methodName: "GetInternDaemonAsync",
- pathTemplate: "$\"/interns/{internId}/daemon\"",
- httpMethod: "GET",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attemptNumber,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- }
- else
- {
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "GetInternDaemon",
- methodName: "GetInternDaemonAsync",
- pathTemplate: "$\"/interns/{internId}/daemon\"",
- httpMethod: "GET",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attemptNumber,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- }
- // Missing, unknown or provisioning API key.
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::OpenRouter.InternLifecycleError? __value_401 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_401 = global::OpenRouter.InternLifecycleError.FromJson(__content_401, JsonSerializerContext);
- }
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_401 = global::OpenRouter.InternLifecycleError.FromJson(__content_401, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_401 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- responseBody: __content_401,
- responseObject: __value_401,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The key owner no longer has access, or the request used a regional hostname.
- if ((int)__response.StatusCode == 403)
- {
- string? __content_403 = null;
- global::System.Exception? __exception_403 = null;
- global::OpenRouter.InternLifecycleError? __value_403 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_403 = global::OpenRouter.InternLifecycleError.FromJson(__content_403, JsonSerializerContext);
- }
- else
- {
- __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_403 = global::OpenRouter.InternLifecycleError.FromJson(__content_403, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_403 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_403,
- responseBody: __content_403,
- responseObject: __value_403,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The caller is outside the Intern API programme, or the intern is hidden.
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::OpenRouter.InternLifecycleError? __value_404 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_404 = global::OpenRouter.InternLifecycleError.FromJson(__content_404, JsonSerializerContext);
- }
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_404 = global::OpenRouter.InternLifecycleError.FromJson(__content_404, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_404 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- responseBody: __content_404,
- responseObject: __value_404,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The request exceeded its route deadline. The deadline quoted in the message is the route's own, so it differs between operations.
- if ((int)__response.StatusCode == 408)
- {
- string? __content_408 = null;
- global::System.Exception? __exception_408 = null;
- global::OpenRouter.InternLifecycleError? __value_408 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_408 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_408 = global::OpenRouter.InternLifecycleError.FromJson(__content_408, JsonSerializerContext);
- }
- else
- {
- __content_408 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_408 = global::OpenRouter.InternLifecycleError.FromJson(__content_408, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_408 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_408 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_408,
- responseBody: __content_408,
- responseObject: __value_408,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The intern cannot be attached to. `metadata.reason` is `intern_not_running`, `intern_unreachable` when it has no usable address yet, or `intern_needs_restart` when it was provisioned before daemon access was available.
- if ((int)__response.StatusCode == 409)
- {
- string? __content_409 = null;
- global::System.Exception? __exception_409 = null;
- global::OpenRouter.InternLifecycleError? __value_409 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_409 = global::OpenRouter.InternLifecycleError.FromJson(__content_409, JsonSerializerContext);
- }
- else
- {
- __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_409 = global::OpenRouter.InternLifecycleError.FromJson(__content_409, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_409 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_409 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_409,
- responseBody: __content_409,
- responseObject: __value_409,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The request could not be completed. `metadata.reason` says whether to try again: `internal_error` is a transient failure and carries `metadata.retryable: true`, so the same request may be sent again, while `configuration_error` carries `retryable: false` because the next attempt reads the same missing binding or unusable stored credential.
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::OpenRouter.InternLifecycleError? __value_500 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_500 = global::OpenRouter.InternLifecycleError.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_500 = global::OpenRouter.InternLifecycleError.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- responseBody: __content_500,
- responseObject: __value_500,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
-
- if (__effectiveReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
-
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessGetInternDaemonResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
- {
- __response.EnsureSuccessStatusCode();
-
- var __value = global::OpenRouter.InternDaemonAccess.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- return new global::OpenRouter.AutoSDKHttpResponse(
- statusCode: __response.StatusCode,
- headers: global::OpenRouter.AutoSDKHttpResponse.CreateHeaders(__response),
- requestUri: __response.RequestMessage?.RequestUri,
- body: __value);
- }
- catch (global::System.Exception __ex)
- {
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- responseBody: __content,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
-
- var __value = await global::OpenRouter.InternDaemonAccess.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- return new global::OpenRouter.AutoSDKHttpResponse(
- statusCode: __response.StatusCode,
- headers: global::OpenRouter.AutoSDKHttpResponse.CreateHeaders(__response),
- requestUri: __response.RequestMessage?.RequestUri,
- body: __value);
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- responseBody: __content,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- }
-
- }
- }
- finally
- {
- __httpRequest?.Dispose();
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/libs/OpenRouter/Generated/OpenRouter.InternsClient.GetInternIcon.g.cs b/src/libs/OpenRouter/Generated/OpenRouter.InternsClient.GetInternIcon.g.cs
deleted file mode 100644
index 6f50bd5a..00000000
--- a/src/libs/OpenRouter/Generated/OpenRouter.InternsClient.GetInternIcon.g.cs
+++ /dev/null
@@ -1,1141 +0,0 @@
-
-#nullable enable
-
-namespace OpenRouter
-{
- public partial class InternsClient
- {
-
-
- private static readonly global::OpenRouter.EndPointSecurityRequirement s_GetInternIconSecurityRequirement0 =
- new global::OpenRouter.EndPointSecurityRequirement
- {
- Authorizations = new global::OpenRouter.EndPointAuthorizationRequirement[]
- { new global::OpenRouter.EndPointAuthorizationRequirement
- {
- Type = "Http",
- SchemeId = "Bearer",
- Location = "Header",
- Name = "Bearer",
- FriendlyName = "Bearer",
- },
- },
- };
- private static readonly global::OpenRouter.EndPointSecurityRequirement[] s_GetInternIconSecurityRequirements =
- new global::OpenRouter.EndPointSecurityRequirement[]
- { s_GetInternIconSecurityRequirement0,
- };
- partial void PrepareGetInternIconArguments(
- global::System.Net.Http.HttpClient httpClient,
- ref string internId,
- ref string? v);
- partial void PrepareGetInternIconRequest(
- global::System.Net.Http.HttpClient httpClient,
- global::System.Net.Http.HttpRequestMessage httpRequestMessage,
- string internId,
- string? v);
- partial void ProcessGetInternIconResponse(
- global::System.Net.Http.HttpClient httpClient,
- global::System.Net.Http.HttpResponseMessage httpResponseMessage);
-
- partial void ProcessGetInternIconResponseContent(
- global::System.Net.Http.HttpClient httpClient,
- global::System.Net.Http.HttpResponseMessage httpResponseMessage,
- ref byte[] content);
-
- ///
- /// Get an intern's icon
- /// Returns the icon image of one visible intern. Pass the intern's `icon_sha256` as `v` to receive a response that can be cached indefinitely. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// ID of an intern visible to the authenticated API key.
- /// Example: 7c9e6679-7425-40de-944b-e07fc1f90ae7
- ///
- ///
- /// The `icon_sha256` the caller expects.
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- public async global::System.Threading.Tasks.Task GetInternIconAsync(
- string internId,
- string? v = default,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default)
- {
- var __response = await GetInternIconAsResponseAsync(
- internId: internId,
- v: v,
- requestOptions: requestOptions,
- cancellationToken: cancellationToken
- ).ConfigureAwait(false);
-
- return __response.Body;
- }
- ///
- /// Get an intern's icon
- /// Returns the icon image of one visible intern. Pass the intern's `icon_sha256` as `v` to receive a response that can be cached indefinitely. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// ID of an intern visible to the authenticated API key.
- /// Example: 7c9e6679-7425-40de-944b-e07fc1f90ae7
- ///
- ///
- /// The `icon_sha256` the caller expects.
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- public async global::System.Threading.Tasks.Task GetInternIconAsStreamAsync(
- string internId,
- string? v = default,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default)
- {
- PrepareArguments(
- client: HttpClient);
- PrepareGetInternIconArguments(
- httpClient: HttpClient,
- internId: ref internId,
- v: ref v);
-
-
- var __authorizations = global::OpenRouter.EndPointSecurityResolver.ResolveAuthorizations(
- availableAuthorizations: Authorizations,
- securityRequirements: s_GetInternIconSecurityRequirements,
- operationName: "GetInternIconAsync");
-
- using var __timeoutCancellationTokenSource = global::OpenRouter.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
- clientOptions: Options,
- requestOptions: requestOptions,
- cancellationToken: cancellationToken);
- var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
- var __effectiveReadResponseAsString = global::OpenRouter.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
- clientOptions: Options,
- requestOptions: requestOptions,
- fallbackValue: ReadResponseAsString);
- var __maxAttempts = global::OpenRouter.AutoSDKRequestOptionsSupport.GetMaxAttempts(
- clientOptions: Options,
- requestOptions: requestOptions,
- supportsRetry: true);
-
- global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
- {
-
- var __pathBuilder = new global::OpenRouter.PathBuilder(
- path: $"/interns/{internId}/icon",
- baseUri: HttpClient.BaseAddress ?? new global::System.Uri("https://openrouter.ai/api/v1", global::System.UriKind.RelativeOrAbsolute));
- __pathBuilder
- .AddOptionalParameter("v", v)
- ;
- var __path = __pathBuilder.ToString();
- __path = global::OpenRouter.AutoSDKRequestOptionsSupport.AppendQueryParameters(
- path: __path,
- clientParameters: Options.QueryParameters,
- requestParameters: requestOptions?.QueryParameters);
- var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Get,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
-#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
-#endif
-
- foreach (var __authorization in __authorizations)
- {
- if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2" ||
- __authorization.Type == "OpenIdConnect")
- {
- __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
- scheme: __authorization.Name,
- parameter: __authorization.Value);
- }
- else if (__authorization.Type == "ApiKey" &&
- __authorization.Location == "Header")
- {
- __httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
- }
- global::OpenRouter.AutoSDKRequestOptionsSupport.ApplyHeaders(
- request: __httpRequest,
- clientHeaders: Options.Headers,
- requestHeaders: requestOptions?.Headers);
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareGetInternIconRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- internId: internId,
- v: v);
-
- global::OpenRouter.AutoSDKHttpRequestOptions.StampAuthorizationOverride(__httpRequest);
-
- return __httpRequest;
- }
-
- global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
- global::System.Net.Http.HttpResponseMessage? __response = null;
- var __attemptNumber = 0;
- try
- {
- for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
- {
- __attemptNumber = __attempt;
- __httpRequest = __CreateHttpRequest();
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "GetInternIcon",
- methodName: "GetInternIconAsync",
- pathTemplate: "$\"/interns/{internId}/icon\"",
- httpMethod: "GET",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: null,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- try
- {
- __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseHeadersRead,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- }
- catch (global::System.Net.Http.HttpRequestException __exception)
- {
- var __retryDelay = global::OpenRouter.AutoSDKRequestOptionsSupport.GetRetryDelay(
- clientOptions: Options,
- requestOptions: requestOptions,
- response: null,
- attempt: __attempt);
- var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "GetInternIcon",
- methodName: "GetInternIconAsync",
- pathTemplate: "$\"/interns/{internId}/icon\"",
- httpMethod: "GET",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: null,
- exception: __exception,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: __willRetry,
- retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
- retryReason: "exception",
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- if (!__willRetry)
- {
- throw;
- }
-
- __httpRequest.Dispose();
- __httpRequest = null;
- await global::OpenRouter.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- retryDelay: __retryDelay,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- continue;
- }
-
- if (__response != null &&
- __attempt < __maxAttempts &&
- global::OpenRouter.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
- {
- var __retryDelay = global::OpenRouter.AutoSDKRequestOptionsSupport.GetRetryDelay(
- clientOptions: Options,
- requestOptions: requestOptions,
- response: __response,
- attempt: __attempt);
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "GetInternIcon",
- methodName: "GetInternIconAsync",
- pathTemplate: "$\"/interns/{internId}/icon\"",
- httpMethod: "GET",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: true,
- retryDelay: __retryDelay,
- retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- __response.Dispose();
- __response = null;
- __httpRequest.Dispose();
- __httpRequest = null;
- await global::OpenRouter.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- retryDelay: __retryDelay,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- continue;
- }
-
- break;
- }
-
- if (__response == null)
- {
- throw new global::System.InvalidOperationException("No response received.");
- }
-
- try
- {
-
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessGetInternIconResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- if (__response.IsSuccessStatusCode)
- {
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "GetInternIcon",
- methodName: "GetInternIconAsync",
- pathTemplate: "$\"/interns/{internId}/icon\"",
- httpMethod: "GET",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attemptNumber,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- }
- else
- {
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "GetInternIcon",
- methodName: "GetInternIconAsync",
- pathTemplate: "$\"/interns/{internId}/icon\"",
- httpMethod: "GET",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attemptNumber,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- }
- // Missing, unknown or provisioning API key.
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::OpenRouter.InternLifecycleError? __value_401 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_401 = global::OpenRouter.InternLifecycleError.FromJson(__content_401, JsonSerializerContext);
- }
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_401 = global::OpenRouter.InternLifecycleError.FromJson(__content_401, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_401 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- responseBody: __content_401,
- responseObject: __value_401,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The key owner no longer has access, or the request used a regional hostname.
- if ((int)__response.StatusCode == 403)
- {
- string? __content_403 = null;
- global::System.Exception? __exception_403 = null;
- global::OpenRouter.InternLifecycleError? __value_403 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_403 = global::OpenRouter.InternLifecycleError.FromJson(__content_403, JsonSerializerContext);
- }
- else
- {
- __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_403 = global::OpenRouter.InternLifecycleError.FromJson(__content_403, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_403 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_403,
- responseBody: __content_403,
- responseObject: __value_403,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The caller is outside the Intern API programme, or the intern is hidden.
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::OpenRouter.InternLifecycleError? __value_404 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_404 = global::OpenRouter.InternLifecycleError.FromJson(__content_404, JsonSerializerContext);
- }
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_404 = global::OpenRouter.InternLifecycleError.FromJson(__content_404, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_404 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- responseBody: __content_404,
- responseObject: __value_404,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The request exceeded its route deadline. The deadline quoted in the message is the route's own, so it differs between operations.
- if ((int)__response.StatusCode == 408)
- {
- string? __content_408 = null;
- global::System.Exception? __exception_408 = null;
- global::OpenRouter.InternLifecycleError? __value_408 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_408 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_408 = global::OpenRouter.InternLifecycleError.FromJson(__content_408, JsonSerializerContext);
- }
- else
- {
- __content_408 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_408 = global::OpenRouter.InternLifecycleError.FromJson(__content_408, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_408 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_408 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_408,
- responseBody: __content_408,
- responseObject: __value_408,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The request could not be completed. `metadata.reason` says whether to try again: `internal_error` is a transient failure and carries `metadata.retryable: true`, so the same request may be sent again, while `configuration_error` carries `retryable: false` because the next attempt reads the same missing binding or unusable stored credential.
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::OpenRouter.InternLifecycleError? __value_500 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_500 = global::OpenRouter.InternLifecycleError.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_500 = global::OpenRouter.InternLifecycleError.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- responseBody: __content_500,
- responseObject: __value_500,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
-
- try
- {
- __response.EnsureSuccessStatusCode();
-
- var __content = await __response.Content.ReadAsStreamAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
-
- return new global::OpenRouter.ResponseStream(__response, __content);
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- responseBody: __content,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
-
- }
- catch
- {
- __response.Dispose();
- throw;
- }
- }
- finally
- {
- __httpRequest?.Dispose();
- }
- }
- ///
- /// Get an intern's icon
- /// Returns the icon image of one visible intern. Pass the intern's `icon_sha256` as `v` to receive a response that can be cached indefinitely. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// ID of an intern visible to the authenticated API key.
- /// Example: 7c9e6679-7425-40de-944b-e07fc1f90ae7
- ///
- ///
- /// The `icon_sha256` the caller expects.
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- public async global::System.Threading.Tasks.Task> GetInternIconAsResponseAsync(
- string internId,
- string? v = default,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default)
- {
- PrepareArguments(
- client: HttpClient);
- PrepareGetInternIconArguments(
- httpClient: HttpClient,
- internId: ref internId,
- v: ref v);
-
-
- var __authorizations = global::OpenRouter.EndPointSecurityResolver.ResolveAuthorizations(
- availableAuthorizations: Authorizations,
- securityRequirements: s_GetInternIconSecurityRequirements,
- operationName: "GetInternIconAsync");
-
- using var __timeoutCancellationTokenSource = global::OpenRouter.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
- clientOptions: Options,
- requestOptions: requestOptions,
- cancellationToken: cancellationToken);
- var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
- var __effectiveReadResponseAsString = global::OpenRouter.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
- clientOptions: Options,
- requestOptions: requestOptions,
- fallbackValue: ReadResponseAsString);
- var __maxAttempts = global::OpenRouter.AutoSDKRequestOptionsSupport.GetMaxAttempts(
- clientOptions: Options,
- requestOptions: requestOptions,
- supportsRetry: true);
-
- global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
- {
-
- var __pathBuilder = new global::OpenRouter.PathBuilder(
- path: $"/interns/{internId}/icon",
- baseUri: HttpClient.BaseAddress ?? new global::System.Uri("https://openrouter.ai/api/v1", global::System.UriKind.RelativeOrAbsolute));
- __pathBuilder
- .AddOptionalParameter("v", v)
- ;
- var __path = __pathBuilder.ToString();
- __path = global::OpenRouter.AutoSDKRequestOptionsSupport.AppendQueryParameters(
- path: __path,
- clientParameters: Options.QueryParameters,
- requestParameters: requestOptions?.QueryParameters);
- var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Get,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
-#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
-#endif
-
- foreach (var __authorization in __authorizations)
- {
- if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2" ||
- __authorization.Type == "OpenIdConnect")
- {
- __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
- scheme: __authorization.Name,
- parameter: __authorization.Value);
- }
- else if (__authorization.Type == "ApiKey" &&
- __authorization.Location == "Header")
- {
- __httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
- }
- global::OpenRouter.AutoSDKRequestOptionsSupport.ApplyHeaders(
- request: __httpRequest,
- clientHeaders: Options.Headers,
- requestHeaders: requestOptions?.Headers);
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareGetInternIconRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- internId: internId,
- v: v);
-
- global::OpenRouter.AutoSDKHttpRequestOptions.StampAuthorizationOverride(__httpRequest);
-
- return __httpRequest;
- }
-
- global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
- global::System.Net.Http.HttpResponseMessage? __response = null;
- var __attemptNumber = 0;
- try
- {
- for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
- {
- __attemptNumber = __attempt;
- __httpRequest = __CreateHttpRequest();
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "GetInternIcon",
- methodName: "GetInternIconAsync",
- pathTemplate: "$\"/interns/{internId}/icon\"",
- httpMethod: "GET",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: null,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- try
- {
- __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- }
- catch (global::System.Net.Http.HttpRequestException __exception)
- {
- var __retryDelay = global::OpenRouter.AutoSDKRequestOptionsSupport.GetRetryDelay(
- clientOptions: Options,
- requestOptions: requestOptions,
- response: null,
- attempt: __attempt);
- var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "GetInternIcon",
- methodName: "GetInternIconAsync",
- pathTemplate: "$\"/interns/{internId}/icon\"",
- httpMethod: "GET",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: null,
- exception: __exception,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: __willRetry,
- retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
- retryReason: "exception",
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- if (!__willRetry)
- {
- throw;
- }
-
- __httpRequest.Dispose();
- __httpRequest = null;
- await global::OpenRouter.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- retryDelay: __retryDelay,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- continue;
- }
-
- if (__response != null &&
- __attempt < __maxAttempts &&
- global::OpenRouter.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
- {
- var __retryDelay = global::OpenRouter.AutoSDKRequestOptionsSupport.GetRetryDelay(
- clientOptions: Options,
- requestOptions: requestOptions,
- response: __response,
- attempt: __attempt);
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "GetInternIcon",
- methodName: "GetInternIconAsync",
- pathTemplate: "$\"/interns/{internId}/icon\"",
- httpMethod: "GET",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: true,
- retryDelay: __retryDelay,
- retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- __response.Dispose();
- __response = null;
- __httpRequest.Dispose();
- __httpRequest = null;
- await global::OpenRouter.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- retryDelay: __retryDelay,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- continue;
- }
-
- break;
- }
-
- if (__response == null)
- {
- throw new global::System.InvalidOperationException("No response received.");
- }
-
- using (__response)
- {
-
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessGetInternIconResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- if (__response.IsSuccessStatusCode)
- {
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "GetInternIcon",
- methodName: "GetInternIconAsync",
- pathTemplate: "$\"/interns/{internId}/icon\"",
- httpMethod: "GET",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attemptNumber,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- }
- else
- {
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "GetInternIcon",
- methodName: "GetInternIconAsync",
- pathTemplate: "$\"/interns/{internId}/icon\"",
- httpMethod: "GET",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attemptNumber,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- }
- // Missing, unknown or provisioning API key.
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::OpenRouter.InternLifecycleError? __value_401 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_401 = global::OpenRouter.InternLifecycleError.FromJson(__content_401, JsonSerializerContext);
- }
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_401 = global::OpenRouter.InternLifecycleError.FromJson(__content_401, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_401 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- responseBody: __content_401,
- responseObject: __value_401,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The key owner no longer has access, or the request used a regional hostname.
- if ((int)__response.StatusCode == 403)
- {
- string? __content_403 = null;
- global::System.Exception? __exception_403 = null;
- global::OpenRouter.InternLifecycleError? __value_403 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_403 = global::OpenRouter.InternLifecycleError.FromJson(__content_403, JsonSerializerContext);
- }
- else
- {
- __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_403 = global::OpenRouter.InternLifecycleError.FromJson(__content_403, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_403 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_403,
- responseBody: __content_403,
- responseObject: __value_403,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The caller is outside the Intern API programme, or the intern is hidden.
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::OpenRouter.InternLifecycleError? __value_404 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_404 = global::OpenRouter.InternLifecycleError.FromJson(__content_404, JsonSerializerContext);
- }
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_404 = global::OpenRouter.InternLifecycleError.FromJson(__content_404, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_404 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- responseBody: __content_404,
- responseObject: __value_404,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The request exceeded its route deadline. The deadline quoted in the message is the route's own, so it differs between operations.
- if ((int)__response.StatusCode == 408)
- {
- string? __content_408 = null;
- global::System.Exception? __exception_408 = null;
- global::OpenRouter.InternLifecycleError? __value_408 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_408 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_408 = global::OpenRouter.InternLifecycleError.FromJson(__content_408, JsonSerializerContext);
- }
- else
- {
- __content_408 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_408 = global::OpenRouter.InternLifecycleError.FromJson(__content_408, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_408 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_408 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_408,
- responseBody: __content_408,
- responseObject: __value_408,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The request could not be completed. `metadata.reason` says whether to try again: `internal_error` is a transient failure and carries `metadata.retryable: true`, so the same request may be sent again, while `configuration_error` carries `retryable: false` because the next attempt reads the same missing binding or unusable stored credential.
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::OpenRouter.InternLifecycleError? __value_500 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_500 = global::OpenRouter.InternLifecycleError.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_500 = global::OpenRouter.InternLifecycleError.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- responseBody: __content_500,
- responseObject: __value_500,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
-
- if (__effectiveReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsByteArrayAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
-
- ProcessGetInternIconResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
- {
- __response.EnsureSuccessStatusCode();
-
- return new global::OpenRouter.AutoSDKHttpResponse(
- statusCode: __response.StatusCode,
- headers: global::OpenRouter.AutoSDKHttpResponse.CreateHeaders(__response),
- requestUri: __response.RequestMessage?.RequestUri,
- body: __content);
- }
- catch (global::System.Exception __ex)
- {
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- responseBody: null,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- var __content = await __response.Content.ReadAsByteArrayAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
-
- return new global::OpenRouter.AutoSDKHttpResponse(
- statusCode: __response.StatusCode,
- headers: global::OpenRouter.AutoSDKHttpResponse.CreateHeaders(__response),
- requestUri: __response.RequestMessage?.RequestUri,
- body: __content);
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- responseBody: __content,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- }
-
- }
- }
- finally
- {
- __httpRequest?.Dispose();
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/libs/OpenRouter/Generated/OpenRouter.InternsClient.ListInterns.g.cs b/src/libs/OpenRouter/Generated/OpenRouter.InternsClient.ListInterns.g.cs
deleted file mode 100644
index 4e0cda97..00000000
--- a/src/libs/OpenRouter/Generated/OpenRouter.InternsClient.ListInterns.g.cs
+++ /dev/null
@@ -1,707 +0,0 @@
-
-#nullable enable
-
-namespace OpenRouter
-{
- public partial class InternsClient
- {
-
-
- private static readonly global::OpenRouter.EndPointSecurityRequirement s_ListInternsSecurityRequirement0 =
- new global::OpenRouter.EndPointSecurityRequirement
- {
- Authorizations = new global::OpenRouter.EndPointAuthorizationRequirement[]
- { new global::OpenRouter.EndPointAuthorizationRequirement
- {
- Type = "Http",
- SchemeId = "Bearer",
- Location = "Header",
- Name = "Bearer",
- FriendlyName = "Bearer",
- },
- },
- };
- private static readonly global::OpenRouter.EndPointSecurityRequirement[] s_ListInternsSecurityRequirements =
- new global::OpenRouter.EndPointSecurityRequirement[]
- { s_ListInternsSecurityRequirement0,
- };
- partial void PrepareListInternsArguments(
- global::System.Net.Http.HttpClient httpClient,
- ref int? limit,
- global::System.Collections.Generic.IList? status,
- ref string? startingAfter,
- ref global::System.Guid? workspaceId);
- partial void PrepareListInternsRequest(
- global::System.Net.Http.HttpClient httpClient,
- global::System.Net.Http.HttpRequestMessage httpRequestMessage,
- int? limit,
- global::System.Collections.Generic.IList? status,
- string? startingAfter,
- global::System.Guid? workspaceId);
- partial void ProcessListInternsResponse(
- global::System.Net.Http.HttpClient httpClient,
- global::System.Net.Http.HttpResponseMessage httpResponseMessage);
-
- partial void ProcessListInternsResponseContent(
- global::System.Net.Http.HttpClient httpClient,
- global::System.Net.Http.HttpResponseMessage httpResponseMessage,
- ref string content);
-
- ///
- /// List interns
- /// Lists interns visible to the authenticated key, newest first. Filter by workspace and one or more lifecycle statuses. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// Maximum number of interns to return, from 1 through 500.
- /// Example: 50
- ///
- ///
- /// Comma-separated lifecycle statuses to include, at most 8. Repeats are collapsed.
- /// Example: [queued, running]
- ///
- ///
- /// The opaque `next_cursor` of the previous page. Returns the interns that come after it in the newest-first order. A malformed cursor is a 400.
- /// Example: MjAyNi0wOS0xNlQwODozMDowMC4wMDAwMDBafDdjOWU2Njc5LTc0MjUtNDBkZS05NDRiLWUwN2ZjMWY5MGFlNw
- ///
- ///
- /// Only return interns in this workspace. It must match the API key workspace.
- /// Example: 89f9f5b2-3f89-4eaf-83ca-5ceae149e8bb
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- public async global::System.Threading.Tasks.Task ListInternsAsync(
- int? limit = default,
- global::System.Collections.Generic.IList? status = default,
- string? startingAfter = default,
- global::System.Guid? workspaceId = default,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default)
- {
- var __response = await ListInternsAsResponseAsync(
- limit: limit,
- status: status,
- startingAfter: startingAfter,
- workspaceId: workspaceId,
- requestOptions: requestOptions,
- cancellationToken: cancellationToken
- ).ConfigureAwait(false);
-
- return __response.Body;
- }
- ///
- /// List interns
- /// Lists interns visible to the authenticated key, newest first. Filter by workspace and one or more lifecycle statuses. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// Maximum number of interns to return, from 1 through 500.
- /// Example: 50
- ///
- ///
- /// Comma-separated lifecycle statuses to include, at most 8. Repeats are collapsed.
- /// Example: [queued, running]
- ///
- ///
- /// The opaque `next_cursor` of the previous page. Returns the interns that come after it in the newest-first order. A malformed cursor is a 400.
- /// Example: MjAyNi0wOS0xNlQwODozMDowMC4wMDAwMDBafDdjOWU2Njc5LTc0MjUtNDBkZS05NDRiLWUwN2ZjMWY5MGFlNw
- ///
- ///
- /// Only return interns in this workspace. It must match the API key workspace.
- /// Example: 89f9f5b2-3f89-4eaf-83ca-5ceae149e8bb
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- public async global::System.Threading.Tasks.Task> ListInternsAsResponseAsync(
- int? limit = default,
- global::System.Collections.Generic.IList? status = default,
- string? startingAfter = default,
- global::System.Guid? workspaceId = default,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default)
- {
- PrepareArguments(
- client: HttpClient);
- PrepareListInternsArguments(
- httpClient: HttpClient,
- limit: ref limit,
- status: status,
- startingAfter: ref startingAfter,
- workspaceId: ref workspaceId);
-
-
- var __authorizations = global::OpenRouter.EndPointSecurityResolver.ResolveAuthorizations(
- availableAuthorizations: Authorizations,
- securityRequirements: s_ListInternsSecurityRequirements,
- operationName: "ListInternsAsync");
-
- using var __timeoutCancellationTokenSource = global::OpenRouter.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
- clientOptions: Options,
- requestOptions: requestOptions,
- cancellationToken: cancellationToken);
- var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
- var __effectiveReadResponseAsString = global::OpenRouter.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
- clientOptions: Options,
- requestOptions: requestOptions,
- fallbackValue: ReadResponseAsString);
- var __maxAttempts = global::OpenRouter.AutoSDKRequestOptionsSupport.GetMaxAttempts(
- clientOptions: Options,
- requestOptions: requestOptions,
- supportsRetry: true);
-
- global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
- {
-
- var __pathBuilder = new global::OpenRouter.PathBuilder(
- path: "/interns",
- baseUri: HttpClient.BaseAddress ?? new global::System.Uri("https://openrouter.ai/api/v1", global::System.UriKind.RelativeOrAbsolute));
- __pathBuilder
- .AddOptionalParameter("limit", limit?.ToString())
- .AddOptionalParameter("status", status, selector: static x => x.ToValueString(), delimiter: ",", explode: false)
- .AddOptionalParameter("starting_after", startingAfter)
- .AddOptionalParameter("workspace_id", workspaceId?.ToString())
- ;
- var __path = __pathBuilder.ToString();
- __path = global::OpenRouter.AutoSDKRequestOptionsSupport.AppendQueryParameters(
- path: __path,
- clientParameters: Options.QueryParameters,
- requestParameters: requestOptions?.QueryParameters);
- var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Get,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
-#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
-#endif
-
- foreach (var __authorization in __authorizations)
- {
- if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2" ||
- __authorization.Type == "OpenIdConnect")
- {
- __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
- scheme: __authorization.Name,
- parameter: __authorization.Value);
- }
- else if (__authorization.Type == "ApiKey" &&
- __authorization.Location == "Header")
- {
- __httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
- }
- global::OpenRouter.AutoSDKRequestOptionsSupport.ApplyHeaders(
- request: __httpRequest,
- clientHeaders: Options.Headers,
- requestHeaders: requestOptions?.Headers);
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareListInternsRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- limit: limit,
- status: status,
- startingAfter: startingAfter,
- workspaceId: workspaceId);
-
- global::OpenRouter.AutoSDKHttpRequestOptions.StampAuthorizationOverride(__httpRequest);
-
- return __httpRequest;
- }
-
- global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
- global::System.Net.Http.HttpResponseMessage? __response = null;
- var __attemptNumber = 0;
- try
- {
- for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
- {
- __attemptNumber = __attempt;
- __httpRequest = __CreateHttpRequest();
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "ListInterns",
- methodName: "ListInternsAsync",
- pathTemplate: "\"/interns\"",
- httpMethod: "GET",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: null,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- try
- {
- __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- }
- catch (global::System.Net.Http.HttpRequestException __exception)
- {
- var __retryDelay = global::OpenRouter.AutoSDKRequestOptionsSupport.GetRetryDelay(
- clientOptions: Options,
- requestOptions: requestOptions,
- response: null,
- attempt: __attempt);
- var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "ListInterns",
- methodName: "ListInternsAsync",
- pathTemplate: "\"/interns\"",
- httpMethod: "GET",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: null,
- exception: __exception,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: __willRetry,
- retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
- retryReason: "exception",
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- if (!__willRetry)
- {
- throw;
- }
-
- __httpRequest.Dispose();
- __httpRequest = null;
- await global::OpenRouter.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- retryDelay: __retryDelay,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- continue;
- }
-
- if (__response != null &&
- __attempt < __maxAttempts &&
- global::OpenRouter.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
- {
- var __retryDelay = global::OpenRouter.AutoSDKRequestOptionsSupport.GetRetryDelay(
- clientOptions: Options,
- requestOptions: requestOptions,
- response: __response,
- attempt: __attempt);
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "ListInterns",
- methodName: "ListInternsAsync",
- pathTemplate: "\"/interns\"",
- httpMethod: "GET",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: true,
- retryDelay: __retryDelay,
- retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- __response.Dispose();
- __response = null;
- __httpRequest.Dispose();
- __httpRequest = null;
- await global::OpenRouter.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- retryDelay: __retryDelay,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- continue;
- }
-
- break;
- }
-
- if (__response == null)
- {
- throw new global::System.InvalidOperationException("No response received.");
- }
-
- using (__response)
- {
-
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessListInternsResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- if (__response.IsSuccessStatusCode)
- {
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "ListInterns",
- methodName: "ListInternsAsync",
- pathTemplate: "\"/interns\"",
- httpMethod: "GET",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attemptNumber,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- }
- else
- {
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "ListInterns",
- methodName: "ListInternsAsync",
- pathTemplate: "\"/interns\"",
- httpMethod: "GET",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attemptNumber,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- }
- // The list filters are invalid.
- if ((int)__response.StatusCode == 400)
- {
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::OpenRouter.InternLifecycleError? __value_400 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_400 = global::OpenRouter.InternLifecycleError.FromJson(__content_400, JsonSerializerContext);
- }
- else
- {
- __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_400 = global::OpenRouter.InternLifecycleError.FromJson(__content_400, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- responseBody: __content_400,
- responseObject: __value_400,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // Missing, unknown or provisioning API key.
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::OpenRouter.InternLifecycleError? __value_401 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_401 = global::OpenRouter.InternLifecycleError.FromJson(__content_401, JsonSerializerContext);
- }
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_401 = global::OpenRouter.InternLifecycleError.FromJson(__content_401, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_401 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- responseBody: __content_401,
- responseObject: __value_401,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The key owner no longer has access, or the request used a regional hostname.
- if ((int)__response.StatusCode == 403)
- {
- string? __content_403 = null;
- global::System.Exception? __exception_403 = null;
- global::OpenRouter.InternLifecycleError? __value_403 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_403 = global::OpenRouter.InternLifecycleError.FromJson(__content_403, JsonSerializerContext);
- }
- else
- {
- __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_403 = global::OpenRouter.InternLifecycleError.FromJson(__content_403, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_403 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_403,
- responseBody: __content_403,
- responseObject: __value_403,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The caller is outside the Intern API programme, or the intern is hidden.
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::OpenRouter.InternLifecycleError? __value_404 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_404 = global::OpenRouter.InternLifecycleError.FromJson(__content_404, JsonSerializerContext);
- }
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_404 = global::OpenRouter.InternLifecycleError.FromJson(__content_404, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_404 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- responseBody: __content_404,
- responseObject: __value_404,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The request exceeded its route deadline. The deadline quoted in the message is the route's own, so it differs between operations.
- if ((int)__response.StatusCode == 408)
- {
- string? __content_408 = null;
- global::System.Exception? __exception_408 = null;
- global::OpenRouter.InternLifecycleError? __value_408 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_408 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_408 = global::OpenRouter.InternLifecycleError.FromJson(__content_408, JsonSerializerContext);
- }
- else
- {
- __content_408 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_408 = global::OpenRouter.InternLifecycleError.FromJson(__content_408, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_408 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_408 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_408,
- responseBody: __content_408,
- responseObject: __value_408,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The request could not be completed. `metadata.reason` says whether to try again: `internal_error` is a transient failure and carries `metadata.retryable: true`, so the same request may be sent again, while `configuration_error` carries `retryable: false` because the next attempt reads the same missing binding or unusable stored credential.
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::OpenRouter.InternLifecycleError? __value_500 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_500 = global::OpenRouter.InternLifecycleError.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_500 = global::OpenRouter.InternLifecycleError.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- responseBody: __content_500,
- responseObject: __value_500,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
-
- if (__effectiveReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
-
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessListInternsResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
- {
- __response.EnsureSuccessStatusCode();
-
- var __value = global::OpenRouter.InternListResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- return new global::OpenRouter.AutoSDKHttpResponse(
- statusCode: __response.StatusCode,
- headers: global::OpenRouter.AutoSDKHttpResponse.CreateHeaders(__response),
- requestUri: __response.RequestMessage?.RequestUri,
- body: __value);
- }
- catch (global::System.Exception __ex)
- {
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- responseBody: __content,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
-
- var __value = await global::OpenRouter.InternListResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- return new global::OpenRouter.AutoSDKHttpResponse(
- statusCode: __response.StatusCode,
- headers: global::OpenRouter.AutoSDKHttpResponse.CreateHeaders(__response),
- requestUri: __response.RequestMessage?.RequestUri,
- body: __value);
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- responseBody: __content,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- }
-
- }
- }
- finally
- {
- __httpRequest?.Dispose();
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/libs/OpenRouter/Generated/OpenRouter.InternsClient.ProvisionIntern.g.cs b/src/libs/OpenRouter/Generated/OpenRouter.InternsClient.ProvisionIntern.g.cs
deleted file mode 100644
index cc014633..00000000
--- a/src/libs/OpenRouter/Generated/OpenRouter.InternsClient.ProvisionIntern.g.cs
+++ /dev/null
@@ -1,804 +0,0 @@
-
-#nullable enable
-
-namespace OpenRouter
-{
- public partial class InternsClient
- {
-
-
- private static readonly global::OpenRouter.EndPointSecurityRequirement s_ProvisionInternSecurityRequirement0 =
- new global::OpenRouter.EndPointSecurityRequirement
- {
- Authorizations = new global::OpenRouter.EndPointAuthorizationRequirement[]
- { new global::OpenRouter.EndPointAuthorizationRequirement
- {
- Type = "Http",
- SchemeId = "Bearer",
- Location = "Header",
- Name = "Bearer",
- FriendlyName = "Bearer",
- },
- },
- };
- private static readonly global::OpenRouter.EndPointSecurityRequirement[] s_ProvisionInternSecurityRequirements =
- new global::OpenRouter.EndPointSecurityRequirement[]
- { s_ProvisionInternSecurityRequirement0,
- };
- partial void PrepareProvisionInternArguments(
- global::System.Net.Http.HttpClient httpClient,
- ref string internId);
- partial void PrepareProvisionInternRequest(
- global::System.Net.Http.HttpClient httpClient,
- global::System.Net.Http.HttpRequestMessage httpRequestMessage,
- string internId);
- partial void ProcessProvisionInternResponse(
- global::System.Net.Http.HttpClient httpClient,
- global::System.Net.Http.HttpResponseMessage httpResponseMessage);
-
- partial void ProcessProvisionInternResponseContent(
- global::System.Net.Http.HttpClient httpClient,
- global::System.Net.Http.HttpResponseMessage httpResponseMessage,
- ref string content);
-
- ///
- /// Provision an intern
- /// Starts the first boot, or resumes an intern after suspension. This operation takes no request body. A body carrying any field is refused with 400 rather than ignored. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// ID of an intern visible to the authenticated API key.
- /// Example: 7c9e6679-7425-40de-944b-e07fc1f90ae7
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- public async global::System.Threading.Tasks.Task ProvisionInternAsync(
- string internId,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default)
- {
- var __response = await ProvisionInternAsResponseAsync(
- internId: internId,
- requestOptions: requestOptions,
- cancellationToken: cancellationToken
- ).ConfigureAwait(false);
-
- return __response.Body;
- }
- ///
- /// Provision an intern
- /// Starts the first boot, or resumes an intern after suspension. This operation takes no request body. A body carrying any field is refused with 400 rather than ignored. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// ID of an intern visible to the authenticated API key.
- /// Example: 7c9e6679-7425-40de-944b-e07fc1f90ae7
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- public async global::System.Threading.Tasks.Task> ProvisionInternAsResponseAsync(
- string internId,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default)
- {
- PrepareArguments(
- client: HttpClient);
- PrepareProvisionInternArguments(
- httpClient: HttpClient,
- internId: ref internId);
-
-
- var __authorizations = global::OpenRouter.EndPointSecurityResolver.ResolveAuthorizations(
- availableAuthorizations: Authorizations,
- securityRequirements: s_ProvisionInternSecurityRequirements,
- operationName: "ProvisionInternAsync");
-
- using var __timeoutCancellationTokenSource = global::OpenRouter.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
- clientOptions: Options,
- requestOptions: requestOptions,
- cancellationToken: cancellationToken);
- var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
- var __effectiveReadResponseAsString = global::OpenRouter.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
- clientOptions: Options,
- requestOptions: requestOptions,
- fallbackValue: ReadResponseAsString);
- var __maxAttempts = global::OpenRouter.AutoSDKRequestOptionsSupport.GetMaxAttempts(
- clientOptions: Options,
- requestOptions: requestOptions,
- supportsRetry: true);
-
- global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
- {
-
- var __pathBuilder = new global::OpenRouter.PathBuilder(
- path: $"/interns/{internId}/provision",
- baseUri: HttpClient.BaseAddress ?? new global::System.Uri("https://openrouter.ai/api/v1", global::System.UriKind.RelativeOrAbsolute));
- var __path = __pathBuilder.ToString();
- __path = global::OpenRouter.AutoSDKRequestOptionsSupport.AppendQueryParameters(
- path: __path,
- clientParameters: Options.QueryParameters,
- requestParameters: requestOptions?.QueryParameters);
- var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
-#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
-#endif
-
- foreach (var __authorization in __authorizations)
- {
- if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2" ||
- __authorization.Type == "OpenIdConnect")
- {
- __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
- scheme: __authorization.Name,
- parameter: __authorization.Value);
- }
- else if (__authorization.Type == "ApiKey" &&
- __authorization.Location == "Header")
- {
- __httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
- }
- global::OpenRouter.AutoSDKRequestOptionsSupport.ApplyHeaders(
- request: __httpRequest,
- clientHeaders: Options.Headers,
- requestHeaders: requestOptions?.Headers);
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareProvisionInternRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- internId: internId);
-
- global::OpenRouter.AutoSDKHttpRequestOptions.StampAuthorizationOverride(__httpRequest);
-
- return __httpRequest;
- }
-
- global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
- global::System.Net.Http.HttpResponseMessage? __response = null;
- var __attemptNumber = 0;
- try
- {
- for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
- {
- __attemptNumber = __attempt;
- __httpRequest = __CreateHttpRequest();
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "ProvisionIntern",
- methodName: "ProvisionInternAsync",
- pathTemplate: "$\"/interns/{internId}/provision\"",
- httpMethod: "POST",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: null,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- try
- {
- __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- }
- catch (global::System.Net.Http.HttpRequestException __exception)
- {
- var __retryDelay = global::OpenRouter.AutoSDKRequestOptionsSupport.GetRetryDelay(
- clientOptions: Options,
- requestOptions: requestOptions,
- response: null,
- attempt: __attempt);
- var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "ProvisionIntern",
- methodName: "ProvisionInternAsync",
- pathTemplate: "$\"/interns/{internId}/provision\"",
- httpMethod: "POST",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: null,
- exception: __exception,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: __willRetry,
- retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
- retryReason: "exception",
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- if (!__willRetry)
- {
- throw;
- }
-
- __httpRequest.Dispose();
- __httpRequest = null;
- await global::OpenRouter.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- retryDelay: __retryDelay,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- continue;
- }
-
- if (__response != null &&
- __attempt < __maxAttempts &&
- global::OpenRouter.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
- {
- var __retryDelay = global::OpenRouter.AutoSDKRequestOptionsSupport.GetRetryDelay(
- clientOptions: Options,
- requestOptions: requestOptions,
- response: __response,
- attempt: __attempt);
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "ProvisionIntern",
- methodName: "ProvisionInternAsync",
- pathTemplate: "$\"/interns/{internId}/provision\"",
- httpMethod: "POST",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: true,
- retryDelay: __retryDelay,
- retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- __response.Dispose();
- __response = null;
- __httpRequest.Dispose();
- __httpRequest = null;
- await global::OpenRouter.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- retryDelay: __retryDelay,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- continue;
- }
-
- break;
- }
-
- if (__response == null)
- {
- throw new global::System.InvalidOperationException("No response received.");
- }
-
- using (__response)
- {
-
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessProvisionInternResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- if (__response.IsSuccessStatusCode)
- {
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "ProvisionIntern",
- methodName: "ProvisionInternAsync",
- pathTemplate: "$\"/interns/{internId}/provision\"",
- httpMethod: "POST",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attemptNumber,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- }
- else
- {
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "ProvisionIntern",
- methodName: "ProvisionInternAsync",
- pathTemplate: "$\"/interns/{internId}/provision\"",
- httpMethod: "POST",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attemptNumber,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- }
- // The request body is invalid.
- if ((int)__response.StatusCode == 400)
- {
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::OpenRouter.InternLifecycleError? __value_400 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_400 = global::OpenRouter.InternLifecycleError.FromJson(__content_400, JsonSerializerContext);
- }
- else
- {
- __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_400 = global::OpenRouter.InternLifecycleError.FromJson(__content_400, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- responseBody: __content_400,
- responseObject: __value_400,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // Missing, unknown or provisioning API key.
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::OpenRouter.InternLifecycleError? __value_401 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_401 = global::OpenRouter.InternLifecycleError.FromJson(__content_401, JsonSerializerContext);
- }
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_401 = global::OpenRouter.InternLifecycleError.FromJson(__content_401, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_401 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- responseBody: __content_401,
- responseObject: __value_401,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The key owner no longer has access, the request used a regional hostname, or lifecycle writes are not enabled for the caller (`metadata.reason` is `lifecycle_writes_disabled`).
- if ((int)__response.StatusCode == 403)
- {
- string? __content_403 = null;
- global::System.Exception? __exception_403 = null;
- global::OpenRouter.InternLifecycleError? __value_403 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_403 = global::OpenRouter.InternLifecycleError.FromJson(__content_403, JsonSerializerContext);
- }
- else
- {
- __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_403 = global::OpenRouter.InternLifecycleError.FromJson(__content_403, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_403 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_403,
- responseBody: __content_403,
- responseObject: __value_403,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The caller is outside the Intern API programme, or the intern is hidden.
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::OpenRouter.InternLifecycleError? __value_404 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_404 = global::OpenRouter.InternLifecycleError.FromJson(__content_404, JsonSerializerContext);
- }
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_404 = global::OpenRouter.InternLifecycleError.FromJson(__content_404, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_404 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- responseBody: __content_404,
- responseObject: __value_404,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The request exceeded its route deadline. The deadline quoted in the message is the route's own, so it differs between operations.
- if ((int)__response.StatusCode == 408)
- {
- string? __content_408 = null;
- global::System.Exception? __exception_408 = null;
- global::OpenRouter.InternLifecycleError? __value_408 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_408 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_408 = global::OpenRouter.InternLifecycleError.FromJson(__content_408, JsonSerializerContext);
- }
- else
- {
- __content_408 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_408 = global::OpenRouter.InternLifecycleError.FromJson(__content_408, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_408 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_408 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_408,
- responseBody: __content_408,
- responseObject: __value_408,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The intern is not in a state that allows this operation. `metadata.reason` says whether to try again: `intern_busy` means another operation still holds the intern and carries `metadata.retryable: true`, so the same request may be sent again once it settles. A duplicate delete of an intern already being deleted is not a conflict and is accepted with 202.
- if ((int)__response.StatusCode == 409)
- {
- string? __content_409 = null;
- global::System.Exception? __exception_409 = null;
- global::OpenRouter.InternLifecycleError? __value_409 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_409 = global::OpenRouter.InternLifecycleError.FromJson(__content_409, JsonSerializerContext);
- }
- else
- {
- __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_409 = global::OpenRouter.InternLifecycleError.FromJson(__content_409, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_409 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_409 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_409,
- responseBody: __content_409,
- responseObject: __value_409,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The request body is larger than 1048576 bytes.
- if ((int)__response.StatusCode == 413)
- {
- string? __content_413 = null;
- global::System.Exception? __exception_413 = null;
- global::OpenRouter.InternLifecycleError? __value_413 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_413 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_413 = global::OpenRouter.InternLifecycleError.FromJson(__content_413, JsonSerializerContext);
- }
- else
- {
- __content_413 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_413 = global::OpenRouter.InternLifecycleError.FromJson(__content_413, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_413 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_413 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_413,
- responseBody: __content_413,
- responseObject: __value_413,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The request body is non-empty and its Content-Type is not application/json.
- if ((int)__response.StatusCode == 415)
- {
- string? __content_415 = null;
- global::System.Exception? __exception_415 = null;
- global::OpenRouter.InternLifecycleError? __value_415 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_415 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_415 = global::OpenRouter.InternLifecycleError.FromJson(__content_415, JsonSerializerContext);
- }
- else
- {
- __content_415 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_415 = global::OpenRouter.InternLifecycleError.FromJson(__content_415, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_415 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_415 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_415,
- responseBody: __content_415,
- responseObject: __value_415,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The request could not be completed. `metadata.reason` says whether to try again: `internal_error` is a transient failure and carries `metadata.retryable: true`, so the same request may be sent again, while `configuration_error` carries `retryable: false` because the next attempt reads the same missing binding or unusable stored credential.
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::OpenRouter.InternLifecycleError? __value_500 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_500 = global::OpenRouter.InternLifecycleError.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_500 = global::OpenRouter.InternLifecycleError.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- responseBody: __content_500,
- responseObject: __value_500,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The intern service could not accept the operation.
- if ((int)__response.StatusCode == 502)
- {
- string? __content_502 = null;
- global::System.Exception? __exception_502 = null;
- global::OpenRouter.InternLifecycleError? __value_502 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_502 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_502 = global::OpenRouter.InternLifecycleError.FromJson(__content_502, JsonSerializerContext);
- }
- else
- {
- __content_502 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_502 = global::OpenRouter.InternLifecycleError.FromJson(__content_502, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_502 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_502 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_502,
- responseBody: __content_502,
- responseObject: __value_502,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
-
- if (__effectiveReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
-
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessProvisionInternResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
- {
- __response.EnsureSuccessStatusCode();
-
- var __value = global::OpenRouter.ProvisionInternResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- return new global::OpenRouter.AutoSDKHttpResponse(
- statusCode: __response.StatusCode,
- headers: global::OpenRouter.AutoSDKHttpResponse.CreateHeaders(__response),
- requestUri: __response.RequestMessage?.RequestUri,
- body: __value);
- }
- catch (global::System.Exception __ex)
- {
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- responseBody: __content,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
-
- var __value = await global::OpenRouter.ProvisionInternResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- return new global::OpenRouter.AutoSDKHttpResponse(
- statusCode: __response.StatusCode,
- headers: global::OpenRouter.AutoSDKHttpResponse.CreateHeaders(__response),
- requestUri: __response.RequestMessage?.RequestUri,
- body: __value);
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- responseBody: __content,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- }
-
- }
- }
- finally
- {
- __httpRequest?.Dispose();
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/libs/OpenRouter/Generated/OpenRouter.InternsClient.SignInternDaemonRequest.g.cs b/src/libs/OpenRouter/Generated/OpenRouter.InternsClient.SignInternDaemonRequest.g.cs
deleted file mode 100644
index aeef5be8..00000000
--- a/src/libs/OpenRouter/Generated/OpenRouter.InternsClient.SignInternDaemonRequest.g.cs
+++ /dev/null
@@ -1,824 +0,0 @@
-
-#nullable enable
-
-namespace OpenRouter
-{
- public partial class InternsClient
- {
-
-
- private static readonly global::OpenRouter.EndPointSecurityRequirement s_SignInternDaemonRequestSecurityRequirement0 =
- new global::OpenRouter.EndPointSecurityRequirement
- {
- Authorizations = new global::OpenRouter.EndPointAuthorizationRequirement[]
- { new global::OpenRouter.EndPointAuthorizationRequirement
- {
- Type = "Http",
- SchemeId = "Bearer",
- Location = "Header",
- Name = "Bearer",
- FriendlyName = "Bearer",
- },
- },
- };
- private static readonly global::OpenRouter.EndPointSecurityRequirement[] s_SignInternDaemonRequestSecurityRequirements =
- new global::OpenRouter.EndPointSecurityRequirement[]
- { s_SignInternDaemonRequestSecurityRequirement0,
- };
- partial void PrepareSignInternDaemonRequestArguments(
- global::System.Net.Http.HttpClient httpClient,
- ref string internId,
- global::OpenRouter.SignInternDaemonRequest request);
- partial void PrepareSignInternDaemonRequestRequest(
- global::System.Net.Http.HttpClient httpClient,
- global::System.Net.Http.HttpRequestMessage httpRequestMessage,
- string internId,
- global::OpenRouter.SignInternDaemonRequest request);
- partial void ProcessSignInternDaemonRequestResponse(
- global::System.Net.Http.HttpClient httpClient,
- global::System.Net.Http.HttpResponseMessage httpResponseMessage);
-
- partial void ProcessSignInternDaemonRequestResponseContent(
- global::System.Net.Http.HttpClient httpClient,
- global::System.Net.Http.HttpResponseMessage httpResponseMessage,
- ref string content);
-
- ///
- /// Sign a daemon request with the caller's identity
- /// Signs the SHA-256 digest of one request the CLI is about to send to the intern daemon, binding it to the intern and to the signed-in member so personal connections resolve. Only an OAuth session from `ori login --oidc` whose grant carries `vault:read` can sign: an API key is refused with 403 because it names no person, and an `interns`-only grant is refused with 403 because a proof releases that user's personal connections. The route is behind the same gate as chat and counts against the chat turn limiter. The response is sent with `Cache-Control: no-store`. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// ID of an intern visible to the authenticated API key.
- /// Example: 7c9e6679-7425-40de-944b-e07fc1f90ae7
- ///
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- public async global::System.Threading.Tasks.Task SignInternDaemonRequestAsync(
- string internId,
-
- global::OpenRouter.SignInternDaemonRequest request,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default)
- {
- var __response = await SignInternDaemonRequestAsResponseAsync(
- internId: internId,
-
- request: request,
- requestOptions: requestOptions,
- cancellationToken: cancellationToken
- ).ConfigureAwait(false);
-
- return __response.Body;
- }
- ///
- /// Sign a daemon request with the caller's identity
- /// Signs the SHA-256 digest of one request the CLI is about to send to the intern daemon, binding it to the intern and to the signed-in member so personal connections resolve. Only an OAuth session from `ori login --oidc` whose grant carries `vault:read` can sign: an API key is refused with 403 because it names no person, and an `interns`-only grant is refused with 403 because a proof releases that user's personal connections. The route is behind the same gate as chat and counts against the chat turn limiter. The response is sent with `Cache-Control: no-store`. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// ID of an intern visible to the authenticated API key.
- /// Example: 7c9e6679-7425-40de-944b-e07fc1f90ae7
- ///
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- public async global::System.Threading.Tasks.Task> SignInternDaemonRequestAsResponseAsync(
- string internId,
-
- global::OpenRouter.SignInternDaemonRequest request,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default)
- {
- request = request ?? throw new global::System.ArgumentNullException(nameof(request));
-
- PrepareArguments(
- client: HttpClient);
- PrepareSignInternDaemonRequestArguments(
- httpClient: HttpClient,
- internId: ref internId,
- request: request);
-
-
- var __authorizations = global::OpenRouter.EndPointSecurityResolver.ResolveAuthorizations(
- availableAuthorizations: Authorizations,
- securityRequirements: s_SignInternDaemonRequestSecurityRequirements,
- operationName: "SignInternDaemonRequestAsync");
-
- using var __timeoutCancellationTokenSource = global::OpenRouter.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
- clientOptions: Options,
- requestOptions: requestOptions,
- cancellationToken: cancellationToken);
- var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
- var __effectiveReadResponseAsString = global::OpenRouter.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
- clientOptions: Options,
- requestOptions: requestOptions,
- fallbackValue: ReadResponseAsString);
- var __maxAttempts = global::OpenRouter.AutoSDKRequestOptionsSupport.GetMaxAttempts(
- clientOptions: Options,
- requestOptions: requestOptions,
- supportsRetry: true);
-
- global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
- {
-
- var __pathBuilder = new global::OpenRouter.PathBuilder(
- path: $"/interns/{internId}/daemon/sign",
- baseUri: HttpClient.BaseAddress ?? new global::System.Uri("https://openrouter.ai/api/v1", global::System.UriKind.RelativeOrAbsolute));
- var __path = __pathBuilder.ToString();
- __path = global::OpenRouter.AutoSDKRequestOptionsSupport.AppendQueryParameters(
- path: __path,
- clientParameters: Options.QueryParameters,
- requestParameters: requestOptions?.QueryParameters);
- var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
-#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
-#endif
-
- foreach (var __authorization in __authorizations)
- {
- if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2" ||
- __authorization.Type == "OpenIdConnect")
- {
- __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
- scheme: __authorization.Name,
- parameter: __authorization.Value);
- }
- else if (__authorization.Type == "ApiKey" &&
- __authorization.Location == "Header")
- {
- __httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
- }
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
- global::OpenRouter.AutoSDKRequestOptionsSupport.ApplyHeaders(
- request: __httpRequest,
- clientHeaders: Options.Headers,
- requestHeaders: requestOptions?.Headers);
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareSignInternDaemonRequestRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- internId: internId,
- request: request);
-
- global::OpenRouter.AutoSDKHttpRequestOptions.StampAuthorizationOverride(__httpRequest);
-
- return __httpRequest;
- }
-
- global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
- global::System.Net.Http.HttpResponseMessage? __response = null;
- var __attemptNumber = 0;
- try
- {
- for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
- {
- __attemptNumber = __attempt;
- __httpRequest = __CreateHttpRequest();
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "SignInternDaemonRequest",
- methodName: "SignInternDaemonRequestAsync",
- pathTemplate: "$\"/interns/{internId}/daemon/sign\"",
- httpMethod: "POST",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: null,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- try
- {
- __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- }
- catch (global::System.Net.Http.HttpRequestException __exception)
- {
- var __retryDelay = global::OpenRouter.AutoSDKRequestOptionsSupport.GetRetryDelay(
- clientOptions: Options,
- requestOptions: requestOptions,
- response: null,
- attempt: __attempt);
- var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "SignInternDaemonRequest",
- methodName: "SignInternDaemonRequestAsync",
- pathTemplate: "$\"/interns/{internId}/daemon/sign\"",
- httpMethod: "POST",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: null,
- exception: __exception,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: __willRetry,
- retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
- retryReason: "exception",
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- if (!__willRetry)
- {
- throw;
- }
-
- __httpRequest.Dispose();
- __httpRequest = null;
- await global::OpenRouter.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- retryDelay: __retryDelay,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- continue;
- }
-
- if (__response != null &&
- __attempt < __maxAttempts &&
- global::OpenRouter.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
- {
- var __retryDelay = global::OpenRouter.AutoSDKRequestOptionsSupport.GetRetryDelay(
- clientOptions: Options,
- requestOptions: requestOptions,
- response: __response,
- attempt: __attempt);
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "SignInternDaemonRequest",
- methodName: "SignInternDaemonRequestAsync",
- pathTemplate: "$\"/interns/{internId}/daemon/sign\"",
- httpMethod: "POST",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: true,
- retryDelay: __retryDelay,
- retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- __response.Dispose();
- __response = null;
- __httpRequest.Dispose();
- __httpRequest = null;
- await global::OpenRouter.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- retryDelay: __retryDelay,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- continue;
- }
-
- break;
- }
-
- if (__response == null)
- {
- throw new global::System.InvalidOperationException("No response received.");
- }
-
- using (__response)
- {
-
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessSignInternDaemonRequestResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- if (__response.IsSuccessStatusCode)
- {
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "SignInternDaemonRequest",
- methodName: "SignInternDaemonRequestAsync",
- pathTemplate: "$\"/interns/{internId}/daemon/sign\"",
- httpMethod: "POST",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attemptNumber,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- }
- else
- {
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "SignInternDaemonRequest",
- methodName: "SignInternDaemonRequestAsync",
- pathTemplate: "$\"/interns/{internId}/daemon/sign\"",
- httpMethod: "POST",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attemptNumber,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- }
- // The request body is invalid.
- if ((int)__response.StatusCode == 400)
- {
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::OpenRouter.InternLifecycleError? __value_400 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_400 = global::OpenRouter.InternLifecycleError.FromJson(__content_400, JsonSerializerContext);
- }
- else
- {
- __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_400 = global::OpenRouter.InternLifecycleError.FromJson(__content_400, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- responseBody: __content_400,
- responseObject: __value_400,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // Missing, unknown or provisioning API key.
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::OpenRouter.InternLifecycleError? __value_401 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_401 = global::OpenRouter.InternLifecycleError.FromJson(__content_401, JsonSerializerContext);
- }
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_401 = global::OpenRouter.InternLifecycleError.FromJson(__content_401, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_401 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- responseBody: __content_401,
- responseObject: __value_401,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The caller is an API key, which names no person (`personal_identity_required`), or an OAuth grant without `vault:read` (`insufficient_scope`). Also returned when the key owner no longer has access or the request used a regional hostname.
- if ((int)__response.StatusCode == 403)
- {
- string? __content_403 = null;
- global::System.Exception? __exception_403 = null;
- global::OpenRouter.InternLifecycleError? __value_403 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_403 = global::OpenRouter.InternLifecycleError.FromJson(__content_403, JsonSerializerContext);
- }
- else
- {
- __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_403 = global::OpenRouter.InternLifecycleError.FromJson(__content_403, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_403 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_403,
- responseBody: __content_403,
- responseObject: __value_403,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The caller is outside the Intern API programme, or the intern is hidden.
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::OpenRouter.InternLifecycleError? __value_404 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_404 = global::OpenRouter.InternLifecycleError.FromJson(__content_404, JsonSerializerContext);
- }
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_404 = global::OpenRouter.InternLifecycleError.FromJson(__content_404, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_404 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- responseBody: __content_404,
- responseObject: __value_404,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The request exceeded its route deadline. The deadline quoted in the message is the route's own, so it differs between operations.
- if ((int)__response.StatusCode == 408)
- {
- string? __content_408 = null;
- global::System.Exception? __exception_408 = null;
- global::OpenRouter.InternLifecycleError? __value_408 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_408 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_408 = global::OpenRouter.InternLifecycleError.FromJson(__content_408, JsonSerializerContext);
- }
- else
- {
- __content_408 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_408 = global::OpenRouter.InternLifecycleError.FromJson(__content_408, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_408 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_408 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_408,
- responseBody: __content_408,
- responseObject: __value_408,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The request body is larger than 1048576 bytes.
- if ((int)__response.StatusCode == 413)
- {
- string? __content_413 = null;
- global::System.Exception? __exception_413 = null;
- global::OpenRouter.InternLifecycleError? __value_413 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_413 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_413 = global::OpenRouter.InternLifecycleError.FromJson(__content_413, JsonSerializerContext);
- }
- else
- {
- __content_413 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_413 = global::OpenRouter.InternLifecycleError.FromJson(__content_413, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_413 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_413 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_413,
- responseBody: __content_413,
- responseObject: __value_413,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The request body is non-empty and its Content-Type is not application/json.
- if ((int)__response.StatusCode == 415)
- {
- string? __content_415 = null;
- global::System.Exception? __exception_415 = null;
- global::OpenRouter.InternLifecycleError? __value_415 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_415 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_415 = global::OpenRouter.InternLifecycleError.FromJson(__content_415, JsonSerializerContext);
- }
- else
- {
- __content_415 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_415 = global::OpenRouter.InternLifecycleError.FromJson(__content_415, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_415 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_415 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_415,
- responseBody: __content_415,
- responseObject: __value_415,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // Too many turns for the user or organization this credential acts as (`rate_limited`). Shares the chat turn limiter, reports `retryable: true` and carries `Retry-After`.
- if ((int)__response.StatusCode == 429)
- {
- string? __content_429 = null;
- global::System.Exception? __exception_429 = null;
- global::OpenRouter.InternLifecycleError? __value_429 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_429 = global::OpenRouter.InternLifecycleError.FromJson(__content_429, JsonSerializerContext);
- }
- else
- {
- __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_429 = global::OpenRouter.InternLifecycleError.FromJson(__content_429, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_429 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_429,
- responseBody: __content_429,
- responseObject: __value_429,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The request could not be completed. `metadata.reason` says whether to try again: `internal_error` is a transient failure and carries `metadata.retryable: true`, so the same request may be sent again, while `configuration_error` carries `retryable: false` because the next attempt reads the same missing binding or unusable stored credential.
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::OpenRouter.InternLifecycleError? __value_500 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_500 = global::OpenRouter.InternLifecycleError.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_500 = global::OpenRouter.InternLifecycleError.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- responseBody: __content_500,
- responseObject: __value_500,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
-
- if (__effectiveReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
-
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessSignInternDaemonRequestResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
- {
- __response.EnsureSuccessStatusCode();
-
- var __value = global::OpenRouter.SignInternDaemonResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- return new global::OpenRouter.AutoSDKHttpResponse(
- statusCode: __response.StatusCode,
- headers: global::OpenRouter.AutoSDKHttpResponse.CreateHeaders(__response),
- requestUri: __response.RequestMessage?.RequestUri,
- body: __value);
- }
- catch (global::System.Exception __ex)
- {
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- responseBody: __content,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
-
- var __value = await global::OpenRouter.SignInternDaemonResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- return new global::OpenRouter.AutoSDKHttpResponse(
- statusCode: __response.StatusCode,
- headers: global::OpenRouter.AutoSDKHttpResponse.CreateHeaders(__response),
- requestUri: __response.RequestMessage?.RequestUri,
- body: __value);
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- responseBody: __content,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- }
-
- }
- }
- finally
- {
- __httpRequest?.Dispose();
- }
- }
- ///
- /// Sign a daemon request with the caller's identity
- /// Signs the SHA-256 digest of one request the CLI is about to send to the intern daemon, binding it to the intern and to the signed-in member so personal connections resolve. Only an OAuth session from `ori login --oidc` whose grant carries `vault:read` can sign: an API key is refused with 403 because it names no person, and an `interns`-only grant is refused with 403 because a proof releases that user's personal connections. The route is behind the same gate as chat and counts against the chat turn limiter. The response is sent with `Cache-Control: no-store`. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// ID of an intern visible to the authenticated API key.
- /// Example: 7c9e6679-7425-40de-944b-e07fc1f90ae7
- ///
- ///
- /// Lower-case hex SHA-256 of the exact bytes the CLI will send as the daemon request body.
- /// Example: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
- ///
- ///
- /// The daemon request the proof is for. When present the response also carries the single-use, route-bound proof (`x-ori-invoke-signature-v2`, `x-ori-invoke-nonce`).
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- public async global::System.Threading.Tasks.Task SignInternDaemonRequestAsync(
- string internId,
- string bodySha256,
- global::OpenRouter.SignInternDaemonRequestRoute? route = default,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default)
- {
- var __request = new global::OpenRouter.SignInternDaemonRequest
- {
- BodySha256 = bodySha256,
- Route = route,
- };
-
- return await SignInternDaemonRequestAsync(
- internId: internId,
- request: __request,
- requestOptions: requestOptions,
- cancellationToken: cancellationToken).ConfigureAwait(false);
- }
- }
-}
\ No newline at end of file
diff --git a/src/libs/OpenRouter/Generated/OpenRouter.InternsClient.SuspendIntern.g.cs b/src/libs/OpenRouter/Generated/OpenRouter.InternsClient.SuspendIntern.g.cs
deleted file mode 100644
index 662059e4..00000000
--- a/src/libs/OpenRouter/Generated/OpenRouter.InternsClient.SuspendIntern.g.cs
+++ /dev/null
@@ -1,804 +0,0 @@
-
-#nullable enable
-
-namespace OpenRouter
-{
- public partial class InternsClient
- {
-
-
- private static readonly global::OpenRouter.EndPointSecurityRequirement s_SuspendInternSecurityRequirement0 =
- new global::OpenRouter.EndPointSecurityRequirement
- {
- Authorizations = new global::OpenRouter.EndPointAuthorizationRequirement[]
- { new global::OpenRouter.EndPointAuthorizationRequirement
- {
- Type = "Http",
- SchemeId = "Bearer",
- Location = "Header",
- Name = "Bearer",
- FriendlyName = "Bearer",
- },
- },
- };
- private static readonly global::OpenRouter.EndPointSecurityRequirement[] s_SuspendInternSecurityRequirements =
- new global::OpenRouter.EndPointSecurityRequirement[]
- { s_SuspendInternSecurityRequirement0,
- };
- partial void PrepareSuspendInternArguments(
- global::System.Net.Http.HttpClient httpClient,
- ref string internId);
- partial void PrepareSuspendInternRequest(
- global::System.Net.Http.HttpClient httpClient,
- global::System.Net.Http.HttpRequestMessage httpRequestMessage,
- string internId);
- partial void ProcessSuspendInternResponse(
- global::System.Net.Http.HttpClient httpClient,
- global::System.Net.Http.HttpResponseMessage httpResponseMessage);
-
- partial void ProcessSuspendInternResponseContent(
- global::System.Net.Http.HttpClient httpClient,
- global::System.Net.Http.HttpResponseMessage httpResponseMessage,
- ref string content);
-
- ///
- /// Suspend an intern
- /// Stops the intern runtime while keeping its disk and configuration for a later provision call. This operation takes no request body. A body carrying any field is refused with 400 rather than ignored. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// ID of an intern visible to the authenticated API key.
- /// Example: 7c9e6679-7425-40de-944b-e07fc1f90ae7
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- public async global::System.Threading.Tasks.Task SuspendInternAsync(
- string internId,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default)
- {
- var __response = await SuspendInternAsResponseAsync(
- internId: internId,
- requestOptions: requestOptions,
- cancellationToken: cancellationToken
- ).ConfigureAwait(false);
-
- return __response.Body;
- }
- ///
- /// Suspend an intern
- /// Stops the intern runtime while keeping its disk and configuration for a later provision call. This operation takes no request body. A body carrying any field is refused with 400 rather than ignored. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// ID of an intern visible to the authenticated API key.
- /// Example: 7c9e6679-7425-40de-944b-e07fc1f90ae7
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- public async global::System.Threading.Tasks.Task> SuspendInternAsResponseAsync(
- string internId,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default)
- {
- PrepareArguments(
- client: HttpClient);
- PrepareSuspendInternArguments(
- httpClient: HttpClient,
- internId: ref internId);
-
-
- var __authorizations = global::OpenRouter.EndPointSecurityResolver.ResolveAuthorizations(
- availableAuthorizations: Authorizations,
- securityRequirements: s_SuspendInternSecurityRequirements,
- operationName: "SuspendInternAsync");
-
- using var __timeoutCancellationTokenSource = global::OpenRouter.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
- clientOptions: Options,
- requestOptions: requestOptions,
- cancellationToken: cancellationToken);
- var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
- var __effectiveReadResponseAsString = global::OpenRouter.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
- clientOptions: Options,
- requestOptions: requestOptions,
- fallbackValue: ReadResponseAsString);
- var __maxAttempts = global::OpenRouter.AutoSDKRequestOptionsSupport.GetMaxAttempts(
- clientOptions: Options,
- requestOptions: requestOptions,
- supportsRetry: true);
-
- global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
- {
-
- var __pathBuilder = new global::OpenRouter.PathBuilder(
- path: $"/interns/{internId}/suspend",
- baseUri: HttpClient.BaseAddress ?? new global::System.Uri("https://openrouter.ai/api/v1", global::System.UriKind.RelativeOrAbsolute));
- var __path = __pathBuilder.ToString();
- __path = global::OpenRouter.AutoSDKRequestOptionsSupport.AppendQueryParameters(
- path: __path,
- clientParameters: Options.QueryParameters,
- requestParameters: requestOptions?.QueryParameters);
- var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
-#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
-#endif
-
- foreach (var __authorization in __authorizations)
- {
- if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2" ||
- __authorization.Type == "OpenIdConnect")
- {
- __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
- scheme: __authorization.Name,
- parameter: __authorization.Value);
- }
- else if (__authorization.Type == "ApiKey" &&
- __authorization.Location == "Header")
- {
- __httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
- }
- global::OpenRouter.AutoSDKRequestOptionsSupport.ApplyHeaders(
- request: __httpRequest,
- clientHeaders: Options.Headers,
- requestHeaders: requestOptions?.Headers);
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareSuspendInternRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- internId: internId);
-
- global::OpenRouter.AutoSDKHttpRequestOptions.StampAuthorizationOverride(__httpRequest);
-
- return __httpRequest;
- }
-
- global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
- global::System.Net.Http.HttpResponseMessage? __response = null;
- var __attemptNumber = 0;
- try
- {
- for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
- {
- __attemptNumber = __attempt;
- __httpRequest = __CreateHttpRequest();
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "SuspendIntern",
- methodName: "SuspendInternAsync",
- pathTemplate: "$\"/interns/{internId}/suspend\"",
- httpMethod: "POST",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: null,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- try
- {
- __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- }
- catch (global::System.Net.Http.HttpRequestException __exception)
- {
- var __retryDelay = global::OpenRouter.AutoSDKRequestOptionsSupport.GetRetryDelay(
- clientOptions: Options,
- requestOptions: requestOptions,
- response: null,
- attempt: __attempt);
- var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "SuspendIntern",
- methodName: "SuspendInternAsync",
- pathTemplate: "$\"/interns/{internId}/suspend\"",
- httpMethod: "POST",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: null,
- exception: __exception,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: __willRetry,
- retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
- retryReason: "exception",
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- if (!__willRetry)
- {
- throw;
- }
-
- __httpRequest.Dispose();
- __httpRequest = null;
- await global::OpenRouter.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- retryDelay: __retryDelay,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- continue;
- }
-
- if (__response != null &&
- __attempt < __maxAttempts &&
- global::OpenRouter.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
- {
- var __retryDelay = global::OpenRouter.AutoSDKRequestOptionsSupport.GetRetryDelay(
- clientOptions: Options,
- requestOptions: requestOptions,
- response: __response,
- attempt: __attempt);
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "SuspendIntern",
- methodName: "SuspendInternAsync",
- pathTemplate: "$\"/interns/{internId}/suspend\"",
- httpMethod: "POST",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: true,
- retryDelay: __retryDelay,
- retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- __response.Dispose();
- __response = null;
- __httpRequest.Dispose();
- __httpRequest = null;
- await global::OpenRouter.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- retryDelay: __retryDelay,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- continue;
- }
-
- break;
- }
-
- if (__response == null)
- {
- throw new global::System.InvalidOperationException("No response received.");
- }
-
- using (__response)
- {
-
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessSuspendInternResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- if (__response.IsSuccessStatusCode)
- {
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "SuspendIntern",
- methodName: "SuspendInternAsync",
- pathTemplate: "$\"/interns/{internId}/suspend\"",
- httpMethod: "POST",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attemptNumber,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- }
- else
- {
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "SuspendIntern",
- methodName: "SuspendInternAsync",
- pathTemplate: "$\"/interns/{internId}/suspend\"",
- httpMethod: "POST",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attemptNumber,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- }
- // The request body is invalid.
- if ((int)__response.StatusCode == 400)
- {
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::OpenRouter.InternLifecycleError? __value_400 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_400 = global::OpenRouter.InternLifecycleError.FromJson(__content_400, JsonSerializerContext);
- }
- else
- {
- __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_400 = global::OpenRouter.InternLifecycleError.FromJson(__content_400, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- responseBody: __content_400,
- responseObject: __value_400,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // Missing, unknown or provisioning API key.
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::OpenRouter.InternLifecycleError? __value_401 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_401 = global::OpenRouter.InternLifecycleError.FromJson(__content_401, JsonSerializerContext);
- }
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_401 = global::OpenRouter.InternLifecycleError.FromJson(__content_401, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_401 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- responseBody: __content_401,
- responseObject: __value_401,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The key owner no longer has access, the request used a regional hostname, or lifecycle writes are not enabled for the caller (`metadata.reason` is `lifecycle_writes_disabled`).
- if ((int)__response.StatusCode == 403)
- {
- string? __content_403 = null;
- global::System.Exception? __exception_403 = null;
- global::OpenRouter.InternLifecycleError? __value_403 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_403 = global::OpenRouter.InternLifecycleError.FromJson(__content_403, JsonSerializerContext);
- }
- else
- {
- __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_403 = global::OpenRouter.InternLifecycleError.FromJson(__content_403, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_403 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_403,
- responseBody: __content_403,
- responseObject: __value_403,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The caller is outside the Intern API programme, or the intern is hidden.
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::OpenRouter.InternLifecycleError? __value_404 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_404 = global::OpenRouter.InternLifecycleError.FromJson(__content_404, JsonSerializerContext);
- }
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_404 = global::OpenRouter.InternLifecycleError.FromJson(__content_404, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_404 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- responseBody: __content_404,
- responseObject: __value_404,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The request exceeded its route deadline. The deadline quoted in the message is the route's own, so it differs between operations.
- if ((int)__response.StatusCode == 408)
- {
- string? __content_408 = null;
- global::System.Exception? __exception_408 = null;
- global::OpenRouter.InternLifecycleError? __value_408 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_408 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_408 = global::OpenRouter.InternLifecycleError.FromJson(__content_408, JsonSerializerContext);
- }
- else
- {
- __content_408 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_408 = global::OpenRouter.InternLifecycleError.FromJson(__content_408, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_408 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_408 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_408,
- responseBody: __content_408,
- responseObject: __value_408,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The intern is not in a state that allows this operation. `metadata.reason` says whether to try again: `intern_busy` means another operation still holds the intern and carries `metadata.retryable: true`, so the same request may be sent again once it settles. A duplicate delete of an intern already being deleted is not a conflict and is accepted with 202.
- if ((int)__response.StatusCode == 409)
- {
- string? __content_409 = null;
- global::System.Exception? __exception_409 = null;
- global::OpenRouter.InternLifecycleError? __value_409 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_409 = global::OpenRouter.InternLifecycleError.FromJson(__content_409, JsonSerializerContext);
- }
- else
- {
- __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_409 = global::OpenRouter.InternLifecycleError.FromJson(__content_409, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_409 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_409 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_409,
- responseBody: __content_409,
- responseObject: __value_409,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The request body is larger than 1048576 bytes.
- if ((int)__response.StatusCode == 413)
- {
- string? __content_413 = null;
- global::System.Exception? __exception_413 = null;
- global::OpenRouter.InternLifecycleError? __value_413 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_413 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_413 = global::OpenRouter.InternLifecycleError.FromJson(__content_413, JsonSerializerContext);
- }
- else
- {
- __content_413 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_413 = global::OpenRouter.InternLifecycleError.FromJson(__content_413, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_413 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_413 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_413,
- responseBody: __content_413,
- responseObject: __value_413,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The request body is non-empty and its Content-Type is not application/json.
- if ((int)__response.StatusCode == 415)
- {
- string? __content_415 = null;
- global::System.Exception? __exception_415 = null;
- global::OpenRouter.InternLifecycleError? __value_415 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_415 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_415 = global::OpenRouter.InternLifecycleError.FromJson(__content_415, JsonSerializerContext);
- }
- else
- {
- __content_415 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_415 = global::OpenRouter.InternLifecycleError.FromJson(__content_415, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_415 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_415 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_415,
- responseBody: __content_415,
- responseObject: __value_415,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The request could not be completed. `metadata.reason` says whether to try again: `internal_error` is a transient failure and carries `metadata.retryable: true`, so the same request may be sent again, while `configuration_error` carries `retryable: false` because the next attempt reads the same missing binding or unusable stored credential.
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::OpenRouter.InternLifecycleError? __value_500 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_500 = global::OpenRouter.InternLifecycleError.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_500 = global::OpenRouter.InternLifecycleError.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- responseBody: __content_500,
- responseObject: __value_500,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The intern service could not accept the operation.
- if ((int)__response.StatusCode == 502)
- {
- string? __content_502 = null;
- global::System.Exception? __exception_502 = null;
- global::OpenRouter.InternLifecycleError? __value_502 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_502 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_502 = global::OpenRouter.InternLifecycleError.FromJson(__content_502, JsonSerializerContext);
- }
- else
- {
- __content_502 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_502 = global::OpenRouter.InternLifecycleError.FromJson(__content_502, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_502 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_502 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_502,
- responseBody: __content_502,
- responseObject: __value_502,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
-
- if (__effectiveReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
-
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessSuspendInternResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
- {
- __response.EnsureSuccessStatusCode();
-
- var __value = global::OpenRouter.SuspendInternResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- return new global::OpenRouter.AutoSDKHttpResponse(
- statusCode: __response.StatusCode,
- headers: global::OpenRouter.AutoSDKHttpResponse.CreateHeaders(__response),
- requestUri: __response.RequestMessage?.RequestUri,
- body: __value);
- }
- catch (global::System.Exception __ex)
- {
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- responseBody: __content,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
-
- var __value = await global::OpenRouter.SuspendInternResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- return new global::OpenRouter.AutoSDKHttpResponse(
- statusCode: __response.StatusCode,
- headers: global::OpenRouter.AutoSDKHttpResponse.CreateHeaders(__response),
- requestUri: __response.RequestMessage?.RequestUri,
- body: __value);
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- responseBody: __content,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- }
-
- }
- }
- finally
- {
- __httpRequest?.Dispose();
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/libs/OpenRouter/Generated/OpenRouter.InternsClient.UpdateIntern.g.cs b/src/libs/OpenRouter/Generated/OpenRouter.InternsClient.UpdateIntern.g.cs
deleted file mode 100644
index 3d6d301c..00000000
--- a/src/libs/OpenRouter/Generated/OpenRouter.InternsClient.UpdateIntern.g.cs
+++ /dev/null
@@ -1,833 +0,0 @@
-
-#nullable enable
-
-namespace OpenRouter
-{
- public partial class InternsClient
- {
-
-
- private static readonly global::OpenRouter.EndPointSecurityRequirement s_UpdateInternSecurityRequirement0 =
- new global::OpenRouter.EndPointSecurityRequirement
- {
- Authorizations = new global::OpenRouter.EndPointAuthorizationRequirement[]
- { new global::OpenRouter.EndPointAuthorizationRequirement
- {
- Type = "Http",
- SchemeId = "Bearer",
- Location = "Header",
- Name = "Bearer",
- FriendlyName = "Bearer",
- },
- },
- };
- private static readonly global::OpenRouter.EndPointSecurityRequirement[] s_UpdateInternSecurityRequirements =
- new global::OpenRouter.EndPointSecurityRequirement[]
- { s_UpdateInternSecurityRequirement0,
- };
- partial void PrepareUpdateInternArguments(
- global::System.Net.Http.HttpClient httpClient,
- ref string internId,
- global::OpenRouter.UpdateInternRequest request);
- partial void PrepareUpdateInternRequest(
- global::System.Net.Http.HttpClient httpClient,
- global::System.Net.Http.HttpRequestMessage httpRequestMessage,
- string internId,
- global::OpenRouter.UpdateInternRequest request);
- partial void ProcessUpdateInternResponse(
- global::System.Net.Http.HttpClient httpClient,
- global::System.Net.Http.HttpResponseMessage httpResponseMessage);
-
- partial void ProcessUpdateInternResponseContent(
- global::System.Net.Http.HttpClient httpClient,
- global::System.Net.Http.HttpResponseMessage httpResponseMessage,
- ref string content);
-
- ///
- /// Update an intern
- /// Changes the intern name, description, instructions or model. Omitted fields stay unchanged. The request body is capped at 1048576 bytes and a larger body is refused with 413. A non-empty body must declare `Content-Type: application/json` or it is refused with 415. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// ID of an intern visible to the authenticated API key.
- /// Example: 7c9e6679-7425-40de-944b-e07fc1f90ae7
- ///
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- public async global::System.Threading.Tasks.Task UpdateInternAsync(
- string internId,
-
- global::OpenRouter.UpdateInternRequest request,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default)
- {
- var __response = await UpdateInternAsResponseAsync(
- internId: internId,
-
- request: request,
- requestOptions: requestOptions,
- cancellationToken: cancellationToken
- ).ConfigureAwait(false);
-
- return __response.Body;
- }
- ///
- /// Update an intern
- /// Changes the intern name, description, instructions or model. Omitted fields stay unchanged. The request body is capped at 1048576 bytes and a larger body is refused with 413. A non-empty body must declare `Content-Type: application/json` or it is refused with 415. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// ID of an intern visible to the authenticated API key.
- /// Example: 7c9e6679-7425-40de-944b-e07fc1f90ae7
- ///
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- public async global::System.Threading.Tasks.Task> UpdateInternAsResponseAsync(
- string internId,
-
- global::OpenRouter.UpdateInternRequest request,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default)
- {
- request = request ?? throw new global::System.ArgumentNullException(nameof(request));
-
- PrepareArguments(
- client: HttpClient);
- PrepareUpdateInternArguments(
- httpClient: HttpClient,
- internId: ref internId,
- request: request);
-
-
- var __authorizations = global::OpenRouter.EndPointSecurityResolver.ResolveAuthorizations(
- availableAuthorizations: Authorizations,
- securityRequirements: s_UpdateInternSecurityRequirements,
- operationName: "UpdateInternAsync");
-
- using var __timeoutCancellationTokenSource = global::OpenRouter.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
- clientOptions: Options,
- requestOptions: requestOptions,
- cancellationToken: cancellationToken);
- var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
- var __effectiveReadResponseAsString = global::OpenRouter.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
- clientOptions: Options,
- requestOptions: requestOptions,
- fallbackValue: ReadResponseAsString);
- var __maxAttempts = global::OpenRouter.AutoSDKRequestOptionsSupport.GetMaxAttempts(
- clientOptions: Options,
- requestOptions: requestOptions,
- supportsRetry: true);
-
- global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
- {
-
- var __pathBuilder = new global::OpenRouter.PathBuilder(
- path: $"/interns/{internId}",
- baseUri: HttpClient.BaseAddress ?? new global::System.Uri("https://openrouter.ai/api/v1", global::System.UriKind.RelativeOrAbsolute));
- var __path = __pathBuilder.ToString();
- __path = global::OpenRouter.AutoSDKRequestOptionsSupport.AppendQueryParameters(
- path: __path,
- clientParameters: Options.QueryParameters,
- requestParameters: requestOptions?.QueryParameters);
- var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: new global::System.Net.Http.HttpMethod("PATCH"),
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
-#if NET6_0_OR_GREATER
- __httpRequest.Version = global::System.Net.HttpVersion.Version11;
- __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
-#endif
-
- foreach (var __authorization in __authorizations)
- {
- if (__authorization.Type == "Http" ||
- __authorization.Type == "OAuth2" ||
- __authorization.Type == "OpenIdConnect")
- {
- __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
- scheme: __authorization.Name,
- parameter: __authorization.Value);
- }
- else if (__authorization.Type == "ApiKey" &&
- __authorization.Location == "Header")
- {
- __httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
- }
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
- global::OpenRouter.AutoSDKRequestOptionsSupport.ApplyHeaders(
- request: __httpRequest,
- clientHeaders: Options.Headers,
- requestHeaders: requestOptions?.Headers);
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareUpdateInternRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- internId: internId,
- request: request);
-
- global::OpenRouter.AutoSDKHttpRequestOptions.StampAuthorizationOverride(__httpRequest);
-
- return __httpRequest;
- }
-
- global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
- global::System.Net.Http.HttpResponseMessage? __response = null;
- var __attemptNumber = 0;
- try
- {
- for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
- {
- __attemptNumber = __attempt;
- __httpRequest = __CreateHttpRequest();
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "UpdateIntern",
- methodName: "UpdateInternAsync",
- pathTemplate: "$\"/interns/{internId}\"",
- httpMethod: "PATCH",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: null,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- try
- {
- __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- }
- catch (global::System.Net.Http.HttpRequestException __exception)
- {
- var __retryDelay = global::OpenRouter.AutoSDKRequestOptionsSupport.GetRetryDelay(
- clientOptions: Options,
- requestOptions: requestOptions,
- response: null,
- attempt: __attempt);
- var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "UpdateIntern",
- methodName: "UpdateInternAsync",
- pathTemplate: "$\"/interns/{internId}\"",
- httpMethod: "PATCH",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: null,
- exception: __exception,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: __willRetry,
- retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
- retryReason: "exception",
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- if (!__willRetry)
- {
- throw;
- }
-
- __httpRequest.Dispose();
- __httpRequest = null;
- await global::OpenRouter.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- retryDelay: __retryDelay,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- continue;
- }
-
- if (__response != null &&
- __attempt < __maxAttempts &&
- global::OpenRouter.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
- {
- var __retryDelay = global::OpenRouter.AutoSDKRequestOptionsSupport.GetRetryDelay(
- clientOptions: Options,
- requestOptions: requestOptions,
- response: __response,
- attempt: __attempt);
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "UpdateIntern",
- methodName: "UpdateInternAsync",
- pathTemplate: "$\"/interns/{internId}\"",
- httpMethod: "PATCH",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attempt,
- maxAttempts: __maxAttempts,
- willRetry: true,
- retryDelay: __retryDelay,
- retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- __response.Dispose();
- __response = null;
- __httpRequest.Dispose();
- __httpRequest = null;
- await global::OpenRouter.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
- retryDelay: __retryDelay,
- cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
- continue;
- }
-
- break;
- }
-
- if (__response == null)
- {
- throw new global::System.InvalidOperationException("No response received.");
- }
-
- using (__response)
- {
-
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessUpdateInternResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- if (__response.IsSuccessStatusCode)
- {
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "UpdateIntern",
- methodName: "UpdateInternAsync",
- pathTemplate: "$\"/interns/{internId}\"",
- httpMethod: "PATCH",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attemptNumber,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- }
- else
- {
- await global::OpenRouter.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
- clientOptions: Options,
- context: global::OpenRouter.AutoSDKRequestOptionsSupport.CreateHookContext(
- operationId: "UpdateIntern",
- methodName: "UpdateInternAsync",
- pathTemplate: "$\"/interns/{internId}\"",
- httpMethod: "PATCH",
- baseUri: BaseUri,
- request: __httpRequest ?? throw new global::System.InvalidOperationException("The HTTP request was not created before invoking a request hook."),
- response: __response,
- exception: null,
- clientOptions: Options,
- requestOptions: requestOptions,
- attempt: __attemptNumber,
- maxAttempts: __maxAttempts,
- willRetry: false,
- retryDelay: null,
- retryReason: global::System.String.Empty,
- cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
- }
- // The request body is invalid.
- if ((int)__response.StatusCode == 400)
- {
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::OpenRouter.InternLifecycleError? __value_400 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_400 = global::OpenRouter.InternLifecycleError.FromJson(__content_400, JsonSerializerContext);
- }
- else
- {
- __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_400 = global::OpenRouter.InternLifecycleError.FromJson(__content_400, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- responseBody: __content_400,
- responseObject: __value_400,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // Missing, unknown or provisioning API key.
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::OpenRouter.InternLifecycleError? __value_401 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_401 = global::OpenRouter.InternLifecycleError.FromJson(__content_401, JsonSerializerContext);
- }
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_401 = global::OpenRouter.InternLifecycleError.FromJson(__content_401, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_401 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- responseBody: __content_401,
- responseObject: __value_401,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The key owner no longer has access, the request used a regional hostname, or lifecycle writes are not enabled for the caller (`metadata.reason` is `lifecycle_writes_disabled`).
- if ((int)__response.StatusCode == 403)
- {
- string? __content_403 = null;
- global::System.Exception? __exception_403 = null;
- global::OpenRouter.InternLifecycleError? __value_403 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_403 = global::OpenRouter.InternLifecycleError.FromJson(__content_403, JsonSerializerContext);
- }
- else
- {
- __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_403 = global::OpenRouter.InternLifecycleError.FromJson(__content_403, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_403 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_403,
- responseBody: __content_403,
- responseObject: __value_403,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The caller is outside the Intern API programme, or the intern is hidden.
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::OpenRouter.InternLifecycleError? __value_404 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_404 = global::OpenRouter.InternLifecycleError.FromJson(__content_404, JsonSerializerContext);
- }
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_404 = global::OpenRouter.InternLifecycleError.FromJson(__content_404, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_404 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- responseBody: __content_404,
- responseObject: __value_404,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The request exceeded its route deadline. The deadline quoted in the message is the route's own, so it differs between operations.
- if ((int)__response.StatusCode == 408)
- {
- string? __content_408 = null;
- global::System.Exception? __exception_408 = null;
- global::OpenRouter.InternLifecycleError? __value_408 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_408 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_408 = global::OpenRouter.InternLifecycleError.FromJson(__content_408, JsonSerializerContext);
- }
- else
- {
- __content_408 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_408 = global::OpenRouter.InternLifecycleError.FromJson(__content_408, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_408 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_408 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_408,
- responseBody: __content_408,
- responseObject: __value_408,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The new name is already taken by an intern in this workspace.
- if ((int)__response.StatusCode == 409)
- {
- string? __content_409 = null;
- global::System.Exception? __exception_409 = null;
- global::OpenRouter.InternLifecycleError? __value_409 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_409 = global::OpenRouter.InternLifecycleError.FromJson(__content_409, JsonSerializerContext);
- }
- else
- {
- __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_409 = global::OpenRouter.InternLifecycleError.FromJson(__content_409, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_409 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_409 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_409,
- responseBody: __content_409,
- responseObject: __value_409,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The request body is larger than 1048576 bytes.
- if ((int)__response.StatusCode == 413)
- {
- string? __content_413 = null;
- global::System.Exception? __exception_413 = null;
- global::OpenRouter.InternLifecycleError? __value_413 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_413 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_413 = global::OpenRouter.InternLifecycleError.FromJson(__content_413, JsonSerializerContext);
- }
- else
- {
- __content_413 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_413 = global::OpenRouter.InternLifecycleError.FromJson(__content_413, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_413 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_413 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_413,
- responseBody: __content_413,
- responseObject: __value_413,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The request body is non-empty and its Content-Type is not application/json.
- if ((int)__response.StatusCode == 415)
- {
- string? __content_415 = null;
- global::System.Exception? __exception_415 = null;
- global::OpenRouter.InternLifecycleError? __value_415 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_415 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_415 = global::OpenRouter.InternLifecycleError.FromJson(__content_415, JsonSerializerContext);
- }
- else
- {
- __content_415 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_415 = global::OpenRouter.InternLifecycleError.FromJson(__content_415, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_415 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_415 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_415,
- responseBody: __content_415,
- responseObject: __value_415,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- // The request could not be completed. `metadata.reason` says whether to try again: `internal_error` is a transient failure and carries `metadata.retryable: true`, so the same request may be sent again, while `configuration_error` carries `retryable: false` because the next attempt reads the same missing binding or unusable stored credential.
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::OpenRouter.InternLifecycleError? __value_500 = null;
- try
- {
- if (__effectiveReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- __value_500 = global::OpenRouter.InternLifecycleError.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
-
- __value_500 = global::OpenRouter.InternLifecycleError.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
-
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- responseBody: __content_500,
- responseObject: __value_500,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
-
- if (__effectiveReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
-
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessUpdateInternResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
- {
- __response.EnsureSuccessStatusCode();
-
- var __value = global::OpenRouter.Intern.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- return new global::OpenRouter.AutoSDKHttpResponse(
- statusCode: __response.StatusCode,
- headers: global::OpenRouter.AutoSDKHttpResponse.CreateHeaders(__response),
- requestUri: __response.RequestMessage?.RequestUri,
- body: __value);
- }
- catch (global::System.Exception __ex)
- {
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- responseBody: __content,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
-
- var __value = await global::OpenRouter.Intern.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- return new global::OpenRouter.AutoSDKHttpResponse(
- statusCode: __response.StatusCode,
- headers: global::OpenRouter.AutoSDKHttpResponse.CreateHeaders(__response),
- requestUri: __response.RequestMessage?.RequestUri,
- body: __value);
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
- #if NET5_0_OR_GREATER
- __effectiveCancellationToken
- #endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
-
- throw global::OpenRouter.ApiException.Create(
- statusCode: __response.StatusCode,
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- responseBody: __content,
- responseHeaders: global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value));
- }
- }
-
- }
- }
- finally
- {
- __httpRequest?.Dispose();
- }
- }
- ///
- /// Update an intern
- /// Changes the intern name, description, instructions or model. Omitted fields stay unchanged. The request body is capped at 1048576 bytes and a larger body is refused with 413. A non-empty body must declare `Content-Type: application/json` or it is refused with 415. The API key selects the caller, workspace and visible interns. An intern's own API key sees only that intern: the collection and every other intern answer 404 to it. There is no default workspace fallback. Requests on regional hostnames such as `eu.openrouter.ai` are refused. [API key](/docs/api-reference/authentication) required.
- ///
- ///
- /// ID of an intern visible to the authenticated API key.
- /// Example: 7c9e6679-7425-40de-944b-e07fc1f90ae7
- ///
- ///
- /// New free-form description. Null clears it.
- ///
- ///
- /// New standing instructions. Null clears them.
- ///
- ///
- /// New OpenRouter model slug in `author/slug` form (an optional `:variant` suffix is accepted). Other shapes are refused with 400. Null restores the workspace default. Takes effect on the next provision: until then `GET` shows this configured model while chat chunks show the model the running intern reports.
- ///
- ///
- /// New intern name, unique per creator within the workspace.
- ///
- /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.
- /// The token to cancel the operation with
- ///
- public async global::System.Threading.Tasks.Task UpdateInternAsync(
- string internId,
- string? description = default,
- string? instructions = default,
- string? model = default,
- string? name = default,
- global::OpenRouter.AutoSDKRequestOptions? requestOptions = default,
- global::System.Threading.CancellationToken cancellationToken = default)
- {
- var __request = new global::OpenRouter.UpdateInternRequest
- {
- Description = description,
- Instructions = instructions,
- Model = model,
- Name = name,
- };
-
- return await UpdateInternAsync(
- internId: internId,
- request: __request,
- requestOptions: requestOptions,
- cancellationToken: cancellationToken).ConfigureAwait(false);
- }
- }
-}
\ No newline at end of file
diff --git a/src/libs/OpenRouter/Generated/OpenRouter.InternsClient.g.cs b/src/libs/OpenRouter/Generated/OpenRouter.InternsClient.g.cs
deleted file mode 100644
index 9c69b36f..00000000
--- a/src/libs/OpenRouter/Generated/OpenRouter.InternsClient.g.cs
+++ /dev/null
@@ -1,156 +0,0 @@
-
-#nullable enable
-
-namespace OpenRouter
-{
- ///
- /// Create, inspect, update, provision, suspend and delete OpenRouter interns through an API key, and talk to them: the chat route streams OpenAI-compatible completions from one intern, pausing as an `openrouter.provide_input` tool call when the intern needs your permission or an answer. Available to interns programme members; other callers receive 404. See https://openrouter.ai/docs/guides/ori/intern-chat.
- /// If no httpClient is provided, a new one will be created.
- /// If no baseUri is provided, the default baseUri from OpenAPI spec will be used.
- ///
- public sealed partial class InternsClient : global::OpenRouter.IInternsClient, global::System.IDisposable
- {
- ///
- /// Production server
- ///
- public const string DefaultBaseUrl = "https://openrouter.ai/api/v1";
-
- private bool _disposeHttpClient = true;
-
- ///
- public global::System.Net.Http.HttpClient HttpClient { get; }
-
- ///
- public System.Uri? BaseUri => HttpClient.BaseAddress;
-
- ///
- public global::System.Collections.Generic.List Authorizations { get; }
-
- ///
- public bool ReadResponseAsString { get; set; }
-#if DEBUG
- = true;
-#endif
-
- ///
- public global::OpenRouter.AutoSDKClientOptions Options { get; }
-
-
- ///
- public global::System.Func CreateIdempotencyKey { get; set; } = () => global::System.Guid.NewGuid().ToString("D");
-
-
- internal global::OpenRouter.AutoSDKServerConfiguration AutoSDKServerConfiguration { get; set; } = new global::OpenRouter.AutoSDKServerConfiguration();
-
- internal global::System.Lazy? JsonSerializerContextProvider { get; set; }
-
- ///
- ///
- ///
- public global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext
- {
- get => JsonSerializerContextProvider?.Value ?? global::OpenRouter.InternsSourceGenerationContext.Default;
- set => JsonSerializerContextProvider = new(() => value);
- }
-
-
- ///
- /// Creates a new instance of the InternsClient.
- /// If no httpClient is provided, a new one will be created.
- /// If no baseUri is provided, the default baseUri from OpenAPI spec will be used.
- ///
- /// The HttpClient instance. If not provided, a new one will be created.
- /// The base URL for the API. If not provided, the default baseUri from OpenAPI spec will be used.
- /// The authorizations to use for the requests.
- /// Dispose the HttpClient when the instance is disposed. True by default.
- public InternsClient(
- global::System.Net.Http.HttpClient? httpClient = null,
- global::System.Uri? baseUri = null,
- global::System.Collections.Generic.List? authorizations = null,
- bool disposeHttpClient = true) : this(
- httpClient,
- baseUri,
- authorizations,
- options: null,
- disposeHttpClient: disposeHttpClient)
- {
- }
-
- ///
- /// Creates a new instance of the InternsClient with explicit options but no base URL override.
- /// Skips passing baseUri so the default base URL from the OpenAPI spec applies.
- ///
- /// The HttpClient instance. If not provided, a new one will be created.
- /// The authorizations to use for the requests.
- /// Client-wide request defaults such as headers, query parameters, retries, and timeout.
- /// Dispose the HttpClient when the instance is disposed. True by default.
- public InternsClient(
- global::System.Net.Http.HttpClient? httpClient,
- global::System.Collections.Generic.List? authorizations,
- global::OpenRouter.AutoSDKClientOptions? options,
- bool disposeHttpClient = true) : this(
- httpClient,
- baseUri: null,
- authorizations,
- options,
- disposeHttpClient: disposeHttpClient)
- {
- }
-
- ///
- /// Creates a new instance of the InternsClient.
- /// If no httpClient is provided, a new one will be created.
- /// If no baseUri is provided, the default baseUri from OpenAPI spec will be used.
- ///
- /// The HttpClient instance. If not provided, a new one will be created.
- /// The base URL for the API. If not provided, the default baseUri from OpenAPI spec will be used.
- /// The authorizations to use for the requests.
- /// Client-wide request defaults such as headers, query parameters, retries, and timeout.
- /// Dispose the HttpClient when the instance is disposed. True by default.
- public InternsClient(
- global::System.Net.Http.HttpClient? httpClient,
- global::System.Uri? baseUri,
- global::System.Collections.Generic.List? authorizations,
- global::OpenRouter.AutoSDKClientOptions? options,
- bool disposeHttpClient = true)
- {
-
- HttpClient = httpClient ?? new global::System.Net.Http.HttpClient();
- if (baseUri is not null)
- {
- HttpClient.BaseAddress ??= baseUri;
- }
- Authorizations = authorizations ?? new global::System.Collections.Generic.List();
- Options = options ?? new global::OpenRouter.AutoSDKClientOptions();
- _disposeHttpClient = disposeHttpClient;
-
- AutoSDKServerConfiguration.ExplicitBaseUri = baseUri ?? httpClient?.BaseAddress;
-
- Initialized(HttpClient);
- }
-
- ///
- public void Dispose()
- {
- if (_disposeHttpClient)
- {
- HttpClient.Dispose();
- }
- }
-
- partial void Initialized(
- global::System.Net.Http.HttpClient client);
- partial void PrepareArguments(
- global::System.Net.Http.HttpClient client);
- partial void PrepareRequest(
- global::System.Net.Http.HttpClient client,
- global::System.Net.Http.HttpRequestMessage request);
- partial void ProcessResponse(
- global::System.Net.Http.HttpClient client,
- global::System.Net.Http.HttpResponseMessage response);
- partial void ProcessResponseContent(
- global::System.Net.Http.HttpClient client,
- global::System.Net.Http.HttpResponseMessage response,
- ref string content);
- }
-}
\ No newline at end of file
diff --git a/src/libs/OpenRouter/Generated/OpenRouter.JsonConverters.InternApprovalMode.g.cs b/src/libs/OpenRouter/Generated/OpenRouter.JsonConverters.InternApprovalMode.g.cs
deleted file mode 100644
index d1ccf98b..00000000
--- a/src/libs/OpenRouter/Generated/OpenRouter.JsonConverters.InternApprovalMode.g.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-#nullable enable
-
-namespace OpenRouter.JsonConverters
-{
- ///
- public sealed class InternApprovalModeJsonConverter : global::System.Text.Json.Serialization.JsonConverter
- {
- ///
- public override global::OpenRouter.InternApprovalMode Read(
- ref global::System.Text.Json.Utf8JsonReader reader,
- global::System.Type typeToConvert,
- global::System.Text.Json.JsonSerializerOptions options)
- {
- switch (reader.TokenType)
- {
- case global::System.Text.Json.JsonTokenType.String:
- {
- var stringValue = reader.GetString();
- if (stringValue != null)
- {
- return global::OpenRouter.InternApprovalModeExtensions.ToEnum(stringValue) ?? default;
- }
-
- break;
- }
- case global::System.Text.Json.JsonTokenType.Null:
- {
- return default(global::OpenRouter.InternApprovalMode);
- }
- default:
- throw new global::System.ArgumentOutOfRangeException(nameof(reader));
- }
-
- return default;
- }
-
- ///
- public override void Write(
- global::System.Text.Json.Utf8JsonWriter writer,
- global::OpenRouter.InternApprovalMode value,
- global::System.Text.Json.JsonSerializerOptions options)
- {
- writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));
-
- writer.WriteStringValue(global::OpenRouter.InternApprovalModeExtensions.ToValueString(value));
- }
- }
-}
diff --git a/src/libs/OpenRouter/Generated/OpenRouter.JsonConverters.InternApprovalModeNullable.g.cs b/src/libs/OpenRouter/Generated/OpenRouter.JsonConverters.InternApprovalModeNullable.g.cs
deleted file mode 100644
index 56610b7e..00000000
--- a/src/libs/OpenRouter/Generated/OpenRouter.JsonConverters.InternApprovalModeNullable.g.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-#nullable enable
-
-namespace OpenRouter.JsonConverters
-{
- ///
- public sealed class InternApprovalModeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter
- {
- ///
- public override global::OpenRouter.InternApprovalMode? Read(
- ref global::System.Text.Json.Utf8JsonReader reader,
- global::System.Type typeToConvert,
- global::System.Text.Json.JsonSerializerOptions options)
- {
- switch (reader.TokenType)
- {
- case global::System.Text.Json.JsonTokenType.String:
- {
- var stringValue = reader.GetString();
- if (stringValue != null)
- {
- return global::OpenRouter.InternApprovalModeExtensions.ToEnum(stringValue);
- }
-
- break;
- }
- case global::System.Text.Json.JsonTokenType.Null:
- {
- return default(global::OpenRouter.InternApprovalMode?);
- }
- default:
- throw new global::System.ArgumentOutOfRangeException(nameof(reader));
- }
-
- return default;
- }
-
- ///
- public override void Write(
- global::System.Text.Json.Utf8JsonWriter writer,
- global::OpenRouter.InternApprovalMode? value,
- global::System.Text.Json.JsonSerializerOptions options)
- {
- writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));
-
- if (value == null)
- {
- writer.WriteNullValue();
- }
- else
- {
- writer.WriteStringValue(global::OpenRouter.InternApprovalModeExtensions.ToValueString(value.Value));
- }
- }
- }
-}
diff --git a/src/libs/OpenRouter/Generated/OpenRouter.JsonConverters.InternChatAssistantMessageRole.g.cs b/src/libs/OpenRouter/Generated/OpenRouter.JsonConverters.InternChatAssistantMessageRole.g.cs
deleted file mode 100644
index 6d25cbee..00000000
--- a/src/libs/OpenRouter/Generated/OpenRouter.JsonConverters.InternChatAssistantMessageRole.g.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-#nullable enable
-
-namespace OpenRouter.JsonConverters
-{
- ///
- public sealed class InternChatAssistantMessageRoleJsonConverter : global::System.Text.Json.Serialization.JsonConverter
- {
- ///
- public override global::OpenRouter.InternChatAssistantMessageRole Read(
- ref global::System.Text.Json.Utf8JsonReader reader,
- global::System.Type typeToConvert,
- global::System.Text.Json.JsonSerializerOptions options)
- {
- switch (reader.TokenType)
- {
- case global::System.Text.Json.JsonTokenType.String:
- {
- var stringValue = reader.GetString();
- if (stringValue != null)
- {
- return global::OpenRouter.InternChatAssistantMessageRoleExtensions.ToEnum(stringValue) ?? default;
- }
-
- break;
- }
- case global::System.Text.Json.JsonTokenType.Number:
- {
- var numValue = reader.GetInt32();
- return (global::OpenRouter.InternChatAssistantMessageRole)numValue;
- }
- case global::System.Text.Json.JsonTokenType.Null:
- {
- return default(global::OpenRouter.InternChatAssistantMessageRole);
- }
- default:
- throw new global::System.ArgumentOutOfRangeException(nameof(reader));
- }
-
- return default;
- }
-
- ///
- public override void Write(
- global::System.Text.Json.Utf8JsonWriter writer,
- global::OpenRouter.InternChatAssistantMessageRole value,
- global::System.Text.Json.JsonSerializerOptions options)
- {
- writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));
-
- writer.WriteStringValue(global::OpenRouter.InternChatAssistantMessageRoleExtensions.ToValueString(value));
- }
- }
-}
diff --git a/src/libs/OpenRouter/Generated/OpenRouter.JsonConverters.InternChatAssistantMessageRoleNullable.g.cs b/src/libs/OpenRouter/Generated/OpenRouter.JsonConverters.InternChatAssistantMessageRoleNullable.g.cs
deleted file mode 100644
index 536ac736..00000000
--- a/src/libs/OpenRouter/Generated/OpenRouter.JsonConverters.InternChatAssistantMessageRoleNullable.g.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-#nullable enable
-
-namespace OpenRouter.JsonConverters
-{
- ///
- public sealed class InternChatAssistantMessageRoleNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter
- {
- ///
- public override global::OpenRouter.InternChatAssistantMessageRole? Read(
- ref global::System.Text.Json.Utf8JsonReader reader,
- global::System.Type typeToConvert,
- global::System.Text.Json.JsonSerializerOptions options)
- {
- switch (reader.TokenType)
- {
- case global::System.Text.Json.JsonTokenType.String:
- {
- var stringValue = reader.GetString();
- if (stringValue != null)
- {
- return global::OpenRouter.InternChatAssistantMessageRoleExtensions.ToEnum(stringValue);
- }
-
- break;
- }
- case global::System.Text.Json.JsonTokenType.Number:
- {
- var numValue = reader.GetInt32();
- return (global::OpenRouter.InternChatAssistantMessageRole)numValue;
- }
- case global::System.Text.Json.JsonTokenType.Null:
- {
- return default(global::OpenRouter.InternChatAssistantMessageRole?);
- }
- default:
- throw new global::System.ArgumentOutOfRangeException(nameof(reader));
- }
-
- return default;
- }
-
- ///
- public override void Write(
- global::System.Text.Json.Utf8JsonWriter writer,
- global::OpenRouter.InternChatAssistantMessageRole? value,
- global::System.Text.Json.JsonSerializerOptions options)
- {
- writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));
-
- if (value == null)
- {
- writer.WriteNullValue();
- }
- else
- {
- writer.WriteStringValue(global::OpenRouter.InternChatAssistantMessageRoleExtensions.ToValueString(value.Value));
- }
- }
- }
-}
diff --git a/src/libs/OpenRouter/Generated/OpenRouter.JsonConverters.InternChatChoiceFinishReason.g.cs b/src/libs/OpenRouter/Generated/OpenRouter.JsonConverters.InternChatChoiceFinishReason.g.cs
deleted file mode 100644
index 32e30483..00000000
--- a/src/libs/OpenRouter/Generated/OpenRouter.JsonConverters.InternChatChoiceFinishReason.g.cs
+++ /dev/null
@@ -1,48 +0,0 @@
-#nullable enable
-
-namespace OpenRouter.JsonConverters
-{
- ///
- public sealed class InternChatChoiceFinishReasonJsonConverter : global::System.Text.Json.Serialization.JsonConverter
- {
- ///
- public override global::OpenRouter.InternChatChoiceFinishReason Read(
- ref global::System.Text.Json.Utf8JsonReader reader,
- global::System.Type typeToConvert,
- global::System.Text.Json.JsonSerializerOptions options)
- {
- switch (reader.TokenType)
- {
- case global::System.Text.Json.JsonTokenType.String:
- {
- var stringValue = reader.GetString();
- if (stringValue != null)
- {
- return global::OpenRouter.InternChatChoiceFinishReasonExtensions.ToEnum(stringValue) ?? default;
- }
-
- break;
- }
- case global::System.Text.Json.JsonTokenType.Null:
- {
- return default(global::OpenRouter.InternChatChoiceFinishReason);
- }
- default:
- throw new global::System.ArgumentOutOfRangeException(nameof(reader));
- }
-
- return default;
- }
-
- ///
- public override void Write(
- global::System.Text.Json.Utf8JsonWriter writer,
- global::OpenRouter.InternChatChoiceFinishReason value,
- global::System.Text.Json.JsonSerializerOptions options)
- {
- writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));
-
- writer.WriteStringValue(global::OpenRouter.InternChatChoiceFinishReasonExtensions.ToValueString(value));
- }
- }
-}
diff --git a/src/libs/OpenRouter/Generated/OpenRouter.JsonConverters.InternChatChoiceFinishReasonNullable.g.cs b/src/libs/OpenRouter/Generated/OpenRouter.JsonConverters.InternChatChoiceFinishReasonNullable.g.cs
deleted file mode 100644
index b58c6b9c..00000000
--- a/src/libs/OpenRouter/Generated/OpenRouter.JsonConverters.InternChatChoiceFinishReasonNullable.g.cs
+++ /dev/null
@@ -1,55 +0,0 @@
-#nullable enable
-
-namespace OpenRouter.JsonConverters
-{
- ///
- public sealed class InternChatChoiceFinishReasonNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter
- {
- ///
- public override global::OpenRouter.InternChatChoiceFinishReason? Read(
- ref global::System.Text.Json.Utf8JsonReader reader,
- global::System.Type typeToConvert,
- global::System.Text.Json.JsonSerializerOptions options)
- {
- switch (reader.TokenType)
- {
- case global::System.Text.Json.JsonTokenType.String:
- {
- var stringValue = reader.GetString();
- if (stringValue != null)
- {
- return global::OpenRouter.InternChatChoiceFinishReasonExtensions.ToEnum(stringValue);
- }
-
- break;
- }
- case global::System.Text.Json.JsonTokenType.Null:
- {
- return default(global::OpenRouter.InternChatChoiceFinishReason?);
- }
- default:
- throw new global::System.ArgumentOutOfRangeException(nameof(reader));
- }
-
- return default;
- }
-
- ///
- public override void Write(
- global::System.Text.Json.Utf8JsonWriter writer,
- global::OpenRouter.InternChatChoiceFinishReason? value,
- global::System.Text.Json.JsonSerializerOptions options)
- {
- writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));
-
- if (value == null)
- {
- writer.WriteNullValue();
- }
- else
- {
- writer.WriteStringValue(global::OpenRouter.InternChatChoiceFinishReasonExtensions.ToValueString(value.Value));
- }
- }
- }
-}
diff --git a/src/libs/OpenRouter/Generated/OpenRouter.JsonConverters.InternChatCompletionChunkObject.g.cs b/src/libs/OpenRouter/Generated/OpenRouter.JsonConverters.InternChatCompletionChunkObject.g.cs
deleted file mode 100644
index 615ac150..00000000
--- a/src/libs/OpenRouter/Generated/OpenRouter.JsonConverters.InternChatCompletionChunkObject.g.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-#nullable enable
-
-namespace OpenRouter.JsonConverters
-{
- ///
- public sealed class InternChatCompletionChunkObjectJsonConverter : global::System.Text.Json.Serialization.JsonConverter
- {
- ///
- public override global::OpenRouter.InternChatCompletionChunkObject Read(
- ref global::System.Text.Json.Utf8JsonReader reader,
- global::System.Type typeToConvert,
- global::System.Text.Json.JsonSerializerOptions options)
- {
- switch (reader.TokenType)
- {
- case global::System.Text.Json.JsonTokenType.String:
- {
- var stringValue = reader.GetString();
- if (stringValue != null)
- {
- return global::OpenRouter.InternChatCompletionChunkObjectExtensions.ToEnum(stringValue) ?? default;
- }
-
- break;
- }
- case global::System.Text.Json.JsonTokenType.Number:
- {
- var numValue = reader.GetInt32();
- return (global::OpenRouter.InternChatCompletionChunkObject)numValue;
- }
- case global::System.Text.Json.JsonTokenType.Null:
- {
- return default(global::OpenRouter.InternChatCompletionChunkObject);
- }
- default:
- throw new global::System.ArgumentOutOfRangeException(nameof(reader));
- }
-
- return default;
- }
-
- ///
- public override void Write(
- global::System.Text.Json.Utf8JsonWriter writer,
- global::OpenRouter.InternChatCompletionChunkObject value,
- global::System.Text.Json.JsonSerializerOptions options)
- {
- writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));
-
- writer.WriteStringValue(global::OpenRouter.InternChatCompletionChunkObjectExtensions.ToValueString(value));
- }
- }
-}
diff --git a/src/libs/OpenRouter/Generated/OpenRouter.JsonConverters.InternChatCompletionChunkObjectNullable.g.cs b/src/libs/OpenRouter/Generated/OpenRouter.JsonConverters.InternChatCompletionChunkObjectNullable.g.cs
deleted file mode 100644
index bc342e05..00000000
--- a/src/libs/OpenRouter/Generated/OpenRouter.JsonConverters.InternChatCompletionChunkObjectNullable.g.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-#nullable enable
-
-namespace OpenRouter.JsonConverters
-{
- ///
- public sealed class InternChatCompletionChunkObjectNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter
- {
- ///
- public override global::OpenRouter.InternChatCompletionChunkObject? Read(
- ref global::System.Text.Json.Utf8JsonReader reader,
- global::System.Type typeToConvert,
- global::System.Text.Json.JsonSerializerOptions options)
- {
- switch (reader.TokenType)
- {
- case global::System.Text.Json.JsonTokenType.String:
- {
- var stringValue = reader.GetString();
- if (stringValue != null)
- {
- return global::OpenRouter.InternChatCompletionChunkObjectExtensions.ToEnum(stringValue);
- }
-
- break;
- }
- case global::System.Text.Json.JsonTokenType.Number:
- {
- var numValue = reader.GetInt32();
- return (global::OpenRouter.InternChatCompletionChunkObject)numValue;
- }
- case global::System.Text.Json.JsonTokenType.Null:
- {
- return default(global::OpenRouter.InternChatCompletionChunkObject?);
- }
- default:
- throw new global::System.ArgumentOutOfRangeException(nameof(reader));
- }
-
- return default;
- }
-
- ///
- public override void Write(
- global::System.Text.Json.Utf8JsonWriter writer,
- global::OpenRouter.InternChatCompletionChunkObject? value,
- global::System.Text.Json.JsonSerializerOptions options)
- {
- writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));
-
- if (value == null)
- {
- writer.WriteNullValue();
- }
- else
- {
- writer.WriteStringValue(global::OpenRouter.InternChatCompletionChunkObjectExtensions.ToValueString(value.Value));
- }
- }
- }
-}
diff --git a/src/libs/OpenRouter/Generated/OpenRouter.JsonConverters.InternChatDeltaRole.g.cs b/src/libs/OpenRouter/Generated/OpenRouter.JsonConverters.InternChatDeltaRole.g.cs
deleted file mode 100644
index bb4c52cf..00000000
--- a/src/libs/OpenRouter/Generated/OpenRouter.JsonConverters.InternChatDeltaRole.g.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-#nullable enable
-
-namespace OpenRouter.JsonConverters
-{
- ///
- public sealed class InternChatDeltaRoleJsonConverter : global::System.Text.Json.Serialization.JsonConverter
- {
- ///
- public override global::OpenRouter.InternChatDeltaRole Read(
- ref global::System.Text.Json.Utf8JsonReader reader,
- global::System.Type typeToConvert,
- global::System.Text.Json.JsonSerializerOptions options)
- {
- switch (reader.TokenType)
- {
- case global::System.Text.Json.JsonTokenType.String:
- {
- var stringValue = reader.GetString();
- if (stringValue != null)
- {
- return global::OpenRouter.InternChatDeltaRoleExtensions.ToEnum(stringValue) ?? default;
- }
-
- break;
- }
- case global::System.Text.Json.JsonTokenType.Number:
- {
- var numValue = reader.GetInt32();
- return (global::OpenRouter.InternChatDeltaRole)numValue;
- }
- case global::System.Text.Json.JsonTokenType.Null:
- {
- return default(global::OpenRouter.InternChatDeltaRole);
- }
- default:
- throw new global::System.ArgumentOutOfRangeException(nameof(reader));
- }
-
- return default;
- }
-
- ///
- public override void Write(
- global::System.Text.Json.Utf8JsonWriter writer,
- global::OpenRouter.InternChatDeltaRole value,
- global::System.Text.Json.JsonSerializerOptions options)
- {
- writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));
-
- writer.WriteStringValue(global::OpenRouter.InternChatDeltaRoleExtensions.ToValueString(value));
- }
- }
-}
diff --git a/src/libs/OpenRouter/Generated/OpenRouter.JsonConverters.InternChatDeltaRoleNullable.g.cs b/src/libs/OpenRouter/Generated/OpenRouter.JsonConverters.InternChatDeltaRoleNullable.g.cs
deleted file mode 100644
index 325bc2b9..00000000
--- a/src/libs/OpenRouter/Generated/OpenRouter.JsonConverters.InternChatDeltaRoleNullable.g.cs
+++ /dev/null
@@ -1,60 +0,0 @@
-#nullable enable
-
-namespace OpenRouter.JsonConverters
-{
- ///
- public sealed class InternChatDeltaRoleNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter
- {
- ///
- public override global::OpenRouter.InternChatDeltaRole? Read(
- ref global::System.Text.Json.Utf8JsonReader reader,
- global::System.Type typeToConvert,
- global::System.Text.Json.JsonSerializerOptions options)
- {
- switch (reader.TokenType)
- {
- case global::System.Text.Json.JsonTokenType.String:
- {
- var stringValue = reader.GetString();
- if (stringValue != null)
- {
- return global::OpenRouter.InternChatDeltaRoleExtensions.ToEnum(stringValue);
- }
-
- break;
- }
- case global::System.Text.Json.JsonTokenType.Number:
- {
- var numValue = reader.GetInt32();
- return (global::OpenRouter.InternChatDeltaRole)numValue;
- }
- case global::System.Text.Json.JsonTokenType.Null:
- {
- return default(global::OpenRouter.InternChatDeltaRole?);
- }
- default:
- throw new global::System.ArgumentOutOfRangeException(nameof(reader));
- }
-
- return default;
- }
-
- ///
- public override void Write(
- global::System.Text.Json.Utf8JsonWriter writer,
- global::OpenRouter.InternChatDeltaRole? value,
- global::System.Text.Json.JsonSerializerOptions options)
- {
- writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));
-
- if (value == null)
- {
- writer.WriteNullValue();
- }
- else
- {
- writer.WriteStringValue(global::OpenRouter.InternChatDeltaRoleExtensions.ToValueString(value.Value));
- }
- }
- }
-}
diff --git a/src/libs/OpenRouter/Generated/OpenRouter.JsonConverters.InternChatDeveloperMessageRole.g.cs b/src/libs/OpenRouter/Generated/OpenRouter.JsonConverters.InternChatDeveloperMessageRole.g.cs
deleted file mode 100644
index 7f5dceeb..00000000
--- a/src/libs/OpenRouter/Generated/OpenRouter.JsonConverters.InternChatDeveloperMessageRole.g.cs
+++ /dev/null
@@ -1,53 +0,0 @@
-#nullable enable
-
-namespace OpenRouter.JsonConverters
-{
- ///
- public sealed class InternChatDeveloperMessageRoleJsonConverter : global::System.Text.Json.Serialization.JsonConverter
- {
- ///