-
Notifications
You must be signed in to change notification settings - Fork 343
Closed as not planned
Closed as not planned
Copy link
Labels
area: externalThis issue is regarding an external experience, such as a companion service or client.This issue is regarding an external experience, such as a companion service or client.issue-addressedWorkflow: The OpenAI maintainers believe the issue to be addressed and ready to close.Workflow: The OpenAI maintainers believe the issue to be addressed and ready to close.questionCategory: The issue is seeking information about the library or its usage.Category: The issue is seeking information about the library or its usage.
Description
Describe the bug
I use OpanAI dotnet sdk to call ModelScope's OpenAI compatible API , and get deserialization error:
Unhandled exception. System.ArgumentOutOfRangeException: Valid values are between -62135596800 and 253402300799, inclusive. (Parameter 'seconds')
at System.DateTimeOffset.FromUnixTimeSeconds(Int64 seconds)
at OpenAI.Chat.StreamingChatCompletionUpdate.DeserializeStreamingChatCompletionUpdate(JsonElement element, ModelReaderWriterOptions options)
at OpenAI.AsyncSseUpdateCollection`1.<>c__DisplayClass13_0`1.<DeserializeSseToSingleViaJson>b__0(JsonElement e, ModelReaderWriterOptions o)
at OpenAI.AsyncSseUpdateCollection`1.<>c__DisplayClass12_0`1.<DeserializeSseToMultipleViaJson>b__0(SseItem`1 item)
at OpenAI.AsyncSseUpdateCollection`1.AsyncSseUpdateEnumerator`1.System.Collections.Generic.IAsyncEnumerator<U>.MoveNextAsync()
at OpenAI.AsyncSseUpdateCollection`1.GetValuesFromPageAsync(ClientResult page)+MoveNext()
at OpenAI.AsyncSseUpdateCollection`1.GetValuesFromPageAsync(ClientResult page)+MoveNext()
at OpenAI.AsyncSseUpdateCollection`1.GetValuesFromPageAsync(ClientResult page)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
at System.ClientModel.AsyncCollectionResult`1.GetAsyncEnumerator(CancellationToken cancellationToken)+MoveNext()
at System.ClientModel.AsyncCollectionResult`1.GetAsyncEnumerator(CancellationToken cancellationToken)+MoveNext()
at System.ClientModel.AsyncCollectionResult`1.GetAsyncEnumerator(CancellationToken cancellationToken)+MoveNext()
at System.ClientModel.AsyncCollectionResult`1.GetAsyncEnumerator(CancellationToken cancellationToken)+System.Threading.Tasks.Sources.IValueTaskSource<System.Boolean>.GetResult()
at Program.<Main>$(String[] args) in /Users/zhang/Developer/dotnet/mcp/AgentDemo/Program.cs:line 39
at Program.<Main>$(String[] args) in /Users/zhang/Developer/dotnet/mcp/AgentDemo/Program.cs:line 39
at Program.<Main>(String[] args)
Steps to reproduce
Just run the flowing code:
using System.ClientModel;
using OpenAI;
var apiKey = Environment.GetEnvironmentVariable("MODEL_SCOPE_API_KEY");
var baseUrl = Environment.GetEnvironmentVariable("MODEL_SCOPE_BASE_URL"); // https://api-inference.modelscope.cn/v1/
var model = "Qwen/Qwen3-235B-A22B-Thinking-2507";
var openai = new OpenAIClient(
new ApiKeyCredential(apiKey!),
new OpenAIClientOptions {
Endpoint = new Uri(baseUrl!)
}
);
var chat = openai.GetChatClient(model);
var messages = new List<OpenAI.Chat.ChatMessage> {
OpenAI.Chat.ChatMessage.CreateUserMessage("hello")
};
var stream = chat.CompleteChatStreamingAsync(messages);
await foreach (var update in stream) {
Console.Write(update.ContentUpdate[0].Text);
}The timestamp returned for created is 1760171895500 , which is larger than 253402300799, is a milli second timestamp, should use DateTimeOffset.FromUnixTimeMilliseconds() to deserialize.
Code snippets
OS
macOS
.NET version
9.0
Library version
2.5.0
Metadata
Metadata
Assignees
Labels
area: externalThis issue is regarding an external experience, such as a companion service or client.This issue is regarding an external experience, such as a companion service or client.issue-addressedWorkflow: The OpenAI maintainers believe the issue to be addressed and ready to close.Workflow: The OpenAI maintainers believe the issue to be addressed and ready to close.questionCategory: The issue is seeking information about the library or its usage.Category: The issue is seeking information about the library or its usage.