1#![allow(missing_docs)]
11
12use std::borrow::Cow;
13use std::fmt;
14
15use serde::{Deserialize, Serialize};
16
17#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
22#[serde(transparent)]
23pub struct Model(pub Cow<'static, str>);
24
25impl Model {
26 pub fn custom(id: impl Into<String>) -> Self {
28 Self(Cow::Owned(id.into()))
29 }
30
31 pub fn as_str(&self) -> &str {
33 &self.0
34 }
35}
36
37impl fmt::Display for Model {
38 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
39 f.write_str(&self.0)
40 }
41}
42
43impl From<&'static str> for Model {
44 fn from(s: &'static str) -> Self {
45 Self(Cow::Borrowed(s))
46 }
47}
48
49impl From<String> for Model {
50 fn from(s: String) -> Self {
51 Self(Cow::Owned(s))
52 }
53}
54
55pub const CLAUDE_OPUS_4_7: Model = Model(Cow::Borrowed("claude-opus-4-7"));
58pub const CLAUDE_OPUS_4_6: Model = Model(Cow::Borrowed("claude-opus-4-6"));
59pub const CLAUDE_OPUS_4_5: Model = Model(Cow::Borrowed("claude-opus-4-5"));
60pub const CLAUDE_OPUS_4_5_20251101: Model = Model(Cow::Borrowed("claude-opus-4-5-20251101"));
61pub const CLAUDE_OPUS_4_1: Model = Model(Cow::Borrowed("claude-opus-4-1"));
62pub const CLAUDE_OPUS_4_1_20250805: Model = Model(Cow::Borrowed("claude-opus-4-1-20250805"));
63pub const CLAUDE_OPUS_4_0: Model = Model(Cow::Borrowed("claude-opus-4-0"));
64pub const CLAUDE_OPUS_4_20250514: Model = Model(Cow::Borrowed("claude-opus-4-20250514"));
65
66pub const CLAUDE_SONNET_4_6: Model = Model(Cow::Borrowed("claude-sonnet-4-6"));
67pub const CLAUDE_SONNET_4_5: Model = Model(Cow::Borrowed("claude-sonnet-4-5"));
68pub const CLAUDE_SONNET_4_5_20250929: Model = Model(Cow::Borrowed("claude-sonnet-4-5-20250929"));
69pub const CLAUDE_SONNET_4_0: Model = Model(Cow::Borrowed("claude-sonnet-4-0"));
70pub const CLAUDE_SONNET_4_20250514: Model = Model(Cow::Borrowed("claude-sonnet-4-20250514"));
71
72pub const CLAUDE_HAIKU_4_5: Model = Model(Cow::Borrowed("claude-haiku-4-5"));
73pub const CLAUDE_HAIKU_4_5_20251001: Model = Model(Cow::Borrowed("claude-haiku-4-5-20251001"));
74
75pub const CLAUDE_3_HAIKU_20240307: Model = Model(Cow::Borrowed("claude-3-haiku-20240307"));