api_openai 0.3.0

OpenAI's API for accessing large language models (LLMs).
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
// src/components/common.rs
//! Defines common data structures (components) used across various `OpenAI` API responses and requests.
//! Based on the components/schemas section of the `OpenAPI` specification.

/// Define a private namespace for all its items.
mod private
{
  // Use full paths from crate root for components
  use crate::components::tools as tools;

  // Standard library imports
  use std::collections::HashMap;
  // Serde imports
  use serde::{ Serialize, Deserialize };
  use serde_json::Value;
  use former::Former;
  // derive_tools import
  use derive_tools::From; // Import the derive macro

  /// Represents metadata as key-value pairs, allowing attachment of custom information.
  ///
  /// Set of 16 key-value pairs that can be attached to an object. This can be
  /// useful for storing additional information about the object in a structured
  /// format, and querying for objects via API or the dashboard.
  /// Keys are strings with a maximum length of 64 characters. Values are strings
  /// with a maximum length of 512 characters.
  ///
  /// # Used By
  /// - `/assistants` (POST)
  /// - `/assistants/{assistant_id}` (POST)
  /// - `/batches` (POST, GET)
  /// - `/batches/{batch_id}` (GET)
  /// - `/chat/completions` (GET, POST)
  /// - `/chat/completions/{completion_id}` (POST)
  /// - `/fine_tuning/jobs` (POST, GET)
  /// - `/fine_tuning/jobs/{fine_tuning_job_id}` (GET)
  /// - `/threads` (POST)
  /// - `/threads/{thread_id}` (POST)
  /// - `/threads/{thread_id}/messages` (POST)
  /// - `/threads/{thread_id}/messages/{message_id}` (POST)
  /// - `/threads/{thread_id}/runs` (POST)
  /// - `/threads/{thread_id}/runs/{run_id}` (POST)
  /// - `/threads/{thread_id}/runs/{run_id}/steps/{step_id}` (GET)
  /// - `/responses` (POST, GET)
  /// - `/responses/{response_id}` (GET)
  /// - `/vector_stores` (POST)
  /// - `/vector_stores/{vector_store_id}` (POST)
  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq, Default ) ]
  #[ serde( transparent ) ]
  pub struct Metadata
  (
    /// The underlying map storing key-value pairs.
    pub HashMap<  String, String  >
  );

  impl From< HashMap<  String, String  > > for Metadata
  {
    /// Creates Metadata from a `HashMap`.
    #[ inline ]
    fn from( map : HashMap<  String, String  > ) -> Self
    {
      Metadata( map )
    }
  }
  impl< const N : usize > From< [ ( &str, &str ); N ] > for Metadata
  {
    /// Creates Metadata from an array of string slice tuples.
    #[ inline ]
    fn from( arr : [ ( &str, &str ); N ] ) -> Self
    {
      Metadata( arr.into_iter().map( | ( k, v ) | ( k.to_string(), v.to_string() ) ).collect() )
    }
  }

  /// Represents an error object returned in specific contexts, like `last_error`.
  ///
  /// This structure holds a subset of the fields from the main `Error` object,
  /// typically used for errors associated with specific sub-objects (e.g., vector store files).
  ///
  /// # Used By (as `last_error` or similar nested error structure)
  /// - `VectorStoreFileObject` (within `/vector_stores/{vector_store_id}/files/{file_id}` GET)
  /// - `RunObject` (within `/threads/{thread_id}/runs/{run_id}` GET)
  /// - `RunStepObject` (within `/threads/{thread_id}/runs/{run_id}/steps/{step_id}` GET)
  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ] // Added Serialize
  pub struct ResponseError
  {
    /// A machine-readable error code string (e.g., "`server_error`", "`rate_limit_exceeded`").
    pub code : String,
    /// A human-readable description of the error.
    pub message : String,
  }

  /// Represents token usage statistics for a completed response.
  ///
  /// # Used By
  /// - `CreateChatCompletionResponse`
  /// - `CreateCompletionResponse`
  /// - `CreateEmbeddingResponse`
  /// - `RunObject`
  /// - `RunStepObject`
  /// - `Response`
  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ] // Added Serialize
  pub struct ResponseUsage
  {
    /// The number of prompt tokens.
    #[ serde( alias = "input_tokens" ) ]
    pub prompt_tokens : u32,
    /// The number of completion tokens (optional for embeddings).
    #[ serde( skip_serializing_if = "Option::is_none" ) ]
    #[ serde( alias = "output_tokens" ) ]
    pub completion_tokens : Option< u32 >,
    /// The total number of tokens used.
    pub total_tokens : u32,
  }

  /// Configuration for the text response format.
  ///
  /// # Used By
  /// - `TextResponseFormatConfigurationOptions`
  /// - `AssistantsApiResponseFormatOption`
  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq, Former ) ]
  pub struct TextResponseFormatConfiguration
  {
    /// The type of response format, must be "text".
    pub r#type : String,
  }
  impl Default for TextResponseFormatConfiguration
  {
    /// Creates a default configuration with `type` set to "text".
    #[ inline ]
    fn default() -> Self
    {
      Self { r#type : "text".to_string() }
    }
  }

  /// Wrapper for text response format with nested format field.
  ///
  /// # Used By
  /// - Response object deserialization
  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ]
  pub struct TextResponseFormatWrapper
  {
    /// The nested format configuration.
    pub format : TextResponseFormatConfiguration,
  }

  /// Represents a 2D coordinate (x, y).
  ///
  /// # Used By
  /// - `ComputerAction::Click`
  /// - `ComputerAction::DoubleClick`
  /// - `ComputerAction::Drag` (within path)
  /// - `ComputerAction::Move`
  /// - `ComputerAction::Scroll`
  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ]
  pub struct Coordinate
  {
    /// The x-coordinate.
    pub x : i64,
    /// The y-coordinate.
    pub y : i64,
  }

  /// Represents attributes for a vector store file.
  ///
  /// Set of 16 key-value pairs that can be attached to an object. This can be
  /// useful for storing additional information about the object in a structured
  /// format, and querying for objects via API or the dashboard. Keys are strings
  /// with a maximum length of 64 characters. Values are strings with a maximum
  /// length of 512 characters, booleans, or numbers.
  ///
  /// # Used By
  /// - `/vector_stores/{vector_store_id}/file_batches` (POST)
  /// - `/vector_stores/{vector_store_id}/files` (POST)
  /// - `/vector_stores/{vector_store_id}/files/{file_id}` (GET, POST)
  /// - `/vector_stores/{vector_store_id}/search` (POST)
  /// - `VectorStoreFileObject`
  /// - `VectorStoreSearchResultItem`
  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq, Default ) ] // Added Serialize
  #[ serde( transparent ) ]
  pub struct VectorStoreFileAttributes
  (
    /// The underlying map storing key-value pairs (string, number, or boolean).
    pub HashMap<  String, Value  >
  );

  /// Represents a generic API error structure, used in top-level error responses.
  ///
  /// # Used By
  /// - `ErrorResponse` (Wrapper for general API errors)
  /// - `RealtimeServerEventError` (Realtime API specific error event)
  /// - `FineTuningJob.error` (Error details for a fine-tuning job)
  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ]
  pub struct Error
  {
    /// The type of error (e.g., "`invalid_request_error`", "`api_error`").
    pub r#type : String,
    /// A human-readable description of the error.
    pub message : String,
    /// The specific parameter that caused the error, if applicable.
    pub param : Option< String >,
    /// A short machine-readable error code.
    pub code : Option< String >,
  }

  /// Represents a generic error response wrapper containing an `Error` object.
  ///
  /// Used as the schema for various error responses (e.g., 4xx, 5xx status codes)
  /// across multiple endpoints like:
  /// - `/organization/projects/{project_id}` (POST - update default project)
  /// - `/organization/projects/{project_id}/api_keys/{key_id}` (DELETE)
  /// - `/organization/projects/{project_id}/rate_limits/{rate_limit_id}` (POST)
  /// - `/organization/projects/{project_id}/service_accounts` (GET, POST)
  /// - `/organization/projects/{project_id}/users` (GET, POST)
  /// - `/organization/projects/{project_id}/users/{user_id}` (POST, DELETE)
  /// - `/responses/{response_id}` (DELETE - 404 Not Found)
  #[ derive( Debug, Deserialize, Clone, PartialEq ) ]
  pub struct ErrorResponse
  {
    /// The detailed error object.
    pub error : Error,
  }

  /// Represents log probability properties for a token.
  ///
  /// # Used By
  /// - `ChatCompletionTokenLogprob`
  /// - `LogProb`
  /// - `CreateTranscriptionResponseJson`
  /// - `TranscriptTextDeltaEvent`
  /// - `TranscriptTextDoneEvent`
  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ] // Added Serialize
  pub struct LogProbProperties
  {
    /// The token text.
    pub token : String,
    /// The log probability of this token.
    pub logprob : f64,
    /// A list of integers representing the UTF-8 bytes representation of the token. Can be null.
    pub bytes : Option< Vec< i32 > >,
  }

  /// Represents log probability information, including top alternative tokens.
  ///
  /// # Used By
  /// - `ChatCompletionTokenLogprob` (as `top_logprobs`)
  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ] // Added Serialize
  pub struct LogProb
  {
    /// The token text.
    pub token : String,
    /// The log probability of this token.
    pub logprob : f64,
    /// A list of integers representing the UTF-8 bytes representation of the token. Can be null.
    pub bytes : Option< Vec< i32 > >,
    /// List of the most likely alternative tokens and their log probabilities at this position.
    pub top_logprobs : Option< Vec< LogProbProperties > >,
  }

  /// Represents voice options for text-to-speech generation.
  ///
  /// # Used By
  /// - `/audio/speech` (POST)
  /// - `RealtimeSession`
  /// - `RealtimeSessionCreateResponse`
  /// - `RealtimeResponseCreateParams`
  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ]
  pub struct VoiceIdsShared( pub String );

  /// Represents audio response format options.
  ///
  /// # Used By
  /// - `/audio/speech` (POST)
  /// - `/audio/transcriptions` (POST)
  /// - `/audio/translations` (POST)
  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ]
  pub struct AudioResponseFormat
  {
    /// The selected audio format (e.g., "mp3", "wav", "json").
    pub value : String,
  }

  /// Represents options for including additional data in transcription responses.
  ///
  /// # Used By
  /// - `/audio/transcriptions` (POST)
  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ]
  pub struct TranscriptionInclude
  {
    /// The field to include (currently only "logprobs").
    pub value : String,
  }

  /// Represents model identifiers shared across multiple API endpoints.
  ///
  /// # Used By
  /// - `/chat/completions` (POST)
  /// - `/responses` (POST)
  /// - `/embeddings` (POST)
  /// - `/fine_tuning/jobs` (POST)
  /// - `/assistants` (POST)
  /// - `/assistants/{assistant_id}` (POST)
  /// - `/threads/runs` (POST)
  /// - `/threads/{thread_id}/runs` (POST)
  /// - `/models/{model}` (GET)
  /// - etc. (Many endpoints accept a model ID)
  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ]
  pub struct ModelIdsShared
  {
    /// The model identifier string (e.g., "gpt-5.1-chat-latest", "text-embedding-ada-002").
    pub value : String,
  }

  /// Represents model identifiers specific to the Responses API.
  ///
  /// # Used By
  /// - `/responses` (POST)
  /// - `ResponseProperties`
  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq, From ) ] // Added From derive
  #[ serde( transparent ) ]
  pub struct ModelIdsResponses
  {
    /// The model identifier string compatible with the Responses API.
    pub value : String,
  }

  /// Represents all possible model identifiers, handling different enum subsets.
  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ]
  #[ serde( untagged ) ]
  pub enum ModelIds
  {
    /// A raw string model identifier.
    String( String ),
    /// A model identifier from the shared set.
    Shared( ModelIdsShared ),
    /// A model identifier specific to the Responses API.
    Responses( ModelIdsResponses ),
  }

  /// Represents reasoning effort options for o-series models.
  ///
  /// # Used By
  /// - `/chat/completions` (POST)
  /// - `/responses` (POST)
  /// - `ResponseProperties`
  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ]
  #[ serde( transparent ) ]
  pub struct ReasoningEffort
  {
    /// The reasoning effort level ("low", "medium", "high").
    pub value : String,
  }

  /// Represents parallel tool call settings.
  ///
  /// # Used By
  /// - `/chat/completions` (POST)
  /// - `/responses` (POST)
  /// - `/assistants` (POST)
  /// - `/assistants/{assistant_id}` (POST)
  /// - `/threads/runs` (POST)
  /// - `/threads/{thread_id}/runs` (POST)
  /// - `FineTuneChatRequestInput`
  /// - `FineTunePreferenceInputData`
  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ]
  pub struct ParallelToolCalls
  {
    /// Whether parallel tool calls are enabled.
    pub value : bool,
  }

  /// Represents stop sequence configuration for completions.
  ///
  /// # Used By
  /// - `/chat/completions` (POST)
  /// - `/completions` (POST)
  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ]
  #[ serde( untagged ) ]
  pub enum StopConfiguration
  {
    /// A single stop sequence string.
    String( String ),
    /// An array of up to 4 stop sequence strings.
    Array( Vec< String > ),
  }

  /// Represents options for streaming chat completions.
  ///
  /// # Used By
  /// - `/chat/completions` (POST)
  /// - `/completions` (POST)
  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ]
  pub struct ChatCompletionStreamOptions
  {
    /// If set, an additional chunk with usage statistics will be streamed.
    pub include_usage : Option< bool >,
  }

  /// Represents includable fields in Responses API calls.
  ///
  /// # Used By
  /// - `/responses` (POST)
  /// - `/responses/{response_id}` (GET)
  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ]
  pub struct Includable
  {
    /// The field name to include (e.g., "`file_search_call.results`").
    pub value : String,
  }

  /// Represents the JSON object response format configuration.
  ///
  /// # Used By
  /// - `TextResponseFormatConfigurationOptions`
  /// - `AssistantsApiResponseFormatOption`
  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ]
  pub struct ResponseFormatJsonObject
  {
    /// The type, always "`json_object`".
    pub r#type : String,
  }

  /// Represents the JSON schema object used within `ResponseFormatJsonSchema`.
  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq, Default ) ]
  #[ serde( transparent ) ]
  pub struct ResponseFormatJsonSchemaSchema( pub serde_json::Value );

  /// Represents the JSON schema response format configuration.
  ///
  /// # Used By
  /// - `TextResponseFormatConfigurationOptions`
  /// - `AssistantsApiResponseFormatOption`
  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ]
  pub struct ResponseFormatJsonSchema
  {
    /// The type, always "`json_schema`".
    pub r#type : String,
    /// Details of the JSON schema.
    pub json_schema : ResponseFormatJsonSchemaSchemaDetails,
  }

  /// Details for the JSON schema response format.
  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ]
  pub struct ResponseFormatJsonSchemaSchemaDetails
  {
    /// The name of the response format.
    pub name : String,
    /// An optional description of the response format.
    pub description : Option< String >,
    /// The JSON schema object.
    pub schema : ResponseFormatJsonSchemaSchema,
    /// Whether to enable strict schema adherence. Defaults to false.
    pub strict : Option< bool >,
  }

  /// Represents the overall text response format configuration options.
  ///
  /// # Used By
  /// - `/chat/completions` (POST)
  /// - `ResponseProperties`
  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ]
  #[ serde( untagged ) ]
  pub enum TextResponseFormatConfigurationOptions
  {
    /// Plain text format.
    Text( TextResponseFormatConfiguration ),
    /// Text format with wrapper (for response deserialization).
    TextWrapper( TextResponseFormatWrapper ),
    /// JSON schema format.
    JsonSchema( ResponseFormatJsonSchema ),
    /// JSON object format.
    JsonObject( ResponseFormatJsonObject ),
  }

  /// Represents the reasoning configuration for o-series models.
  ///
  /// # Used By
  /// - `/chat/completions` (POST)
  /// - `/responses` (POST)
  /// - `ResponseProperties`
  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ]
  pub struct Reasoning
  {
    /// The desired reasoning effort level.
    pub effort : Option< ReasoningEffort >,
    /// Whether to generate a concise or detailed summary of reasoning.
    pub generate_summary : Option< String >, // Enum : concise, detailed
  }

  /// Represents the properties common to model responses across different APIs.
  ///
  /// # Used By
  /// - `CreateChatCompletionRequest`
  /// - `CreateResponse`
  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ]
  pub struct ModelResponseProperties
  {
    /// Optional metadata associated with the request.
    pub metadata : Option< Metadata >,
    /// Sampling temperature.
    pub temperature : Option< f32 >,
    /// Nucleus sampling probability.
    pub top_p : Option< f32 >,
    /// An identifier for the end-user.
    pub user : Option< String >,
  }

  /// Represents the properties specific to the main Response object.
  ///
  /// # Used By
  /// - `CreateResponse`
  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ]
  pub struct ResponseProperties
  {
    /// The ID of the previous response in a conversation.
    pub previous_response_id : Option< String >,
    /// The model used for the response. *** CHANGED TO String ***
    pub model : String,
    /// Reasoning configuration.
    pub reasoning : Option< Reasoning >,
    /// Maximum number of output tokens allowed.
    pub max_output_tokens : Option< i32 >,
    /// System instructions for the model.
    pub instructions : Option< String >,
    /// Text response format configuration.
    pub text : Option< TextResponseFormatConfigurationOptions >,
    /// List of available tools.
    pub tools : Option< Vec< tools::Tool > >,
    /// Strategy for choosing tools.
    pub tool_choice : Option< tools::ToolChoice >,
    /// Truncation strategy ("auto" or "disabled").
    pub truncation : Option< String >,
  }

  /// Represents the structure for a deleted response confirmation.
  ///
  /// # Used By
  /// - `/responses/{response_id}` (DELETE)
  #[ derive( Debug, Deserialize, Clone, PartialEq ) ]
  pub struct DeleteResponse
  {
    /// The ID of the deleted response.
    pub id : String,
    /// The object type, always "response.deleted".
    pub object : String,
    /// Indicates if the deletion was successful.
    pub deleted : bool,
  }

  /// Represents the structure for a deleted file confirmation.
  ///
  /// # Used By
  /// - `/files/{file_id}` (DELETE)
  #[ derive( Debug, Deserialize, Clone, PartialEq ) ]
  pub struct DeleteFileResponse
  {
    /// The ID of the deleted file.
    pub id : String,
    /// The object type, always "file".
    pub object : String,
    /// Indicates if the deletion was successful.
    pub deleted : bool,
  }

  /// Represents the structure for a deleted model confirmation.
  ///
  /// # Used By
  /// - `/models/{model}` (DELETE)
  #[ derive( Debug, Deserialize, Clone, PartialEq ) ]
  pub struct DeleteModelResponse
  {
    /// The ID of the deleted model.
    pub id : String,
    /// The object type, always "model".
    pub object : String,
    /// Indicates if the deletion was successful.
    pub deleted : bool,
  }

  /// Represents the structure for a deleted assistant confirmation.
  ///
  /// # Used By
  /// - `/assistants/{assistant_id}` (DELETE)
  #[ derive( Debug, Deserialize, Clone, PartialEq ) ]
  pub struct DeleteAssistantResponse
  {
    /// The ID of the deleted assistant.
    pub id : String,
    /// The object type, always "assistant.deleted".
    pub object : String,
    /// Indicates if the deletion was successful.
    pub deleted : bool,
  }

  /// Represents the structure for a deleted thread confirmation.
  ///
  /// # Used By
  /// - `/threads/{thread_id}` (DELETE)
  #[ derive( Debug, Deserialize, Clone, PartialEq ) ]
  pub struct DeleteThreadResponse
  {
    /// The ID of the deleted thread.
    pub id : String,
    /// The object type, always "thread.deleted".
    pub object : String,
    /// Indicates if the deletion was successful.
    pub deleted : bool,
  }

  /// Represents the structure for a deleted message confirmation.
  ///
  /// # Used By
  /// - `/threads/{thread_id}/messages/{message_id}` (DELETE)
  #[ derive( Debug, Deserialize, Clone, PartialEq ) ]
  pub struct DeleteMessageResponse
  {
    /// The ID of the deleted message.
    pub id : String,
    /// The object type, always "thread.message.deleted".
    pub object : String,
    /// Indicates if the deletion was successful.
    pub deleted : bool,
  }

  /// Represents the structure for a deleted vector store confirmation.
  ///
  /// # Used By
  /// - `/vector_stores/{vector_store_id}` (DELETE)
  #[ derive( Debug, Deserialize, Clone, PartialEq ) ]
  pub struct DeleteVectorStoreResponse
  {
    /// The ID of the deleted vector store.
    pub id : String,
    /// The object type, always "`vector_store.deleted`".
    pub object : String,
    /// Indicates if the deletion was successful.
    pub deleted : bool,
  }

  /// Represents the structure for a deleted vector store file confirmation.
  ///
  /// # Used By
  /// - `/vector_stores/{vector_store_id}/files/{file_id}` (DELETE)
  #[ derive( Debug, Deserialize, Clone, PartialEq ) ]
  pub struct DeleteVectorStoreFileResponse
  {
    /// The ID of the deleted vector store file.
    pub id : String,
    /// The object type, always "`vector_store.file.deleted`".
    pub object : String,
    /// Indicates if the deletion was successful.
    pub deleted : bool,
  }

  /// Represents the structure for a deleted fine-tuning checkpoint permission confirmation.
  ///
  /// # Used By
  /// - `/fine_tuning/checkpoints/{permission_id}/permissions` (DELETE)
  #[ derive( Debug, Deserialize, Clone, PartialEq ) ]
  pub struct DeleteFineTuningCheckpointPermissionResponse
  {
    /// The ID of the deleted permission.
    pub id : String,
    /// The object type, always "checkpoint.permission".
    pub object : String,
    /// Indicates if the deletion was successful.
    pub deleted : bool,
  }

  /// Represents the structure for a deleted invite confirmation.
  ///
  /// # Used By
  /// - `/organization/invites/{invite_id}` (DELETE)
  #[ derive( Debug, Deserialize, Clone, PartialEq ) ]
  pub struct InviteDeleteResponse
  {
    /// The ID of the deleted invite.
    pub id : String,
    /// The object type, always "organization.invite.deleted".
    pub object : String,
    /// Indicates if the deletion was successful.
    pub deleted : bool,
  }

  /// Represents the structure for a deleted project confirmation (Note : Projects are archived, not deleted).
  /// This might represent the response from an archive operation.
  ///
  /// # Used By
  /// - `/organization/projects/{project_id}/archive` (POST) - *Likely represents the archived project object*
  #[ derive( Debug, Deserialize, Clone, PartialEq ) ]
  pub struct ProjectDeleteResponse // Consider renaming to ProjectArchiveResponse if appropriate
  {
    /// The ID of the project.
    pub id : String,
    /// The object type, likely "organization.project".
    pub object : String,
    /// Indicates if the operation was successful (e.g., archived status).
    pub deleted : bool, // Or perhaps 'archived': bool
  }

  /// Represents the structure for a deleted project API key confirmation.
  ///
  /// # Used By
  /// - `/organization/projects/{project_id}/api_keys/{key_id}` (DELETE)
  #[ derive( Debug, Deserialize, Clone, PartialEq ) ]
  pub struct ProjectApiKeyDeleteResponse
  {
    /// The ID of the deleted API key.
    pub id : String,
    /// The object type, always "`organization.project.api_key.deleted`".
    pub object : String,
    /// Indicates if the deletion was successful.
    pub deleted : bool,
  }

  /// Represents the structure for a deleted project service account confirmation.
  ///
  /// # Used By
  /// - `/organization/projects/{project_id}/service_accounts/{service_account_id}` (DELETE)
  #[ derive( Debug, Deserialize, Clone, PartialEq ) ]
  pub struct ProjectServiceAccountDeleteResponse
  {
    /// The ID of the deleted service account.
    pub id : String,
    /// The object type, always "`organization.project.service_account.deleted`".
    pub object : String,
    /// Indicates if the deletion was successful.
    pub deleted : bool,
  }

  /// Represents the structure for a deleted project user confirmation.
  ///
  /// # Used By
  /// - `/organization/projects/{project_id}/users/{user_id}` (DELETE)
  #[ derive( Debug, Deserialize, Clone, PartialEq ) ]
  pub struct ProjectUserDeleteResponse
  {
    /// The ID of the deleted user from the project.
    pub id : String,
    /// The object type, always "organization.project.user.deleted".
    pub object : String,
    /// Indicates if the deletion was successful.
    pub deleted : bool,
  }

  /// Represents the structure for a deleted user confirmation.
  ///
  /// # Used By
  /// - `/organization/users/{user_id}` (DELETE)
  #[ derive( Debug, Deserialize, Clone, PartialEq ) ]
  pub struct UserDeleteResponse
  {
    /// The ID of the deleted user.
    pub id : String,
    /// The object type, always "organization.user.deleted".
    pub object : String,
    /// Indicates if the deletion was successful.
    pub deleted : bool,
  }

  /// Represents the structure for a default project error response.
  ///
  /// # Used By
  /// - `/organization/projects/{project_id}` (POST - when updating default project)
  #[ derive( Debug, Deserialize, Clone, PartialEq ) ]
  pub struct DefaultProjectErrorResponse
  {
    /// Error code.
    pub code : i32,
    /// Error message.
    pub message : String,
  }

  /// Represents usage statistics for completions, including token details.
  ///
  /// # Used By
  /// - `CreateChatCompletionResponse`
  /// - `CreateCompletionResponse`
  /// - `RunObject`
  /// - `RunStepObject`
  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ] // Added Serialize
  pub struct CompletionUsage
  {
    /// Number of tokens in the generated completion.
    pub completion_tokens : i32,
    /// Number of tokens in the prompt.
    pub prompt_tokens : i32,
    /// Total number of tokens used (prompt + completion).
    pub total_tokens : i32,
    /// Detailed breakdown of completion tokens.
    #[ serde( skip_serializing_if = "Option::is_none" ) ]
    pub completion_tokens_details : Option< CompletionTokensDetails >,
    /// Detailed breakdown of prompt tokens.
    #[ serde( skip_serializing_if = "Option::is_none" ) ]
    pub prompt_tokens_details : Option< PromptTokensDetails >,
  }

  /// Detailed breakdown of completion tokens.
  ///
  /// # Used By
  /// - `CompletionUsage`
  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ] // Added Serialize
  pub struct CompletionTokensDetails
  {
    /// Tokens from accepted predictions (Predicted Outputs feature).
    pub accepted_prediction_tokens : Option< i32 >,
    /// Audio output tokens generated by the model.
    pub audio_tokens : Option< i32 >,
    /// Tokens generated by the model for reasoning steps.
    pub reasoning_tokens : Option< i32 >,
    /// Tokens from rejected predictions (Predicted Outputs feature).
    pub rejected_prediction_tokens : Option< i32 >,
  }

  /// Detailed breakdown of prompt tokens.
  ///
  /// # Used By
  /// - `CompletionUsage`
  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ] // Added Serialize
  pub struct PromptTokensDetails
  {
    /// Audio input tokens present in the prompt.
    pub audio_tokens : Option< i32 >,
    /// Cached tokens present in the prompt (Prompt Caching feature).
    pub cached_tokens : Option< i32 >,
  }

  /// Represents query parameters for listing operations, specifically for pagination.
  ///
  /// # Used By
  /// - `/responses/{response_id}/input_items` (GET)
  #[ derive( Debug, Serialize, Deserialize, Clone, PartialEq ) ] // Removed From derive
  pub struct ListQuery
  {
    /// The maximum number of items to return.
    #[ serde( skip_serializing_if = "Option::is_none" ) ] // Add skip_serializing_if
    pub limit : Option< u32 >,
  }
} // end mod private

crate ::mod_interface!
{
  exposed use
  {
    Metadata,
    ResponseError,
    ResponseUsage,
    TextResponseFormatConfiguration,
    Coordinate,
    VectorStoreFileAttributes,
    Error,
    ErrorResponse,
    LogProbProperties,
    LogProb,
    VoiceIdsShared,
    AudioResponseFormat,
    TranscriptionInclude,
    ModelIdsShared,
    ModelIdsResponses,
    ModelIds,
    ReasoningEffort,
    ParallelToolCalls,
    StopConfiguration,
    ChatCompletionStreamOptions,
    Includable,
    ResponseFormatJsonObject,
    ResponseFormatJsonSchemaSchema,
    ResponseFormatJsonSchema,
    ResponseFormatJsonSchemaSchemaDetails,
    TextResponseFormatConfigurationOptions,
    Reasoning,
    ModelResponseProperties,
    ResponseProperties,
    DeleteResponse,
    DeleteFileResponse,
    DeleteModelResponse,
    DeleteAssistantResponse,
    DeleteThreadResponse,
    DeleteMessageResponse,
    DeleteVectorStoreResponse,
    DeleteVectorStoreFileResponse,
    DeleteFineTuningCheckpointPermissionResponse,
    InviteDeleteResponse,
    ProjectDeleteResponse,
    ProjectApiKeyDeleteResponse,
    ProjectServiceAccountDeleteResponse,
    ProjectUserDeleteResponse,
    UserDeleteResponse,
    DefaultProjectErrorResponse,
    CompletionUsage,
    CompletionTokensDetails,
    PromptTokensDetails,
    ListQuery,
  };
}