Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public partial interface IInterns2Client
/// <param name="requestOptions">Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.</param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::OpenRouter.ApiException"></exception>
global::System.Threading.Tasks.Task<global::OpenRouter.InternChatSteeredResponse> ChatAsync(
global::System.Threading.Tasks.Task<global::OpenRouter.InternChatCompletionChunk> ChatAsync(
string internId,

global::OpenRouter.InternChatCompletionRequest request,
Expand All @@ -46,7 +46,7 @@ public partial interface IInterns2Client
/// <param name="requestOptions">Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.</param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::OpenRouter.ApiException"></exception>
global::System.Threading.Tasks.Task<global::OpenRouter.AutoSDKHttpResponse<global::OpenRouter.InternChatSteeredResponse>> ChatAsResponseAsync(
global::System.Threading.Tasks.Task<global::OpenRouter.AutoSDKHttpResponse<global::OpenRouter.InternChatCompletionChunk>> ChatAsResponseAsync(
string internId,

global::OpenRouter.InternChatCompletionRequest request,
Expand Down Expand Up @@ -84,7 +84,7 @@ public partial interface IInterns2Client
/// <param name="requestOptions">Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.</param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
global::System.Threading.Tasks.Task<global::OpenRouter.InternChatSteeredResponse> ChatAsync(
global::System.Threading.Tasks.Task<global::OpenRouter.InternChatCompletionChunk> ChatAsync(
string internId,
global::System.Collections.Generic.IList<global::OpenRouter.InternChatMessage> messages,
global::OpenRouter.InternApprovalMode? approvalMode = default,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ partial void ProcessChatResponseContent(
/// <param name="requestOptions">Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.</param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::OpenRouter.ApiException"></exception>
public async global::System.Threading.Tasks.Task<global::OpenRouter.InternChatSteeredResponse> ChatAsync(
public async global::System.Threading.Tasks.Task<global::OpenRouter.InternChatCompletionChunk> ChatAsync(
string internId,

global::OpenRouter.InternChatCompletionRequest request,
Expand Down Expand Up @@ -96,7 +96,7 @@ partial void ProcessChatResponseContent(
/// <param name="requestOptions">Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.</param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::OpenRouter.ApiException"></exception>
public async global::System.Threading.Tasks.Task<global::OpenRouter.AutoSDKHttpResponse<global::OpenRouter.InternChatSteeredResponse>> ChatAsResponseAsync(
public async global::System.Threading.Tasks.Task<global::OpenRouter.AutoSDKHttpResponse<global::OpenRouter.InternChatCompletionChunk>> ChatAsResponseAsync(
string internId,

global::OpenRouter.InternChatCompletionRequest request,
Expand Down Expand Up @@ -844,9 +844,9 @@ partial void ProcessChatResponseContent(
{
__response.EnsureSuccessStatusCode();

var __value = global::OpenRouter.InternChatSteeredResponse.FromJson(__content, JsonSerializerContext) ??
var __value = global::OpenRouter.InternChatCompletionChunk.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
return new global::OpenRouter.AutoSDKHttpResponse<global::OpenRouter.InternChatSteeredResponse>(
return new global::OpenRouter.AutoSDKHttpResponse<global::OpenRouter.InternChatCompletionChunk>(
statusCode: __response.StatusCode,
headers: global::OpenRouter.AutoSDKHttpResponse.CreateHeaders(__response),
requestUri: __response.RequestMessage?.RequestUri,
Expand Down Expand Up @@ -876,9 +876,9 @@ partial void ProcessChatResponseContent(
#endif
).ConfigureAwait(false);

var __value = await global::OpenRouter.InternChatSteeredResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
var __value = await global::OpenRouter.InternChatCompletionChunk.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
return new global::OpenRouter.AutoSDKHttpResponse<global::OpenRouter.InternChatSteeredResponse>(
return new global::OpenRouter.AutoSDKHttpResponse<global::OpenRouter.InternChatCompletionChunk>(
statusCode: __response.StatusCode,
headers: global::OpenRouter.AutoSDKHttpResponse.CreateHeaders(__response),
requestUri: __response.RequestMessage?.RequestUri,
Expand Down Expand Up @@ -950,7 +950,7 @@ partial void ProcessChatResponseContent(
/// <param name="requestOptions">Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.</param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
public async global::System.Threading.Tasks.Task<global::OpenRouter.InternChatSteeredResponse> ChatAsync(
public async global::System.Threading.Tasks.Task<global::OpenRouter.InternChatCompletionChunk> ChatAsync(
string internId,
global::System.Collections.Generic.IList<global::OpenRouter.InternChatMessage> messages,
global::OpenRouter.InternApprovalMode? approvalMode = default,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#nullable enable

namespace OpenRouter.JsonConverters
{
/// <inheritdoc />
public sealed class KeyBudgetResetIntervalJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::OpenRouter.KeyBudgetResetInterval>
{
/// <inheritdoc />
public override global::OpenRouter.KeyBudgetResetInterval 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.KeyBudgetResetIntervalExtensions.ToEnum(stringValue) ?? default;
}

break;
}
case global::System.Text.Json.JsonTokenType.Null:
{
return default(global::OpenRouter.KeyBudgetResetInterval);
}
default:
throw new global::System.ArgumentOutOfRangeException(nameof(reader));
}

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::OpenRouter.KeyBudgetResetInterval value,
global::System.Text.Json.JsonSerializerOptions options)
{
writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));

writer.WriteStringValue(global::OpenRouter.KeyBudgetResetIntervalExtensions.ToValueString(value));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#nullable enable

namespace OpenRouter.JsonConverters
{
/// <inheritdoc />
public sealed class KeyBudgetResetIntervalNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::OpenRouter.KeyBudgetResetInterval?>
{
/// <inheritdoc />
public override global::OpenRouter.KeyBudgetResetInterval? 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.KeyBudgetResetIntervalExtensions.ToEnum(stringValue);
}

break;
}
case global::System.Text.Json.JsonTokenType.Null:
{
return default(global::OpenRouter.KeyBudgetResetInterval?);
}
default:
throw new global::System.ArgumentOutOfRangeException(nameof(reader));
}

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::OpenRouter.KeyBudgetResetInterval? 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.KeyBudgetResetIntervalExtensions.ToValueString(value.Value));
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#nullable enable

namespace OpenRouter.JsonConverters
{
/// <inheritdoc />
public sealed class KeyBudgetScopeJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::OpenRouter.KeyBudgetScope>
{
/// <inheritdoc />
public override global::OpenRouter.KeyBudgetScope 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.KeyBudgetScopeExtensions.ToEnum(stringValue) ?? default;
}

break;
}
case global::System.Text.Json.JsonTokenType.Null:
{
return default(global::OpenRouter.KeyBudgetScope);
}
default:
throw new global::System.ArgumentOutOfRangeException(nameof(reader));
}

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::OpenRouter.KeyBudgetScope value,
global::System.Text.Json.JsonSerializerOptions options)
{
writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));

writer.WriteStringValue(global::OpenRouter.KeyBudgetScopeExtensions.ToValueString(value));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#nullable enable

namespace OpenRouter.JsonConverters
{
/// <inheritdoc />
public sealed class KeyBudgetScopeNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::OpenRouter.KeyBudgetScope?>
{
/// <inheritdoc />
public override global::OpenRouter.KeyBudgetScope? 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.KeyBudgetScopeExtensions.ToEnum(stringValue);
}

break;
}
case global::System.Text.Json.JsonTokenType.Null:
{
return default(global::OpenRouter.KeyBudgetScope?);
}
default:
throw new global::System.ArgumentOutOfRangeException(nameof(reader));
}

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::OpenRouter.KeyBudgetScope? 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.KeyBudgetScopeExtensions.ToValueString(value.Value));
}
}
}
}
Loading
Loading