adk-model 3.0.0

LLM model integrations for Rust Agent Development Kit (ADK-Rust) (Gemini, OpenAI, Claude, DeepSeek, etc.)
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
//! Configuration types for Anthropic provider.

use adk_anthropic::{ThinkingDisplay, ToolSearchConfig};
use serde::{Deserialize, Serialize};

/// Thinking mode configuration for Anthropic models.
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
#[serde(tag = "type", rename_all = "snake_case")]
pub enum ThinkingMode {
    /// Budget-based thinking (legacy, deprecated on 4.6 models,
    /// **rejected on Opus 4.7**).
    /// Requires `budget_tokens` < `max_tokens`.
    Enabled {
        /// Token budget for thinking (must be ≥ 1024).
        budget_tokens: u32,
    },
    /// Adaptive thinking, the thinking mode of Claude 4.6 and later models.
    /// Claude decides when and how much to think.
    /// Control depth via `effort` on `AnthropicConfig`, and whether the thinking text is
    /// returned via [`AnthropicConfig::with_thinking_display`].
    Adaptive,
    /// No thinking before the response, only short updates between tool calls: the way to
    /// turn thinking off on Claude Sonnet 5.5, which rejects disabled thinking. The API
    /// accepts it at effort `high` or below; Claude Fable 5.x and Opus 5.5 always think, so
    /// lower `effort` on those instead.
    BetweenTools,
}

/// Effort level controlling response thoroughness.
/// Passed via `output_config.effort` in the API.
#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq)]
#[serde(rename_all = "lowercase")]
pub enum Effort {
    /// Minimal reasoning effort.
    Low,
    /// Moderate reasoning effort.
    Medium,
    /// Thorough reasoning effort.
    High,
    /// Very deep reasoning, for the hardest long-running work where a gain over `High` is
    /// measured. One turn can think for more than fifteen minutes, so the client sends a
    /// task budget at this level; see [`AnthropicConfig::with_task_budget`]. Opus 4.7 and
    /// later.
    XHigh,
    /// Uncapped reasoning, for measuring a model's ceiling or a task where time and tokens
    /// do not matter: one turn can think for more than fifteen minutes and spend the
    /// model's whole 128,000-token output limit before it answers. The client sends a
    /// task budget at this level so the model paces itself; see
    /// [`AnthropicConfig::with_task_budget`]. Opus 4.6 and later.
    Max,
}

/// The harness effort levels (spec 3.1 §7.23): `Low`, `Medium` and `High` map to the
/// Anthropic levels of the same name; `XHigh` and `Max` stay reachable only through
/// [`AnthropicConfig::with_effort`].
///
/// # Example
///
/// ```rust
/// use adk_model::anthropic::Effort;
///
/// assert_eq!(Effort::from(adk_core::Effort::High), Effort::High);
/// ```
impl From<adk_core::Effort> for Effort {
    fn from(effort: adk_core::Effort) -> Self {
        match effort {
            adk_core::Effort::Low => Self::Low,
            adk_core::Effort::Medium => Self::Medium,
            adk_core::Effort::High => Self::High,
        }
    }
}

/// Configuration for Anthropic API.
///
/// # Example
///
/// ```rust
/// use adk_model::anthropic::{AnthropicConfig, ThinkingMode, Effort};
///
/// // Adaptive thinking at high effort: the level to start from on a hard task
/// let config = AnthropicConfig::new("sk-ant-xxx", "claude-opus-5-5")
///     .with_thinking_mode(ThinkingMode::Adaptive)
///     .with_effort(Effort::High);
///
/// // Adaptive thinking with medium effort (recommended for Sonnet 4.6)
/// let config = AnthropicConfig::new("sk-ant-xxx", "claude-sonnet-4-6")
///     .with_thinking_mode(ThinkingMode::Adaptive)
///     .with_effort(Effort::Medium);
///
/// // Budget-based thinking (legacy, rejected on Opus 4.7)
/// let config = AnthropicConfig::new("sk-ant-xxx", "claude-sonnet-4-5")
///     .with_thinking_mode(ThinkingMode::Enabled { budget_tokens: 8192 });
///
/// // Prompt caching (enabled by default, can be disabled)
/// let config = AnthropicConfig::new("sk-ant-xxx", "claude-sonnet-4-6")
///     .with_prompt_caching(false); // opt out
/// ```
///
/// The API key is redacted from `Debug` output and omitted when serializing.
#[derive(Clone, Serialize, Deserialize)]
pub struct AnthropicConfig {
    /// Anthropic API key. Never serialized; deserializing a config without it
    /// yields an empty key.
    #[serde(skip_serializing, default)]
    pub api_key: String,
    /// Model name (e.g., `"claude-opus-5"`, `"claude-sonnet-5-5"`).
    pub model: String,
    /// Maximum tokens to generate. `None` uses
    /// [`anthropic_default_max_tokens`](crate::catalog::anthropic_default_max_tokens)
    /// for the model: 64,000 for Claude 5, Opus 4.6 to 4.8 and Sonnet 4.6, whose thinking
    /// counts toward this cap, 32,000 for earlier Claude 4 models, and 4,096 for older or
    /// unrecognized ones. At `xhigh` or `max` effort the 64,000 becomes 128,000, the
    /// models' output limit.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub max_tokens: Option<u32>,
    /// Bound on a whole non-streaming request, and on the wait for the response
    /// headers of a streaming one, in seconds. `None` uses 600 (10 minutes).
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub request_timeout_secs: Option<u64>,
    /// Optional custom base URL (for proxies, Ollama, Vercel Gateway, etc.).
    #[serde(skip_serializing_if = "Option::is_none")]
    pub base_url: Option<String>,

    /// Accept a plain `http://` [`base_url`](AnthropicConfig::base_url) on a
    /// non-loopback host.
    ///
    /// Defaults to `false`. Set with
    /// [`allow_insecure_http`](AnthropicConfig::allow_insecure_http).
    #[serde(default, skip_serializing_if = "std::ops::Not::not")]
    pub allow_insecure_http: bool,

    /// Enable prompt caching with `cache_control` blocks.
    ///
    /// Defaults to `true`. Anthropic prompt caching reduces costs and latency
    /// by reusing previously processed context. Disable with
    /// [`with_prompt_caching(false)`](AnthropicConfig::with_prompt_caching).
    #[serde(default = "default_prompt_caching")]
    pub prompt_caching: bool,

    /// Lifetime of the prompt cache entries this client writes. `None` uses the
    /// API default of 5 minutes. Set with
    /// [`with_prompt_cache_ttl`](AnthropicConfig::with_prompt_cache_ttl).
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub prompt_cache_ttl: Option<adk_anthropic::CacheTtl>,

    /// Thinking mode configuration.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub thinking: Option<ThinkingMode>,

    /// Whether responses carry the thinking text (`thinking.display`), for the configured
    /// [`thinking`](AnthropicConfig::thinking) mode. `None` uses the model's default: Opus 4.7
    /// and later, Sonnet 5 and later, and Haiku 5.5 omit the text and return only the
    /// signature; Opus 4.6 and Sonnet 4.6 return a summary.
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub thinking_display: Option<ThinkingDisplay>,

    /// Effort level (goes into `output_config.effort`).
    /// Works with or without thinking enabled.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub effort: Option<Effort>,

    /// Enable fast mode for Claude Opus 5 or Claude Opus 4.8 (research preview).
    /// Delivers up to 2.5× higher output tokens/sec at premium pricing.
    #[serde(default)]
    pub fast_mode: bool,

    /// Enable citations on documents in requests.
    #[serde(default)]
    pub citations: bool,

    /// Geographic routing for data residency (e.g., `"US"`, `"EU"`).
    #[serde(skip_serializing_if = "Option::is_none")]
    pub inference_geo: Option<String>,

    /// Server-side context management (tool result clearing, thinking block clearing).
    /// Requires beta header (auto-injected by adk-anthropic).
    #[serde(skip_serializing_if = "Option::is_none")]
    pub context_management: Option<adk_anthropic::ContextManagement>,

    /// Service tier (`"auto"` or `"standard_only"`).
    #[serde(skip_serializing_if = "Option::is_none")]
    pub service_tier: Option<String>,

    /// Beta feature headers (e.g., `"prompt-caching-2024-07-31"`).
    #[serde(default, skip_serializing_if = "Vec::is_empty")]
    pub beta_features: Vec<String>,

    /// Custom API version header override.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub api_version: Option<String>,

    /// Tool search configuration for regex-based dynamic tool discovery.
    /// When set, only tools whose names match the regex pattern are loaded.
    /// When `None`, all available tools are loaded.
    #[serde(skip)]
    pub tool_search: Option<ToolSearchConfig>,

    /// Whether a conversation keeps the `tools` array it started with and sends later tool
    /// changes as `tool_addition` / `tool_removal` blocks (beta `inline-tools-2026-09-15`), so a
    /// tool added mid-conversation does not miss the prompt cache. Applies to the Claude API
    /// models that support mid-conversation tool changes.
    #[serde(default)]
    pub inline_tool_changes: bool,

    /// Whether requests continue a message thread the API keeps (beta
    /// `message-threads-2026-08-12`), so each sends only the messages since the previous
    /// response. Threads are not ZDR eligible.
    #[serde(default)]
    pub message_threads: bool,
    /// Tokens the model paces a task against (`output_config.task_budget`, beta
    /// `task-budgets-2026-03-13`). `None` sends half of `max_tokens` at `xhigh` and `max`
    /// effort on a model that accepts task budgets, and nothing otherwise; see
    /// [`with_task_budget`](Self::with_task_budget).
    #[serde(default, skip_serializing_if = "Option::is_none")]
    pub task_budget: Option<u32>,
    /// Whether `xhigh` and `max` effort send a task budget when [`task_budget`](Self::task_budget) is
    /// `None`. On by default.
    #[serde(default = "default_prompt_caching")]
    pub automatic_task_budget: bool,
}

impl std::fmt::Debug for AnthropicConfig {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        f.debug_struct("AnthropicConfig")
            .field("api_key", &"[REDACTED]")
            .field("model", &self.model)
            .field("max_tokens", &self.max_tokens)
            .field("request_timeout_secs", &self.request_timeout_secs)
            .field("base_url", &self.base_url)
            .field("allow_insecure_http", &self.allow_insecure_http)
            .field("prompt_caching", &self.prompt_caching)
            .field("prompt_cache_ttl", &self.prompt_cache_ttl)
            .field("thinking", &self.thinking)
            .field("thinking_display", &self.thinking_display)
            .field("effort", &self.effort)
            .field("fast_mode", &self.fast_mode)
            .field("citations", &self.citations)
            .field("inference_geo", &self.inference_geo)
            .field("context_management", &self.context_management)
            .field("service_tier", &self.service_tier)
            .field("beta_features", &self.beta_features)
            .field("api_version", &self.api_version)
            .field("tool_search", &self.tool_search)
            .field("inline_tool_changes", &self.inline_tool_changes)
            .field("message_threads", &self.message_threads)
            .field("task_budget", &self.task_budget)
            .field("automatic_task_budget", &self.automatic_task_budget)
            .finish()
    }
}

fn default_prompt_caching() -> bool {
    true
}

impl Default for AnthropicConfig {
    fn default() -> Self {
        Self {
            api_key: String::new(),
            model: crate::catalog::ANTHROPIC_DEFAULT.to_string(),
            max_tokens: None,
            request_timeout_secs: None,
            base_url: None,
            allow_insecure_http: false,
            prompt_caching: true,
            prompt_cache_ttl: None,
            thinking: None,
            thinking_display: None,
            effort: None,
            fast_mode: false,
            citations: false,
            inference_geo: None,
            context_management: None,
            service_tier: None,
            beta_features: Vec::new(),
            api_version: None,
            tool_search: None,
            inline_tool_changes: false,
            message_threads: false,
            task_budget: None,
            automatic_task_budget: true,
        }
    }
}

impl AnthropicConfig {
    /// Create a new Anthropic config with the given API key and model.
    pub fn new(api_key: impl Into<String>, model: impl Into<String>) -> Self {
        Self { api_key: api_key.into(), model: model.into(), ..Default::default() }
    }

    /// Set the maximum tokens to generate, replacing the model-aware default.
    pub fn with_max_tokens(mut self, max_tokens: u32) -> Self {
        self.max_tokens = Some(max_tokens);
        self
    }

    /// Bound each request, replacing the 10-minute default.
    ///
    /// The bound covers a whole non-streaming request, such as an agent called
    /// through `AgentTool`, and the wait for the response headers of a streaming
    /// request. Sub-second precision is rounded up to the next second.
    ///
    /// # Example
    ///
    /// ```rust
    /// use std::time::Duration;
    /// use adk_model::anthropic::AnthropicConfig;
    ///
    /// let config = AnthropicConfig::new("sk-ant-xxx", "claude-opus-5-5")
    ///     .with_request_timeout(Duration::from_secs(1_800));
    /// assert_eq!(config.request_timeout_secs, Some(1_800));
    /// ```
    pub fn with_request_timeout(mut self, timeout: std::time::Duration) -> Self {
        self.request_timeout_secs = Some(timeout.as_secs() + u64::from(timeout.subsec_nanos() > 0));
        self
    }

    /// Set a custom base URL.
    ///
    /// The URL is validated when [`AnthropicClient::new`](super::AnthropicClient::new)
    /// builds the client: it must use `https://`, or `http://` with a loopback host,
    /// unless [`allow_insecure_http`](Self::allow_insecure_http) is set.
    pub fn with_base_url(mut self, base_url: impl Into<String>) -> Self {
        self.base_url = Some(base_url.into());
        self
    }

    /// Allow a plain `http://` base URL on a non-loopback host.
    ///
    /// Use this for a trusted internal gateway that is reachable only over plain
    /// HTTP. Every request attaches the API key, which then crosses the network
    /// unencrypted. The base URL is validated when
    /// [`AnthropicClient::new`](super::AnthropicClient::new) builds the client, so
    /// this method and [`with_base_url`](Self::with_base_url) can be called in
    /// either order. Accepting a non-loopback `http://` URL logs a warning with
    /// the host.
    ///
    /// The opt-in applies to the configured base URL. Without one, the client
    /// reads `ANTHROPIC_BASE_URL`, and a plain-HTTP URL from that variable is
    /// acknowledged by `ANTHROPIC_ALLOW_INSECURE_HTTP=1` instead.
    ///
    /// # Example
    ///
    /// ```rust
    /// use adk_model::anthropic::{AnthropicClient, AnthropicConfig};
    ///
    /// let config = AnthropicConfig::new("sk-ant-xxx", "claude-sonnet-5-5")
    ///     .allow_insecure_http()
    ///     .with_base_url("http://10.60.1.20:8080/api/v1/llm/anthropic");
    /// let client = AnthropicClient::new(config)?;
    /// # Ok::<(), adk_core::AdkError>(())
    /// ```
    pub fn allow_insecure_http(mut self) -> Self {
        self.allow_insecure_http = true;
        self
    }

    /// Enable or disable prompt caching.
    pub fn with_prompt_caching(mut self, enabled: bool) -> Self {
        self.prompt_caching = enabled;
        self
    }

    /// Set the lifetime of the prompt cache entries this client writes.
    ///
    /// Applies to both the system-prompt breakpoint and the automatic breakpoint
    /// on the conversation tail. A 1-hour entry costs more to write than a
    /// 5-minute one and pays off when requests sharing a prefix are more than five
    /// minutes apart, such as a conversation waiting on a person.
    ///
    /// # Example
    ///
    /// ```rust
    /// use adk_model::anthropic::{AnthropicConfig, CacheTtl};
    ///
    /// let config = AnthropicConfig::new("sk-ant-xxx", "claude-sonnet-5-5")
    ///     .with_prompt_cache_ttl(CacheTtl::one_hour());
    /// assert_eq!(config.prompt_cache_ttl, Some(CacheTtl::one_hour()));
    /// ```
    pub fn with_prompt_cache_ttl(mut self, ttl: adk_anthropic::CacheTtl) -> Self {
        self.prompt_cache_ttl = Some(ttl);
        self
    }

    /// Set the thinking mode.
    pub fn with_thinking_mode(mut self, mode: ThinkingMode) -> Self {
        self.thinking = Some(mode);
        self
    }

    /// Set whether responses carry the thinking text, for the configured thinking mode.
    ///
    /// Current models omit it by default; [`ThinkingDisplay::Summarized`] returns a summary.
    ///
    /// # Example
    ///
    /// ```
    /// use adk_model::anthropic::{AnthropicConfig, ThinkingDisplay, ThinkingMode};
    ///
    /// let config = AnthropicConfig::new("sk-ant-xxx", "claude-opus-5-5")
    ///     .with_thinking_mode(ThinkingMode::Adaptive)
    ///     .with_thinking_display(ThinkingDisplay::Summarized);
    /// assert_eq!(config.thinking_display, Some(ThinkingDisplay::Summarized));
    /// ```
    pub fn with_thinking_display(mut self, display: ThinkingDisplay) -> Self {
        self.thinking_display = Some(display);
        self
    }

    /// Convenience: enable budget-based thinking with the given token budget.
    pub fn with_thinking(mut self, budget_tokens: u32) -> Self {
        self.thinking = Some(ThinkingMode::Enabled { budget_tokens });
        self
    }

    /// Set the effort level (goes into `output_config.effort`).
    pub fn with_effort(mut self, effort: Effort) -> Self {
        self.effort = Some(effort);
        self
    }

    /// Sets the tokens the model paces a task against (`output_config.task_budget`).
    ///
    /// `max_tokens` is enforced but invisible to the model, so a turn at `xhigh` or `max`
    /// effort can spend all of it on thinking and stop before the answer. A task budget is
    /// advisory and visible: the model sees a countdown of its thinking, tool calls and
    /// output and wraps up as it runs down. The API takes at least 20,000 tokens, on Claude
    /// Opus 4.7 and later Opus models, Sonnet 5.5, Haiku 5.5, and Fable and Mythos 5.
    ///
    /// Without this call the client sends half of `max_tokens` at `xhigh` and `max` effort
    /// on those models; [`without_automatic_task_budget`](Self::without_automatic_task_budget)
    /// turns that off.
    ///
    /// # Example
    ///
    /// ```rust
    /// use adk_model::anthropic::{AnthropicConfig, Effort, ThinkingMode};
    ///
    /// let config = AnthropicConfig::new("sk-ant-xxx", "claude-opus-5-5")
    ///     .with_thinking_mode(ThinkingMode::Adaptive)
    ///     .with_effort(Effort::XHigh)
    ///     .with_task_budget(48_000);
    /// assert_eq!(config.task_budget, Some(48_000));
    /// ```
    pub fn with_task_budget(mut self, tokens: u32) -> Self {
        self.task_budget = Some(tokens);
        self
    }

    /// Stops the client sending a task budget of its own at `xhigh` and `max` effort, for an
    /// endpoint that rejects the `task-budgets-2026-03-13` beta.
    ///
    /// # Example
    ///
    /// ```rust
    /// use adk_model::anthropic::AnthropicConfig;
    ///
    /// let config = AnthropicConfig::new("sk-ant-xxx", "claude-opus-5-5")
    ///     .without_automatic_task_budget();
    /// assert!(!config.automatic_task_budget);
    /// ```
    pub fn without_automatic_task_budget(mut self) -> Self {
        self.automatic_task_budget = false;
        self
    }

    /// Enable fast mode for Claude Opus 5 or Claude Opus 4.8.
    pub fn with_fast_mode(mut self, enabled: bool) -> Self {
        self.fast_mode = enabled;
        self
    }

    /// Enable citations on documents.
    pub fn with_citations(mut self, enabled: bool) -> Self {
        self.citations = enabled;
        self
    }

    /// Set geographic routing for data residency.
    pub fn with_inference_geo(mut self, geo: impl Into<String>) -> Self {
        self.inference_geo = Some(geo.into());
        self
    }

    /// Set the service tier.
    pub fn with_service_tier(mut self, tier: impl Into<String>) -> Self {
        self.service_tier = Some(tier.into());
        self
    }

    /// Set context management (tool result clearing, thinking block clearing).
    pub fn with_context_management(mut self, cm: adk_anthropic::ContextManagement) -> Self {
        self.context_management = Some(cm);
        self
    }

    /// Add a beta feature header value.
    pub fn with_beta_feature(mut self, feature: impl Into<String>) -> Self {
        self.beta_features.push(feature.into());
        self
    }

    /// Set a custom API version header.
    pub fn with_api_version(mut self, version: impl Into<String>) -> Self {
        self.api_version = Some(version.into());
        self
    }

    /// Set tool search configuration for dynamic tool discovery.
    ///
    /// When set, only tools whose names match the regex pattern are loaded per request.
    /// When not set, all available tools are loaded.
    ///
    /// # Example
    ///
    /// ```rust
    /// use adk_model::anthropic::AnthropicConfig;
    /// use adk_anthropic::{ThinkingDisplay, ToolSearchConfig};
    ///
    /// let config = AnthropicConfig::new("sk-ant-xxx", "claude-sonnet-4-6")
    ///     .with_tool_search(ToolSearchConfig::new("^(search|fetch)_.*"));
    /// ```
    pub fn with_tool_search(mut self, config: ToolSearchConfig) -> Self {
        self.tool_search = Some(config);
        self
    }

    /// Sends tools added, redefined or removed mid-conversation as inline tool changes, so the
    /// conversation's `tools` array, and the cached prefix it opens, stays as first sent.
    ///
    /// The client remembers each conversation's tools in memory for an hour; a conversation it
    /// does not remember, or whose history changed, sends its tools as they are.
    ///
    /// # Example
    ///
    /// ```rust
    /// use adk_model::anthropic::AnthropicConfig;
    ///
    /// let config = AnthropicConfig::new("sk-ant-xxx", "claude-sonnet-5-5")
    ///     .with_inline_tool_changes(true);
    /// assert!(config.inline_tool_changes);
    /// ```
    pub fn with_inline_tool_changes(mut self, enabled: bool) -> Self {
        self.inline_tool_changes = enabled;
        self
    }

    /// Continues a message thread the API keeps for each conversation, so a request sends only
    /// the messages since the previous response: smaller requests and a steadier time to first
    /// token in long tool loops, at the same price.
    ///
    /// The session stays the source of truth: a request continues its thread only when the
    /// conversation it sends starts with exactly what the thread holds, and creates a new one
    /// otherwise. A conversation that carries a compaction is sent without a thread, and a
    /// thread the API cannot continue is replaced by sending the whole conversation. Threads
    /// are not ZDR eligible.
    ///
    /// # Example
    ///
    /// ```rust
    /// use adk_model::anthropic::AnthropicConfig;
    ///
    /// let config = AnthropicConfig::new("sk-ant-xxx", "claude-sonnet-5-5").with_message_threads(true);
    /// assert!(config.message_threads);
    /// ```
    pub fn with_message_threads(mut self, enabled: bool) -> Self {
        self.message_threads = enabled;
        self
    }
}

#[cfg(test)]
mod effort_tests {
    use super::Effort;

    /// The harness levels map to their namesakes; `XHigh` and `Max` are never produced.
    #[test]
    fn every_harness_effort_maps_to_its_namesake() {
        for (core, provider) in [
            (adk_core::Effort::Low, Effort::Low),
            (adk_core::Effort::Medium, Effort::Medium),
            (adk_core::Effort::High, Effort::High),
        ] {
            assert_eq!(Effort::from(core), provider);
        }
    }
}