claude-sdk 2.1.0

Native Rust SDK for the Claude API with streaming support and tool execution
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
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
//! Model identifiers and metadata for Claude models.
//!
//! This module provides constants and metadata for all available Claude models,
//! including constraints like context windows, output limits, and capabilities.
//!
//! # Available Models
//!
//! ## Latest (Claude 5)
//!
//! | Model | Best For | Max Output | Extended Thinking |
//! |-------|----------|------------|-------------------|
//! | [`CLAUDE_FABLE_5`] | Hardest knowledge work and coding | 64K | Yes |
//! | [`CLAUDE_MYTHOS_5`] | Cybersecurity and biology research | 64K | Yes |
//!
//! ## Claude 4.x
//!
//! | Model | Best For | Max Output | Extended Thinking |
//! |-------|----------|------------|-------------------|
//! | [`CLAUDE_OPUS_4_8`] | Long-running agents/coding | 64K | Yes |
//! | [`CLAUDE_OPUS_4_7`] | Long-running agents/coding | 64K | Yes |
//! | [`CLAUDE_OPUS_4_6`] | Long-running agents/coding | 64K | Yes |
//! | [`CLAUDE_SONNET_4_6`] | Best balance of speed and intelligence | 64K | Yes |
//! | [`CLAUDE_SONNET_4_5`] | Complex agents, coding | 64K | Yes |
//! | [`CLAUDE_HAIKU_4_5`] | Speed, near-frontier intelligence | 64K | Yes |
//! | [`CLAUDE_OPUS_4_5`] | Maximum intelligence | 64K | Yes |
//!
//! ## Legacy (Claude 4.x and 3.x)
//!
//! | Model | Best For | Max Output |
//! |-------|----------|------------|
//! | [`CLAUDE_OPUS_4_1`] | Previous generation powerful | 32K |
//! | [`CLAUDE_SONNET_4`] | Balanced performance | 64K |
//! | [`CLAUDE_OPUS_4`] | Claude 4 powerful | 32K |
//! | [`CLAUDE_HAIKU_3_5`] | Fast and efficient | 8K |
//! | [`CLAUDE_HAIKU_3`] | Original fast model | 4K |
//!
//! # Usage Examples
//!
//! ## Basic Model Selection
//!
//! ```rust
//! use claude_sdk::models::{CLAUDE_SONNET_4_5, CLAUDE_OPUS_4_5};
//!
//! let model = CLAUDE_SONNET_4_5;
//! println!("Model: {} ({})", model.name, model.anthropic_id);
//! println!("Max output: {} tokens", model.max_output_tokens);
//! println!("Supports vision: {}", model.supports_vision);
//! println!("Supports thinking: {}", model.supports_extended_thinking);
//! ```
//!
//! ## Model Lookup
//!
//! ```rust
//! use claude_sdk::models::{get_model, get_model_by_anthropic_id};
//!
//! // Lookup by any ID format
//! let model = get_model("claude-sonnet-4-5-20250929").unwrap();
//! assert_eq!(model.name, "Claude Sonnet 4.5");
//!
//! // Lookup by Anthropic ID specifically
//! let model = get_model_by_anthropic_id("claude-sonnet-4-5-20250929").unwrap();
//! ```
//!
//! ## Cost Estimation
//!
//! ```rust
//! use claude_sdk::models::CLAUDE_SONNET_4_5;
//!
//! // Estimate cost for 10K input + 2K output tokens
//! let cost = CLAUDE_SONNET_4_5.estimate_cost(10_000, 2_000);
//! println!("Estimated cost: ${:.4}", cost);  // ~$0.06
//! ```
//!
//! ## AWS Bedrock Regions
//!
//! ```rust
//! use claude_sdk::models::{CLAUDE_SONNET_4_5, BedrockRegion};
//!
//! // Get model ID for different Bedrock endpoints
//! let standard = CLAUDE_SONNET_4_5.bedrock_id_for_region(BedrockRegion::Standard);
//! let global = CLAUDE_SONNET_4_5.bedrock_id_for_region(BedrockRegion::Global);
//! let us = CLAUDE_SONNET_4_5.bedrock_id_for_region(BedrockRegion::US);
//! ```

/// Model capabilities and constraints
#[derive(Debug, Clone, PartialEq)]
pub struct Model {
    /// Human-readable model name
    pub name: &'static str,

    /// Model family (e.g., "sonnet", "opus", "haiku")
    pub family: &'static str,

    /// Release date/version identifier
    pub version: &'static str,

    /// Anthropic API model identifier
    pub anthropic_id: &'static str,

    /// AWS Bedrock regional endpoint model identifier (if available)
    pub bedrock_id: Option<&'static str>,

    /// AWS Bedrock global endpoint model identifier (if available)
    ///
    /// Claude 4.5+ models support global endpoints for dynamic routing.
    /// Use this for maximum availability across regions.
    pub bedrock_global_id: Option<&'static str>,

    /// Google Vertex AI model identifier (if available)
    pub vertex_id: Option<&'static str>,

    /// Maximum context window in tokens (standard)
    pub max_context_tokens: u32,

    /// Extended context window in tokens (if available)
    ///
    /// Some models support extended context with beta headers.
    /// For example, Claude Sonnet 4.5 and Sonnet 4 support 1M tokens
    /// with the `context-1m-2025-08-07` beta header.
    pub max_context_tokens_extended: Option<u32>,

    /// Maximum output tokens per request
    pub max_output_tokens: u32,

    /// Supports vision (image inputs)
    pub supports_vision: bool,

    /// Supports tool use
    pub supports_tools: bool,

    /// Supports prompt caching
    pub supports_caching: bool,

    /// Supports extended thinking
    pub supports_extended_thinking: bool,

    /// Supports effort parameter (beta)
    ///
    /// Requires beta header: `anthropic-beta: effort-2025-11-24`
    /// Currently only Claude Opus 4.5
    pub supports_effort: bool,

    /// Cost per million input tokens (USD)
    pub cost_per_mtok_input: f64,

    /// Cost per million output tokens (USD)
    pub cost_per_mtok_output: f64,

    /// Brief description of best use cases
    pub description: &'static str,
}

/// AWS Bedrock endpoint region configuration.
///
/// Bedrock supports different endpoint types for accessing Claude models.
/// Use this enum to generate the appropriate model ID for your endpoint.
///
/// # Example
///
/// ```rust
/// use claude_sdk::models::{CLAUDE_SONNET_4_5, BedrockRegion};
///
/// // Standard regional endpoint (most common)
/// let model_id = CLAUDE_SONNET_4_5.bedrock_id_for_region(BedrockRegion::Standard);
/// // → "anthropic.claude-sonnet-4-5-20250929-v1:0"
///
/// // Global endpoint for better availability
/// let model_id = CLAUDE_SONNET_4_5.bedrock_id_for_region(BedrockRegion::Global);
/// // → "global.anthropic.claude-sonnet-4-5-20250929-v1:0"
/// ```
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum BedrockRegion {
    /// Standard regional endpoint.
    ///
    /// The default endpoint type, tied to your specific AWS region.
    /// Use this when you want predictable latency and data residency.
    ///
    /// Model ID format: `anthropic.claude-{model}-v1:0`
    Standard,

    /// Global endpoint with dynamic routing.
    ///
    /// Automatically routes requests to the best available region for
    /// maximum availability and reduced latency. Only available for
    /// Claude 4.5+ models.
    ///
    /// Model ID format: `global.anthropic.claude-{model}-v1:0`
    Global,

    /// US regional endpoint.
    ///
    /// Routes requests within the United States for data residency
    /// compliance while still allowing some routing flexibility.
    ///
    /// Model ID format: `us.anthropic.claude-{model}-v1:0`
    US,

    /// EU regional endpoint.
    ///
    /// Routes requests within the European Union for GDPR compliance
    /// and EU data residency requirements.
    ///
    /// Model ID format: `eu.anthropic.claude-{model}-v1:0`
    EU,

    /// Asia-Pacific regional endpoint.
    ///
    /// Routes requests within the Asia-Pacific region for reduced
    /// latency in APAC deployments.
    ///
    /// Model ID format: `ap.anthropic.claude-{model}-v1:0`
    AsiaPacific,
}

impl BedrockRegion {
    /// Get the prefix for this region
    pub fn prefix(&self) -> &'static str {
        match self {
            BedrockRegion::Standard => "",
            BedrockRegion::Global => "global.",
            BedrockRegion::US => "us.",
            BedrockRegion::EU => "eu.",
            BedrockRegion::AsiaPacific => "ap.",
        }
    }
}

impl Model {
    /// Get the model ID for the Anthropic API
    pub fn anthropic_id(&self) -> &'static str {
        self.anthropic_id
    }

    /// Get the model ID for AWS Bedrock regional endpoint (if available)
    pub fn bedrock_id(&self) -> Option<&'static str> {
        self.bedrock_id
    }

    /// Get the model ID for AWS Bedrock with a specific region prefix
    ///
    /// # Example
    ///
    /// ```rust
    /// use claude_sdk::models::{CLAUDE_SONNET_4_5, BedrockRegion};
    ///
    /// // Standard regional endpoint
    /// let regional = CLAUDE_SONNET_4_5.bedrock_id_for_region(BedrockRegion::Standard);
    /// // → Some("anthropic.claude-sonnet-4-5-20250929-v1:0")
    ///
    /// // Global endpoint
    /// let global = CLAUDE_SONNET_4_5.bedrock_id_for_region(BedrockRegion::Global);
    /// // → Some("global.anthropic.claude-sonnet-4-5-20250929-v1:0")
    ///
    /// // US regional endpoint
    /// let us = CLAUDE_SONNET_4_5.bedrock_id_for_region(BedrockRegion::US);
    /// // → Some("us.anthropic.claude-sonnet-4-5-20250929-v1:0")
    /// ```
    pub fn bedrock_id_for_region(&self, region: BedrockRegion) -> Option<String> {
        self.bedrock_id.map(|id| {
            let prefix = region.prefix();
            if prefix.is_empty() {
                id.to_string()
            } else {
                format!("{}{}", prefix, id)
            }
        })
    }

    /// Get the model ID for AWS Bedrock global endpoint (if available)
    ///
    /// Global endpoints provide dynamic routing for maximum availability.
    /// Available for Claude 4.5+ models.
    ///
    /// This is a convenience method equivalent to `bedrock_id_for_region(BedrockRegion::Global)`.
    pub fn bedrock_global_id(&self) -> Option<&'static str> {
        self.bedrock_global_id
    }

    /// Get the model ID for Google Vertex AI (if available)
    pub fn vertex_id(&self) -> Option<&'static str> {
        self.vertex_id
    }

    /// Check if this model supports extended context (e.g., 1M tokens)
    pub fn supports_extended_context(&self) -> bool {
        self.max_context_tokens_extended.is_some()
    }

    /// Get the extended context window size (if supported)
    ///
    /// Returns `Some(tokens)` if the model supports extended context with beta headers.
    /// For example, Claude Sonnet 4.5 returns `Some(1_000_000)`.
    ///
    /// # Beta Header Required
    ///
    /// To use extended context, include the beta header in your API request:
    /// - Header: `anthropic-beta: context-1m-2025-08-07`
    ///
    /// Note: Extended context may incur additional costs beyond 200K tokens.
    pub fn max_extended_context(&self) -> Option<u32> {
        self.max_context_tokens_extended
    }

    /// Validate that a request is compatible with this model's constraints
    ///
    /// # Parameters
    /// - `max_tokens`: The requested maximum output tokens
    /// - `use_extended_context`: Whether extended context will be used
    pub fn validate_request(
        &self,
        max_tokens: u32,
        use_extended_context: bool,
    ) -> Result<(), String> {
        if max_tokens > self.max_output_tokens {
            return Err(format!(
                "Requested max_tokens ({}) exceeds model limit ({})",
                max_tokens, self.max_output_tokens
            ));
        }

        if use_extended_context && !self.supports_extended_context() {
            return Err(format!(
                "Model {} does not support extended context",
                self.name
            ));
        }

        Ok(())
    }

    /// Estimate cost for a request
    pub fn estimate_cost(&self, input_tokens: u32, output_tokens: u32) -> f64 {
        (input_tokens as f64 / 1_000_000.0) * self.cost_per_mtok_input
            + (output_tokens as f64 / 1_000_000.0) * self.cost_per_mtok_output
    }
}

//
// Latest Models (Claude 4.5)
//

/// Claude Sonnet 4.5 (2025-09-29)
///
/// Our smart model for complex agents and coding. Best balance of intelligence,
/// speed, and cost for most use cases.
///
/// Supports 1M context window with beta header `context-1m-2025-08-07`.
pub const CLAUDE_SONNET_4_5: Model = Model {
    name: "Claude Sonnet 4.5",
    family: "sonnet",
    version: "2025-09-29",
    anthropic_id: "claude-sonnet-4-5-20250929",
    bedrock_id: Some("anthropic.claude-sonnet-4-5-20250929-v1:0"),
    bedrock_global_id: Some("global.anthropic.claude-sonnet-4-5-20250929-v1:0"),
    vertex_id: Some("claude-sonnet-4-5@20250929"),
    max_context_tokens: 200_000,
    max_context_tokens_extended: Some(1_000_000),
    max_output_tokens: 64_000,
    supports_vision: true,
    supports_tools: true,
    supports_caching: true,
    supports_extended_thinking: true,
    supports_effort: false,
    cost_per_mtok_input: 3.0,
    cost_per_mtok_output: 15.0,
    description: "Smart model for complex agents and coding",
};

/// Claude Haiku 4.5 (2025-10-01)
///
/// Our fastest model with near-frontier intelligence.
pub const CLAUDE_HAIKU_4_5: Model = Model {
    name: "Claude Haiku 4.5",
    family: "haiku",
    version: "2025-10-01",
    anthropic_id: "claude-haiku-4-5-20251001",
    bedrock_id: Some("anthropic.claude-haiku-4-5-20251001-v1:0"),
    bedrock_global_id: Some("global.anthropic.claude-haiku-4-5-20251001-v1:0"),
    vertex_id: Some("claude-haiku-4-5@20251001"),
    max_context_tokens: 200_000,
    max_context_tokens_extended: None,
    max_output_tokens: 64_000,
    supports_vision: true,
    supports_tools: true,
    supports_caching: true,
    supports_extended_thinking: true,
    supports_effort: false,
    cost_per_mtok_input: 1.0,
    cost_per_mtok_output: 5.0,
    description: "Fastest model with near-frontier intelligence",
};

/// Claude Opus 4.5 (2025-11-01)
///
/// Premium model combining maximum intelligence with practical performance.
/// Supports effort parameter (beta: effort-2025-11-24).
pub const CLAUDE_OPUS_4_5: Model = Model {
    name: "Claude Opus 4.5",
    family: "opus",
    version: "2025-11-01",
    anthropic_id: "claude-opus-4-5-20251101",
    bedrock_id: Some("anthropic.claude-opus-4-5-20251101-v1:0"),
    bedrock_global_id: Some("global.anthropic.claude-opus-4-5-20251101-v1:0"),
    vertex_id: Some("claude-opus-4-5@20251101"),
    max_context_tokens: 200_000,
    max_context_tokens_extended: None,
    max_output_tokens: 64_000,
    supports_vision: true,
    supports_tools: true,
    supports_caching: true,
    supports_extended_thinking: true,
    supports_effort: true, // Only Opus 4.5 supports effort
    cost_per_mtok_input: 5.0,
    cost_per_mtok_output: 25.0,
    description: "Maximum intelligence with practical performance",
};

/// Claude Sonnet 4.6 (placeholder date: 2026-01-15)
///
/// Best balance of speed and intelligence.
// TODO: verify version date, IDs, and pricing from API
pub const CLAUDE_SONNET_4_6: Model = Model {
    name: "Claude Sonnet 4.6",
    family: "sonnet",
    version: "2026-01-15",
    anthropic_id: "claude-sonnet-4-6-20260115",
    bedrock_id: Some("anthropic.claude-sonnet-4-6-20260115-v1:0"),
    bedrock_global_id: Some("global.anthropic.claude-sonnet-4-6-20260115-v1:0"),
    vertex_id: Some("claude-sonnet-4-6@20260115"),
    max_context_tokens: 200_000,
    max_context_tokens_extended: Some(1_000_000),
    max_output_tokens: 64_000,
    supports_vision: true,
    supports_tools: true,
    supports_caching: true,
    supports_extended_thinking: true,
    supports_effort: false,
    cost_per_mtok_input: 3.0,
    cost_per_mtok_output: 15.0,
    description: "Best balance of speed and intelligence",
};

/// Claude Opus 4.6 (placeholder date: 2026-02-01)
///
/// Frontier intelligence for long-running agents and coding.
// TODO: verify version date, IDs, and pricing from API
pub const CLAUDE_OPUS_4_6: Model = Model {
    name: "Claude Opus 4.6",
    family: "opus",
    version: "2026-02-01",
    anthropic_id: "claude-opus-4-6-20260201",
    bedrock_id: Some("anthropic.claude-opus-4-6-20260201-v1:0"),
    bedrock_global_id: Some("global.anthropic.claude-opus-4-6-20260201-v1:0"),
    vertex_id: Some("claude-opus-4-6@20260201"),
    max_context_tokens: 200_000,
    max_context_tokens_extended: None,
    max_output_tokens: 64_000,
    supports_vision: true,
    supports_tools: true,
    supports_caching: true,
    supports_extended_thinking: true,
    supports_effort: true,
    cost_per_mtok_input: 5.0,
    cost_per_mtok_output: 25.0,
    description: "Frontier intelligence for long-running agents and coding",
};

/// Claude Opus 4.7 (placeholder date: 2026-03-01)
///
/// Frontier intelligence for long-running agents and coding.
// TODO: verify version date, IDs, and pricing from API
pub const CLAUDE_OPUS_4_7: Model = Model {
    name: "Claude Opus 4.7",
    family: "opus",
    version: "2026-03-01",
    anthropic_id: "claude-opus-4-7-20260301",
    bedrock_id: Some("anthropic.claude-opus-4-7-20260301-v1:0"),
    bedrock_global_id: Some("global.anthropic.claude-opus-4-7-20260301-v1:0"),
    vertex_id: Some("claude-opus-4-7@20260301"),
    max_context_tokens: 200_000,
    max_context_tokens_extended: None,
    max_output_tokens: 64_000,
    supports_vision: true,
    supports_tools: true,
    supports_caching: true,
    supports_extended_thinking: true,
    supports_effort: true,
    cost_per_mtok_input: 5.0,
    cost_per_mtok_output: 25.0,
    description: "Frontier intelligence for long-running agents and coding",
};

/// Claude Opus 4.8 (placeholder date: 2026-04-01)
///
/// Frontier intelligence for long-running agents and coding.
// TODO: verify version date, IDs, and pricing from API
pub const CLAUDE_OPUS_4_8: Model = Model {
    name: "Claude Opus 4.8",
    family: "opus",
    version: "2026-04-01",
    anthropic_id: "claude-opus-4-8-20260401",
    bedrock_id: Some("anthropic.claude-opus-4-8-20260401-v1:0"),
    bedrock_global_id: Some("global.anthropic.claude-opus-4-8-20260401-v1:0"),
    vertex_id: Some("claude-opus-4-8@20260401"),
    max_context_tokens: 200_000,
    max_context_tokens_extended: None,
    max_output_tokens: 64_000,
    supports_vision: true,
    supports_tools: true,
    supports_caching: true,
    supports_extended_thinking: true,
    supports_effort: true,
    cost_per_mtok_input: 5.0,
    cost_per_mtok_output: 25.0,
    description: "Frontier intelligence for long-running agents and coding",
};

//
// Latest Models (Claude 5)
//

/// Claude Fable 5 (placeholder date: 2026-06-01)
///
/// Next generation model for the hardest knowledge work and coding.
// TODO: verify version date, IDs, and pricing from API
pub const CLAUDE_FABLE_5: Model = Model {
    name: "Claude Fable 5",
    family: "fable",
    version: "2026-06-01",
    anthropic_id: "claude-fable-5-20260601",
    bedrock_id: Some("anthropic.claude-fable-5-20260601-v1:0"),
    bedrock_global_id: Some("global.anthropic.claude-fable-5-20260601-v1:0"),
    vertex_id: Some("claude-fable-5@20260601"),
    max_context_tokens: 200_000,
    max_context_tokens_extended: Some(1_000_000),
    max_output_tokens: 64_000,
    supports_vision: true,
    supports_tools: true,
    supports_caching: true,
    supports_extended_thinking: true,
    supports_effort: false,
    cost_per_mtok_input: 3.0,
    cost_per_mtok_output: 15.0,
    description: "Next generation for hardest knowledge work and coding",
};

/// Claude Mythos 5 (placeholder date: 2026-06-15)
///
/// Most capable model for cybersecurity and biology research.
// TODO: verify version date, IDs, and pricing from API
pub const CLAUDE_MYTHOS_5: Model = Model {
    name: "Claude Mythos 5",
    family: "mythos",
    version: "2026-06-15",
    anthropic_id: "claude-mythos-5-20260615",
    bedrock_id: Some("anthropic.claude-mythos-5-20260615-v1:0"),
    bedrock_global_id: Some("global.anthropic.claude-mythos-5-20260615-v1:0"),
    vertex_id: Some("claude-mythos-5@20260615"),
    max_context_tokens: 200_000,
    max_context_tokens_extended: Some(1_000_000),
    max_output_tokens: 64_000,
    supports_vision: true,
    supports_tools: true,
    supports_caching: true,
    supports_extended_thinking: true,
    supports_effort: false,
    cost_per_mtok_input: 5.0,
    cost_per_mtok_output: 25.0,
    description: "Most capable for cybersecurity and biology research",
};

//
// Legacy Models (Claude 4.x and 3.x)
//

/// Claude Opus 4.1 (2025-08-05)
pub const CLAUDE_OPUS_4_1: Model = Model {
    name: "Claude Opus 4.1",
    family: "opus",
    version: "2025-08-05",
    anthropic_id: "claude-opus-4-1-20250805",
    bedrock_id: Some("anthropic.claude-opus-4-1-20250805-v1:0"),
    bedrock_global_id: None,
    vertex_id: Some("claude-opus-4-1@20250805"),
    max_context_tokens: 200_000,
    max_context_tokens_extended: None,
    max_output_tokens: 32_000,
    supports_vision: true,
    supports_tools: true,
    supports_caching: true,
    supports_extended_thinking: true,
    supports_effort: false,
    cost_per_mtok_input: 15.0,
    cost_per_mtok_output: 75.0,
    description: "Previous generation powerful model",
};

/// Claude Sonnet 4 (2025-05-14)
///
/// Supports 1M context window with beta header `context-1m-2025-08-07`.
pub const CLAUDE_SONNET_4: Model = Model {
    name: "Claude Sonnet 4",
    family: "sonnet",
    version: "2025-05-14",
    anthropic_id: "claude-sonnet-4-20250514",
    bedrock_id: Some("anthropic.claude-sonnet-4-20250514-v1:0"),
    bedrock_global_id: None,
    vertex_id: Some("claude-sonnet-4@20250514"),
    max_context_tokens: 200_000,
    max_context_tokens_extended: Some(1_000_000),
    max_output_tokens: 64_000,
    supports_vision: true,
    supports_tools: true,
    supports_caching: true,
    supports_extended_thinking: true,
    supports_effort: false,
    cost_per_mtok_input: 3.0,
    cost_per_mtok_output: 15.0,
    description: "Previous generation balanced model",
};

/// Claude Sonnet 3.7 (2025-02-19)
///
/// Supports 128K output with beta header `output-128k-2025-02-19`.
pub const CLAUDE_SONNET_3_7: Model = Model {
    name: "Claude Sonnet 3.7",
    family: "sonnet",
    version: "2025-02-19",
    anthropic_id: "claude-3-7-sonnet-20250219",
    bedrock_id: Some("anthropic.claude-3-7-sonnet-20250219-v1:0"),
    bedrock_global_id: None,
    vertex_id: Some("claude-3-7-sonnet@20250219"),
    max_context_tokens: 200_000,
    max_context_tokens_extended: None,
    max_output_tokens: 64_000, // 128K with beta header
    supports_vision: true,
    supports_tools: true,
    supports_caching: true,
    supports_extended_thinking: true,
    supports_effort: false,
    cost_per_mtok_input: 3.0,
    cost_per_mtok_output: 15.0,
    description: "Claude 3.7 balanced model",
};

/// Claude Opus 4 (2025-05-14)
pub const CLAUDE_OPUS_4: Model = Model {
    name: "Claude Opus 4",
    family: "opus",
    version: "2025-05-14",
    anthropic_id: "claude-opus-4-20250514",
    bedrock_id: Some("anthropic.claude-opus-4-20250514-v1:0"),
    bedrock_global_id: None,
    vertex_id: Some("claude-opus-4@20250514"),
    max_context_tokens: 200_000,
    max_context_tokens_extended: None,
    max_output_tokens: 32_000,
    supports_vision: true,
    supports_tools: true,
    supports_caching: true,
    supports_extended_thinking: true,
    supports_effort: false,
    cost_per_mtok_input: 15.0,
    cost_per_mtok_output: 75.0,
    description: "Claude 4 powerful model",
};

/// Claude Haiku 3.5 (2024-10-22)
pub const CLAUDE_HAIKU_3_5: Model = Model {
    name: "Claude Haiku 3.5",
    family: "haiku",
    version: "2024-10-22",
    anthropic_id: "claude-3-5-haiku-20241022",
    bedrock_id: Some("anthropic.claude-3-5-haiku-20241022-v1:0"),
    bedrock_global_id: None,
    vertex_id: Some("claude-3-5-haiku@20241022"),
    max_context_tokens: 200_000,
    max_context_tokens_extended: None,
    max_output_tokens: 8_192,
    supports_vision: true,
    supports_tools: true,
    supports_caching: true,
    supports_extended_thinking: false,
    supports_effort: false,
    cost_per_mtok_input: 0.80,
    cost_per_mtok_output: 4.0,
    description: "Fast and efficient model",
};

/// Claude Haiku 3 (2024-03-07)
pub const CLAUDE_HAIKU_3: Model = Model {
    name: "Claude Haiku 3",
    family: "haiku",
    version: "2024-03-07",
    anthropic_id: "claude-3-haiku-20240307",
    bedrock_id: Some("anthropic.claude-3-haiku-20240307-v1:0"),
    bedrock_global_id: None,
    vertex_id: Some("claude-3-haiku@20240307"),
    max_context_tokens: 200_000,
    max_context_tokens_extended: None,
    max_output_tokens: 4_096,
    supports_vision: true,
    supports_tools: true,
    supports_caching: true,
    supports_extended_thinking: false,
    supports_effort: false,
    cost_per_mtok_input: 0.25,
    cost_per_mtok_output: 1.25,
    description: "Original fast model",
};

/// List of all available models (latest first)
pub const ALL_MODELS: &[&Model] = &[
    // Latest (Claude 5)
    &CLAUDE_MYTHOS_5,
    &CLAUDE_FABLE_5,
    // Claude 4.6+
    &CLAUDE_OPUS_4_8,
    &CLAUDE_OPUS_4_7,
    &CLAUDE_OPUS_4_6,
    &CLAUDE_SONNET_4_6,
    // Claude 4.5
    &CLAUDE_SONNET_4_5,
    &CLAUDE_HAIKU_4_5,
    &CLAUDE_OPUS_4_5,
    // Legacy (Claude 4.x and 3.x)
    &CLAUDE_OPUS_4_1,
    &CLAUDE_SONNET_4,
    &CLAUDE_SONNET_3_7,
    &CLAUDE_OPUS_4,
    &CLAUDE_HAIKU_3_5,
    &CLAUDE_HAIKU_3,
];

/// Lookup a model by its Anthropic API ID.
///
/// Returns the model metadata if found, or `None` if the ID doesn't match any model.
///
/// # Example
///
/// ```rust
/// use claude_sdk::models::get_model_by_anthropic_id;
///
/// let model = get_model_by_anthropic_id("claude-sonnet-4-5-20250929").unwrap();
/// assert_eq!(model.name, "Claude Sonnet 4.5");
/// assert_eq!(model.max_output_tokens, 64_000);
///
/// // Unknown models return None
/// assert!(get_model_by_anthropic_id("unknown-model").is_none());
/// ```
pub fn get_model_by_anthropic_id(id: &str) -> Option<&'static Model> {
    ALL_MODELS.iter().find(|m| m.anthropic_id == id).copied()
}

/// Lookup a model by its Bedrock ID (any region prefix).
///
/// This function is flexible and accepts model IDs from any Bedrock endpoint type.
/// It will automatically strip regional prefixes when matching.
///
/// # Supported Formats
///
/// - Standard regional: `anthropic.claude-sonnet-4-5-20250929-v1:0`
/// - Global: `global.anthropic.claude-sonnet-4-5-20250929-v1:0`
/// - US regional: `us.anthropic.claude-sonnet-4-5-20250929-v1:0`
/// - EU regional: `eu.anthropic.claude-sonnet-4-5-20250929-v1:0`
/// - AP regional: `ap.anthropic.claude-sonnet-4-5-20250929-v1:0`
///
/// # Example
///
/// ```rust
/// use claude_sdk::models::get_model_by_bedrock_id;
///
/// // All of these return the same model
/// let m1 = get_model_by_bedrock_id("anthropic.claude-sonnet-4-5-20250929-v1:0");
/// let m2 = get_model_by_bedrock_id("global.anthropic.claude-sonnet-4-5-20250929-v1:0");
/// let m3 = get_model_by_bedrock_id("us.anthropic.claude-sonnet-4-5-20250929-v1:0");
///
/// assert_eq!(m1.unwrap().name, "Claude Sonnet 4.5");
/// assert_eq!(m2.unwrap().name, "Claude Sonnet 4.5");
/// assert_eq!(m3.unwrap().name, "Claude Sonnet 4.5");
/// ```
pub fn get_model_by_bedrock_id(id: &str) -> Option<&'static Model> {
    // Try exact match first
    if let Some(model) = ALL_MODELS
        .iter()
        .find(|m| m.bedrock_id == Some(id) || m.bedrock_global_id == Some(id))
    {
        return Some(*model);
    }

    // Try stripping regional prefixes and matching base ID
    let base_id = id
        .strip_prefix("global.")
        .or_else(|| id.strip_prefix("us."))
        .or_else(|| id.strip_prefix("eu."))
        .or_else(|| id.strip_prefix("ap."))
        .unwrap_or(id);

    ALL_MODELS
        .iter()
        .find(|m| m.bedrock_id == Some(base_id))
        .copied()
}

/// Lookup a model by its Google Vertex AI ID.
///
/// # Example
///
/// ```rust
/// use claude_sdk::models::get_model_by_vertex_id;
///
/// let model = get_model_by_vertex_id("claude-sonnet-4-5@20250929").unwrap();
/// assert_eq!(model.name, "Claude Sonnet 4.5");
///
/// // Unknown models return None
/// assert!(get_model_by_vertex_id("unknown-model").is_none());
/// ```
pub fn get_model_by_vertex_id(id: &str) -> Option<&'static Model> {
    ALL_MODELS.iter().find(|m| m.vertex_id == Some(id)).copied()
}

/// Lookup a model by any ID format.
///
/// This is the most flexible lookup function. It tries to match the ID against:
/// 1. Anthropic API IDs (e.g., `claude-sonnet-4-5-20250929`)
/// 2. AWS Bedrock IDs (e.g., `anthropic.claude-sonnet-4-5-20250929-v1:0`)
/// 3. Google Vertex AI IDs (e.g., `claude-sonnet-4-5@20250929`)
///
/// Use this when you need to accept model IDs from different sources.
///
/// # Example
///
/// ```rust
/// use claude_sdk::models::get_model;
///
/// // Anthropic ID
/// let m1 = get_model("claude-sonnet-4-5-20250929").unwrap();
///
/// // Bedrock ID (any regional prefix)
/// let m2 = get_model("anthropic.claude-sonnet-4-5-20250929-v1:0").unwrap();
/// let m3 = get_model("global.anthropic.claude-sonnet-4-5-20250929-v1:0").unwrap();
///
/// // Vertex AI ID
/// let m4 = get_model("claude-sonnet-4-5@20250929").unwrap();
///
/// // All return the same model
/// assert_eq!(m1.name, "Claude Sonnet 4.5");
/// assert_eq!(m2.name, "Claude Sonnet 4.5");
/// assert_eq!(m3.name, "Claude Sonnet 4.5");
/// assert_eq!(m4.name, "Claude Sonnet 4.5");
/// ```
pub fn get_model(id: &str) -> Option<&'static Model> {
    get_model_by_anthropic_id(id)
        .or_else(|| get_model_by_bedrock_id(id))
        .or_else(|| get_model_by_vertex_id(id))
}

#[cfg(test)]
#[allow(clippy::assertions_on_constants)]
mod tests {
    use super::*;

    #[test]
    fn test_model_constants() {
        assert_eq!(CLAUDE_SONNET_4_5.anthropic_id, "claude-sonnet-4-5-20250929");
        assert_eq!(
            CLAUDE_SONNET_4_5.bedrock_id,
            Some("anthropic.claude-sonnet-4-5-20250929-v1:0")
        );
        assert_eq!(
            CLAUDE_SONNET_4_5.bedrock_global_id,
            Some("global.anthropic.claude-sonnet-4-5-20250929-v1:0")
        );
        assert_eq!(
            CLAUDE_SONNET_4_5.max_context_tokens_extended,
            Some(1_000_000)
        );
    }

    #[test]
    fn test_model_lookup_anthropic() {
        let model = get_model_by_anthropic_id("claude-sonnet-4-5-20250929");
        assert!(model.is_some());
        assert_eq!(model.unwrap().name, "Claude Sonnet 4.5");
    }

    #[test]
    fn test_model_lookup_bedrock_regional() {
        let model = get_model_by_bedrock_id("anthropic.claude-sonnet-4-5-20250929-v1:0");
        assert!(model.is_some());
        assert_eq!(model.unwrap().name, "Claude Sonnet 4.5");
    }

    #[test]
    fn test_model_lookup_bedrock_global() {
        let model = get_model_by_bedrock_id("global.anthropic.claude-sonnet-4-5-20250929-v1:0");
        assert!(model.is_some());
        assert_eq!(model.unwrap().name, "Claude Sonnet 4.5");
    }

    #[test]
    fn test_model_lookup_bedrock_us() {
        let model = get_model_by_bedrock_id("us.anthropic.claude-sonnet-4-5-20250929-v1:0");
        assert!(model.is_some());
        assert_eq!(model.unwrap().name, "Claude Sonnet 4.5");
    }

    #[test]
    fn test_model_lookup_bedrock_eu() {
        let model = get_model_by_bedrock_id("eu.anthropic.claude-sonnet-4-5-20250929-v1:0");
        assert!(model.is_some());
        assert_eq!(model.unwrap().name, "Claude Sonnet 4.5");
    }

    #[test]
    fn test_model_lookup_bedrock_ap() {
        let model = get_model_by_bedrock_id("ap.anthropic.claude-sonnet-4-5-20250929-v1:0");
        assert!(model.is_some());
        assert_eq!(model.unwrap().name, "Claude Sonnet 4.5");
    }

    #[test]
    fn test_bedrock_id_for_region() {
        // Standard regional endpoint
        let regional = CLAUDE_SONNET_4_5.bedrock_id_for_region(BedrockRegion::Standard);
        assert_eq!(
            regional.as_deref(),
            Some("anthropic.claude-sonnet-4-5-20250929-v1:0")
        );

        // Global endpoint
        let global = CLAUDE_SONNET_4_5.bedrock_id_for_region(BedrockRegion::Global);
        assert_eq!(
            global.as_deref(),
            Some("global.anthropic.claude-sonnet-4-5-20250929-v1:0")
        );

        // US regional endpoint
        let us = CLAUDE_SONNET_4_5.bedrock_id_for_region(BedrockRegion::US);
        assert_eq!(
            us.as_deref(),
            Some("us.anthropic.claude-sonnet-4-5-20250929-v1:0")
        );

        // EU regional endpoint
        let eu = CLAUDE_SONNET_4_5.bedrock_id_for_region(BedrockRegion::EU);
        assert_eq!(
            eu.as_deref(),
            Some("eu.anthropic.claude-sonnet-4-5-20250929-v1:0")
        );

        // AP regional endpoint
        let ap = CLAUDE_SONNET_4_5.bedrock_id_for_region(BedrockRegion::AsiaPacific);
        assert_eq!(
            ap.as_deref(),
            Some("ap.anthropic.claude-sonnet-4-5-20250929-v1:0")
        );
    }

    #[test]
    fn test_model_lookup_any() {
        // Should work with Anthropic, Bedrock regional, and all Bedrock prefixes
        assert!(get_model("claude-sonnet-4-5-20250929").is_some());
        assert!(get_model("anthropic.claude-sonnet-4-5-20250929-v1:0").is_some());
        assert!(get_model("global.anthropic.claude-sonnet-4-5-20250929-v1:0").is_some());
        assert!(get_model("us.anthropic.claude-sonnet-4-5-20250929-v1:0").is_some());
        assert!(get_model("eu.anthropic.claude-sonnet-4-5-20250929-v1:0").is_some());
        assert!(get_model("ap.anthropic.claude-sonnet-4-5-20250929-v1:0").is_some());
    }

    #[test]
    fn test_validate_request() {
        assert!(CLAUDE_SONNET_4_5.validate_request(1024, false).is_ok());
        assert!(CLAUDE_SONNET_4_5.validate_request(64_000, false).is_ok());
        assert!(CLAUDE_SONNET_4_5.validate_request(100_000, false).is_err());

        // Test extended context validation
        assert!(CLAUDE_SONNET_4_5.validate_request(1024, true).is_ok());
        assert!(CLAUDE_HAIKU_4_5.validate_request(1024, true).is_err()); // Doesn't support 1M
    }

    #[test]
    fn test_extended_context_support() {
        // Models that support 1M context
        assert!(CLAUDE_SONNET_4_5.supports_extended_context());
        assert_eq!(CLAUDE_SONNET_4_5.max_extended_context(), Some(1_000_000));
        assert!(CLAUDE_SONNET_4.supports_extended_context());

        // Models that don't support 1M context
        assert!(!CLAUDE_HAIKU_4_5.supports_extended_context());
        assert_eq!(CLAUDE_HAIKU_4_5.max_extended_context(), None);
        assert!(!CLAUDE_OPUS_4_5.supports_extended_context());
    }

    #[test]
    fn test_bedrock_global_endpoints() {
        // Claude 4.5 models support global endpoints
        assert!(CLAUDE_SONNET_4_5.bedrock_global_id().is_some());
        assert!(CLAUDE_HAIKU_4_5.bedrock_global_id().is_some());
        assert!(CLAUDE_OPUS_4_5.bedrock_global_id().is_some());

        // Legacy models don't support global endpoints
        assert!(CLAUDE_SONNET_4.bedrock_global_id().is_none());
        assert!(CLAUDE_HAIKU_3_5.bedrock_global_id().is_none());
    }

    #[test]
    fn test_estimate_cost() {
        let cost = CLAUDE_SONNET_4_5.estimate_cost(1000, 500);
        // $3/MTok input + $15/MTok output
        // = (1000/1M * 3) + (500/1M * 15)
        // = 0.003 + 0.0075 = 0.0105
        assert!((cost - 0.0105).abs() < 0.0001);
    }

    #[test]
    fn test_all_models_have_unique_ids() {
        let mut ids = std::collections::HashSet::new();
        for model in ALL_MODELS {
            assert!(ids.insert(model.anthropic_id));
        }
    }

    // --- New model tests ---

    #[test]
    fn test_claude_sonnet_4_6_exists() {
        assert_eq!(CLAUDE_SONNET_4_6.name, "Claude Sonnet 4.6");
        assert_eq!(CLAUDE_SONNET_4_6.family, "sonnet");
        assert_eq!(CLAUDE_SONNET_4_6.anthropic_id, "claude-sonnet-4-6-20260115");
        assert!(CLAUDE_SONNET_4_6.supports_vision);
        assert!(CLAUDE_SONNET_4_6.supports_tools);
        assert!(CLAUDE_SONNET_4_6.supports_caching);
        assert!(CLAUDE_SONNET_4_6.supports_extended_thinking);
        assert!(!CLAUDE_SONNET_4_6.supports_effort);
        assert!(CLAUDE_SONNET_4_6.bedrock_global_id.is_some());
    }

    #[test]
    fn test_claude_sonnet_4_6_lookup() {
        let model = get_model_by_anthropic_id("claude-sonnet-4-6-20260115");
        assert!(model.is_some());
        assert_eq!(model.unwrap().name, "Claude Sonnet 4.6");

        let model = get_model("claude-sonnet-4-6-20260115");
        assert!(model.is_some());
    }

    #[test]
    fn test_claude_opus_4_6_exists() {
        assert_eq!(CLAUDE_OPUS_4_6.name, "Claude Opus 4.6");
        assert_eq!(CLAUDE_OPUS_4_6.family, "opus");
        assert_eq!(CLAUDE_OPUS_4_6.anthropic_id, "claude-opus-4-6-20260201");
        assert!(CLAUDE_OPUS_4_6.supports_vision);
        assert!(CLAUDE_OPUS_4_6.supports_tools);
        assert!(CLAUDE_OPUS_4_6.supports_caching);
        assert!(CLAUDE_OPUS_4_6.supports_extended_thinking);
        assert!(CLAUDE_OPUS_4_6.supports_effort);
        assert!(CLAUDE_OPUS_4_6.bedrock_global_id.is_some());
    }

    #[test]
    fn test_claude_opus_4_6_lookup() {
        let model = get_model_by_anthropic_id("claude-opus-4-6-20260201");
        assert!(model.is_some());
        assert_eq!(model.unwrap().name, "Claude Opus 4.6");

        let model = get_model("claude-opus-4-6-20260201");
        assert!(model.is_some());
    }

    #[test]
    fn test_claude_opus_4_7_exists() {
        assert_eq!(CLAUDE_OPUS_4_7.name, "Claude Opus 4.7");
        assert_eq!(CLAUDE_OPUS_4_7.family, "opus");
        assert_eq!(CLAUDE_OPUS_4_7.anthropic_id, "claude-opus-4-7-20260301");
        assert!(CLAUDE_OPUS_4_7.supports_vision);
        assert!(CLAUDE_OPUS_4_7.supports_tools);
        assert!(CLAUDE_OPUS_4_7.supports_caching);
        assert!(CLAUDE_OPUS_4_7.supports_extended_thinking);
        assert!(CLAUDE_OPUS_4_7.supports_effort);
        assert!(CLAUDE_OPUS_4_7.bedrock_global_id.is_some());
    }

    #[test]
    fn test_claude_opus_4_7_lookup() {
        let model = get_model_by_anthropic_id("claude-opus-4-7-20260301");
        assert!(model.is_some());
        assert_eq!(model.unwrap().name, "Claude Opus 4.7");

        let model = get_model("claude-opus-4-7-20260301");
        assert!(model.is_some());
    }

    #[test]
    fn test_claude_opus_4_8_exists() {
        assert_eq!(CLAUDE_OPUS_4_8.name, "Claude Opus 4.8");
        assert_eq!(CLAUDE_OPUS_4_8.family, "opus");
        assert_eq!(CLAUDE_OPUS_4_8.anthropic_id, "claude-opus-4-8-20260401");
        assert!(CLAUDE_OPUS_4_8.supports_vision);
        assert!(CLAUDE_OPUS_4_8.supports_tools);
        assert!(CLAUDE_OPUS_4_8.supports_caching);
        assert!(CLAUDE_OPUS_4_8.supports_extended_thinking);
        assert!(CLAUDE_OPUS_4_8.supports_effort);
        assert!(CLAUDE_OPUS_4_8.bedrock_global_id.is_some());
    }

    #[test]
    fn test_claude_opus_4_8_lookup() {
        let model = get_model_by_anthropic_id("claude-opus-4-8-20260401");
        assert!(model.is_some());
        assert_eq!(model.unwrap().name, "Claude Opus 4.8");

        let model = get_model("claude-opus-4-8-20260401");
        assert!(model.is_some());
    }

    #[test]
    fn test_claude_fable_5_exists() {
        assert_eq!(CLAUDE_FABLE_5.name, "Claude Fable 5");
        assert_eq!(CLAUDE_FABLE_5.family, "fable");
        assert_eq!(CLAUDE_FABLE_5.anthropic_id, "claude-fable-5-20260601");
        assert!(CLAUDE_FABLE_5.supports_vision);
        assert!(CLAUDE_FABLE_5.supports_tools);
        assert!(CLAUDE_FABLE_5.supports_caching);
        assert!(CLAUDE_FABLE_5.supports_extended_thinking);
        assert!(!CLAUDE_FABLE_5.supports_effort);
        assert!(CLAUDE_FABLE_5.bedrock_global_id.is_some());
        assert_eq!(CLAUDE_FABLE_5.max_context_tokens_extended, Some(1_000_000));
    }

    #[test]
    fn test_claude_fable_5_lookup() {
        let model = get_model_by_anthropic_id("claude-fable-5-20260601");
        assert!(model.is_some());
        assert_eq!(model.unwrap().name, "Claude Fable 5");

        let model = get_model("claude-fable-5-20260601");
        assert!(model.is_some());
    }

    #[test]
    fn test_claude_mythos_5_exists() {
        assert_eq!(CLAUDE_MYTHOS_5.name, "Claude Mythos 5");
        assert_eq!(CLAUDE_MYTHOS_5.family, "mythos");
        assert_eq!(CLAUDE_MYTHOS_5.anthropic_id, "claude-mythos-5-20260615");
        assert!(CLAUDE_MYTHOS_5.supports_vision);
        assert!(CLAUDE_MYTHOS_5.supports_tools);
        assert!(CLAUDE_MYTHOS_5.supports_caching);
        assert!(CLAUDE_MYTHOS_5.supports_extended_thinking);
        assert!(!CLAUDE_MYTHOS_5.supports_effort);
        assert!(CLAUDE_MYTHOS_5.bedrock_global_id.is_some());
        assert_eq!(CLAUDE_MYTHOS_5.max_context_tokens_extended, Some(1_000_000));
    }

    #[test]
    fn test_claude_mythos_5_lookup() {
        let model = get_model_by_anthropic_id("claude-mythos-5-20260615");
        assert!(model.is_some());
        assert_eq!(model.unwrap().name, "Claude Mythos 5");

        let model = get_model("claude-mythos-5-20260615");
        assert!(model.is_some());
    }

    #[test]
    fn test_new_models_in_all_models() {
        let ids: Vec<&str> = ALL_MODELS.iter().map(|m| m.anthropic_id).collect();
        assert!(ids.contains(&"claude-sonnet-4-6-20260115"));
        assert!(ids.contains(&"claude-opus-4-6-20260201"));
        assert!(ids.contains(&"claude-opus-4-7-20260301"));
        assert!(ids.contains(&"claude-opus-4-8-20260401"));
        assert!(ids.contains(&"claude-fable-5-20260601"));
        assert!(ids.contains(&"claude-mythos-5-20260615"));
    }

    #[test]
    fn test_new_models_bedrock_global_ids() {
        assert!(CLAUDE_SONNET_4_6.bedrock_global_id().is_some());
        assert!(CLAUDE_OPUS_4_6.bedrock_global_id().is_some());
        assert!(CLAUDE_OPUS_4_7.bedrock_global_id().is_some());
        assert!(CLAUDE_OPUS_4_8.bedrock_global_id().is_some());
        assert!(CLAUDE_FABLE_5.bedrock_global_id().is_some());
        assert!(CLAUDE_MYTHOS_5.bedrock_global_id().is_some());
    }
}