Skip to content

Commit 4af6155

Browse files
committed
oai: gpt-5.3-codex
1 parent 9544470 commit 4af6155

File tree

5 files changed

+111
-9
lines changed

5 files changed

+111
-9
lines changed

src/LlmTornado.Microsoft.Extensions.AI/LlmTornado.Microsoft.Extensions.AI.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
</ItemGroup>
3232

3333
<ItemGroup>
34-
<PackageReference Include="Microsoft.Extensions.AI" Version="[10.1.0, )" />
35-
<PackageReference Include="Microsoft.Extensions.AI.Abstractions" Version="[10.1.0, )" />
34+
<PackageReference Include="Microsoft.Extensions.AI" Version="[10.3.0, )" />
35+
<PackageReference Include="Microsoft.Extensions.AI.Abstractions" Version="[10.3.0, )" />
3636
<PackageReference Include="OpenTelemetry" Version="[1.14.0, )" />
3737
<PackageReference Include="OpenTelemetry.Api" Version="[1.14.0, )" />
3838
</ItemGroup>

src/LlmTornado/Chat/Models/OpenAi/ChatModelOpenAi.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ public class ChatModelOpenAi : BaseVendorModelProvider
4444
/// </summary>
4545
public readonly ChatModelOpenAiGpt52 Gpt52 = new ChatModelOpenAiGpt52();
4646

47+
/// <summary>
48+
/// GPT-5.3 models.
49+
/// </summary>
50+
public readonly ChatModelOpenAiGpt53 Gpt53 = new ChatModelOpenAiGpt53();
51+
4752
/// <summary>
4853
/// O3 models.
4954
/// </summary>
@@ -93,14 +98,14 @@ public override bool OwnsModel(string model)
9398
/// </summary>
9499
public static List<IModel> ModelsAll => LazyModelsAll.Value;
95100

96-
private static readonly Lazy<List<IModel>> LazyModelsAll = new Lazy<List<IModel>>(() => [..ChatModelOpenAiGpt35.ModelsAll, ..ChatModelOpenAiGpt4.ModelsAll, ..ChatModelOpenAiO3.ModelsAll, ..ChatModelOpenAiO4.ModelsAll, ..ChatModelOpenAiGpt41.ModelsAll, ..ChatModelOpenAiGpt5.ModelsAll, ..ChatModelOpenAiGpt51.ModelsAll, ..ChatModelOpenAiGpt52.ModelsAll, ..ChatModelOpenAiCodex.ModelsAll]);
101+
private static readonly Lazy<List<IModel>> LazyModelsAll = new Lazy<List<IModel>>(() => [..ChatModelOpenAiGpt35.ModelsAll, ..ChatModelOpenAiGpt4.ModelsAll, ..ChatModelOpenAiO3.ModelsAll, ..ChatModelOpenAiO4.ModelsAll, ..ChatModelOpenAiGpt41.ModelsAll, ..ChatModelOpenAiGpt5.ModelsAll, ..ChatModelOpenAiGpt51.ModelsAll, ..ChatModelOpenAiGpt52.ModelsAll, ..ChatModelOpenAiGpt53.ModelsAll, ..ChatModelOpenAiCodex.ModelsAll]);
97102

98103
/// <summary>
99104
/// All reasoning models. Requests for these models are serialized differently.
100105
/// </summary>
101106
public static List<IModel> ReasoningModelsAll => LazyReasoningModelsAll.Value;
102107

103-
private static readonly Lazy<List<IModel>> LazyReasoningModelsAll = new Lazy<List<IModel>>(() => [..ChatModelOpenAiGpt4.ReasoningModels, ..ChatModelOpenAiO3.ModelsAll, ..ChatModelOpenAiO4.ModelsAll, ..ChatModelOpenAiGpt5.ModelsAll, ..ChatModelOpenAiGpt51.ModelsAll, ..ChatModelOpenAiGpt52.ModelsAll]);
108+
private static readonly Lazy<List<IModel>> LazyReasoningModelsAll = new Lazy<List<IModel>>(() => [..ChatModelOpenAiGpt4.ReasoningModels, ..ChatModelOpenAiO3.ModelsAll, ..ChatModelOpenAiO4.ModelsAll, ..ChatModelOpenAiGpt5.ModelsAll, ..ChatModelOpenAiGpt51.ModelsAll, ..ChatModelOpenAiGpt52.ModelsAll, ..ChatModelOpenAiGpt53.ModelsAll]);
104109

105110
/// <summary>
106111
/// HashSet version of ReasoningModelsAll.
@@ -114,7 +119,7 @@ public override bool OwnsModel(string model)
114119
/// </summary>
115120
public static List<IModel> WebSearchCompatibleModelsAll => LazyWebSearchCompatibleModelsAll.Value;
116121

117-
private static readonly Lazy<List<IModel>> LazyWebSearchCompatibleModelsAll = new Lazy<List<IModel>>(() => [ChatModelOpenAiGpt4.ModelOSearchPreview, ChatModelOpenAiGpt4.ModelOMiniSearchPreview, ..ChatModelOpenAiGpt5.ModelsAll, ..ChatModelOpenAiGpt51.ModelsAll, ..ChatModelOpenAiGpt52.ModelsAll]);
122+
private static readonly Lazy<List<IModel>> LazyWebSearchCompatibleModelsAll = new Lazy<List<IModel>>(() => [ChatModelOpenAiGpt4.ModelOSearchPreview, ChatModelOpenAiGpt4.ModelOMiniSearchPreview, ..ChatModelOpenAiGpt5.ModelsAll, ..ChatModelOpenAiGpt51.ModelsAll, ..ChatModelOpenAiGpt52.ModelsAll, ..ChatModelOpenAiGpt53.ModelsAll]);
118123

119124
internal static HashSet<IModel> TempIncompatibleModels => LazyTempIncompatibleModels.Value;
120125

@@ -137,7 +142,7 @@ public override bool OwnsModel(string model)
137142
internal static HashSet<IModel> SamplingParamsConditionallySupported => LazySamplingParamsConditionallySupported.Value;
138143

139144
private static readonly Lazy<HashSet<IModel>> LazySamplingParamsConditionallySupported = new Lazy<HashSet<IModel>>(() => [
140-
..ChatModelOpenAiGpt51.ModelsAll, ..ChatModelOpenAiGpt52.ModelsAll
145+
..ChatModelOpenAiGpt51.ModelsAll, ..ChatModelOpenAiGpt52.ModelsAll, ..ChatModelOpenAiGpt53.ModelsAll
141146
]);
142147

143148
/// <summary>
@@ -175,7 +180,7 @@ internal static bool ShouldClearSamplingParams(IModel? model, bool hasNonNoneRea
175180
public static List<IModel> AudioModelsAll => LazyAudioModelsAll.Value;
176181

177182
private static readonly Lazy<List<IModel>> LazyAudioModelsAll = new Lazy<List<IModel>>(() => [
178-
ChatModelOpenAiGpt5.ModelAudio, ChatModelOpenAiGpt5.ModelAudioMini, ChatModelOpenAiGpt4.ModelAudioPreview, ChatModelOpenAiGpt4.ModelAudioPreview241001, ChatModelOpenAiGpt4.ModelAudioPreview241217,
183+
ChatModelOpenAiGpt5.ModelAudio, ChatModelOpenAiGpt5.ModelAudioMini, ChatModelOpenAiGpt5.ModelAudio15, ChatModelOpenAiGpt4.ModelAudioPreview, ChatModelOpenAiGpt4.ModelAudioPreview241001, ChatModelOpenAiGpt4.ModelAudioPreview241217,
179184
ChatModelOpenAiGpt4.ModelAudioPreview250603
180185
]);
181186

src/LlmTornado/Chat/Models/OpenAi/ChatModelOpenAiGpt5.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,21 @@ public class ChatModelOpenAiGpt5 : IVendorModelClassProvider
9898
/// </summary>
9999
public readonly ChatModel V5Nano = ModelV5Nano;
100100

101+
/// <summary>
102+
/// GPT-Audio-1.5 is the best voice model for audio in, audio out with Chat Completions.
103+
/// Accepts text and audio inputs, produces text and audio outputs.
104+
/// 128,000 context window, 16,384 max output tokens, Sep 30, 2024 knowledge cutoff.
105+
/// </summary>
106+
public static readonly ChatModel ModelAudio15 = new ChatModel("gpt-audio-1.5", LLmProviders.OpenAi, 128_000)
107+
{
108+
EndpointCapabilities = [ ChatModelEndpointCapabilities.Chat ]
109+
};
110+
111+
/// <summary>
112+
/// <inheritdoc cref="ModelAudio15"/>
113+
/// </summary>
114+
public readonly ChatModel Audio15 = ModelAudio15;
115+
101116
/// <summary>
102117
/// Realtime Mini - optimized for low-latency, real-time interactions.
103118
/// </summary>
@@ -117,7 +132,7 @@ public class ChatModelOpenAiGpt5 : IVendorModelClassProvider
117132
public static List<IModel> ModelsAll => LazyModelsAll.Value;
118133

119134
private static readonly Lazy<List<IModel>> LazyModelsAll = new Lazy<List<IModel>>(() => [
120-
ModelV5, ModelV5Mini, ModelV5Nano, ModelV5Codex, ModelV5Pro, ModelAudioMini, ModelRealtimeMini
135+
ModelV5, ModelV5Mini, ModelV5Nano, ModelV5Codex, ModelV5Pro, ModelAudioMini, ModelAudio15, ModelRealtimeMini
121136
]);
122137

123138
/// <summary>
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using LlmTornado.Code;
4+
using LlmTornado.Code.Models;
5+
6+
namespace LlmTornado.Chat.Models;
7+
8+
/// <summary>
9+
/// GPT-5.3 class models from OpenAI.
10+
/// </summary>
11+
public class ChatModelOpenAiGpt53 : IVendorModelClassProvider
12+
{
13+
/// <summary>
14+
/// GPT-5.3-Codex is the most capable agentic coding model, optimized for agentic coding tasks in Codex or similar environments.
15+
/// Supports low, medium, high, and xhigh reasoning effort settings.
16+
/// 400,000 context window, 128,000 max output tokens, Aug 31, 2025 knowledge cutoff.
17+
/// </summary>
18+
public static readonly ChatModel ModelV53Codex = new ChatModel("gpt-5.3-codex", LLmProviders.OpenAi, 400_000, [])
19+
{
20+
EndpointCapabilities = [ ChatModelEndpointCapabilities.Responses, ChatModelEndpointCapabilities.Batch ]
21+
};
22+
23+
/// <summary>
24+
/// <inheritdoc cref="ModelV53Codex"/>
25+
/// </summary>
26+
public readonly ChatModel V53Codex = ModelV53Codex;
27+
28+
/// <summary>
29+
/// All known GPT-5.3 models from OpenAI.
30+
/// </summary>
31+
public static List<IModel> ModelsAll => LazyModelsAll.Value;
32+
33+
private static readonly Lazy<List<IModel>> LazyModelsAll = new Lazy<List<IModel>>(() => [
34+
ModelV53Codex
35+
]);
36+
37+
/// <summary>
38+
/// <inheritdoc cref="ModelsAll"/>
39+
/// </summary>
40+
public List<IModel> AllModels => ModelsAll;
41+
42+
internal ChatModelOpenAiGpt53()
43+
{
44+
45+
}
46+
}

src/LlmTornado/Responses/ResponseInputContent.cs

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,12 @@ public class ResponseInputContentFile : ResponseInputContent
195195
[JsonProperty("file_data")]
196196
public string? FileData { get; set; }
197197

198+
/// <summary>
199+
/// The URL of the file to be sent to the model.
200+
/// </summary>
201+
[JsonProperty("file_url")]
202+
public string? FileUrl { get; set; }
203+
198204
/// <summary>
199205
/// Creates a new, empty <see cref="ResponseInputContentFile"/>.
200206
/// </summary>
@@ -219,6 +225,30 @@ public ResponseInputContentFile(string filename, string fileData)
219225
Filename = filename;
220226
FileData = fileData;
221227
}
228+
229+
/// <summary>
230+
/// Creates a <see cref="ResponseInputContentFile"/> referencing an external URL.
231+
/// </summary>
232+
public static ResponseInputContentFile CreateFromUrl(string fileUrl)
233+
{
234+
return new ResponseInputContentFile { FileUrl = fileUrl };
235+
}
236+
237+
/// <summary>
238+
/// Creates a <see cref="ResponseInputContentFile"/> referencing a file uploaded via the Files API.
239+
/// </summary>
240+
public static ResponseInputContentFile CreateFromFileId(string fileId)
241+
{
242+
return new ResponseInputContentFile { FileId = fileId };
243+
}
244+
245+
/// <summary>
246+
/// Creates a <see cref="ResponseInputContentFile"/> with Base64-encoded file data.
247+
/// </summary>
248+
public static ResponseInputContentFile CreateFromBase64(string filename, string fileData)
249+
{
250+
return new ResponseInputContentFile { Filename = filename, FileData = fileData };
251+
}
222252
}
223253

224254
/// <summary>
@@ -285,6 +315,11 @@ public override void WriteJson(JsonWriter writer, ResponseInputContent? value, J
285315
writer.WritePropertyName("file_data");
286316
writer.WriteValue(fileContent.FileData);
287317
}
318+
if (!string.IsNullOrEmpty(fileContent.FileUrl))
319+
{
320+
writer.WritePropertyName("file_url");
321+
writer.WriteValue(fileContent.FileUrl);
322+
}
288323
break;
289324
}
290325
default:
@@ -330,7 +365,8 @@ public override void WriteJson(JsonWriter writer, ResponseInputContent? value, J
330365
{
331366
FileId = jo["file_id"]?.ToString(),
332367
Filename = jo["filename"]?.ToString(),
333-
FileData = jo["file_data"]?.ToString()
368+
FileData = jo["file_data"]?.ToString(),
369+
FileUrl = jo["file_url"]?.ToString()
334370
};
335371
return fileContent;
336372
}

0 commit comments

Comments
 (0)