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
//! # adk-model
//!
//! LLM provider clients for ADK-Rust. Every client implements [`adk_core::Llm`], so agents and
//! runners accept any of them.
//!
//! ## Providers
//!
//! | Client | Provider | Feature |
//! |--------|----------|---------|
//! | [`GeminiModel`] | Google Gemini (AI Studio, Vertex AI with `gemini-vertex`) | `gemini` (default) |
//! | `OpenAIClient` | OpenAI Chat Completions | `openai` |
//! | `openai::OpenAIResponsesClient` | OpenAI Responses API | `openai` |
//! | `AzureOpenAIClient` | Azure OpenAI | `openai` |
//! | `OpenAICompatible` | Any OpenAI-compatible endpoint, with presets for xAI, Fireworks AI, Together AI, Mistral AI, Perplexity, Cerebras, SambaNova, OrcaRouter, Vultr Serverless Inference, API Route, MiniMax, Zhipu AI, Baidu, Cohere, ByteDance, and Gemini | `openai` |
//! | `AnthropicClient` | Anthropic Claude | `anthropic` |
//! | `DeepSeekClient` | DeepSeek | `deepseek` |
//! | `GroqClient` | Groq | `groq` |
//! | `MuseClient` | Meta Muse Spark | `muse` |
//! | `OllamaModel` | Ollama (local) | `ollama` |
//! | `OpenRouterClient` | OpenRouter, with its native chat, responses, routing, discovery, and credits APIs | `openrouter` |
//! | `OpenCodeClient` | OpenCode Go and Zen | `opencode` |
//! | `BedrockClient` | Amazon Bedrock | `bedrock` |
//! | `AzureAIClient` | Azure AI Inference | `azure-ai` |
//! | [`FallbackLlm`] | An ordered chain of any of the above, each tried when the one before it fails | always |
//! | [`ScriptedLlm`] | Test double that answers each call with the next scripted reply and records every request | always |
//! | [`MockLlm`] | Test double that replays the same responses on every call | always |
//!
//! Transport and option features add to a provider:
//!
//! | Feature | Enables |
//! |---------|---------|
//! | `gemini-interactions` | `GeminiModel::use_interactions_api`, the Gemini Interactions API transport (Beta) |
//! | `openai-ws` | The Responses API WebSocket transport (`WsTransport`) |
//! | `openai-conversations` | The Conversations API client (`ConversationsClient`) |
//! | `openai-responses-full` | `openai-ws` and `openai-conversations` |
//! | `muse-responses` | `MuseApi::Responses` through the Open Responses engine; implies `muse` and `openai` |
//! | `muse-realtime` | `MuseRealtimeAsrClient`, live transcription over Meta's realtime WebSocket; implies `muse` |
//! | `all-providers` | `gemini`, `openai`, `anthropic`, `deepseek`, `ollama`, `groq`, `muse`, `openrouter`, `opencode`, `bedrock` and `azure-ai` |
//!
//! [`catalog`] holds the recommended model per provider and the lifecycle of known model IDs;
//! [`pricing::PricingCatalog`] prices usage for every provider.
//!
//! ## Quick start
//!
//! ```rust,no_run
//! use adk_core::{Content, Llm, LlmRequest};
//! use adk_model::GeminiModel;
//! use futures::StreamExt;
//!
//! # #[tokio::main]
//! # async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let model = GeminiModel::new(std::env::var("GOOGLE_API_KEY")?, "gemini-3.8-flash")?;
//! let request = LlmRequest::new(
//! "gemini-3.8-flash",
//! vec![Content::new("user").with_text("Name one planet in a short sentence.")],
//! );
//!
//! let mut responses = model.generate_content(request, false).await?;
//! while let Some(response) = responses.next().await {
//! if let Some(content) = response?.content {
//! for part in &content.parts {
//! if let Some(text) = part.text() {
//! print!("{text}");
//! }
//! }
//! }
//! }
//! # Ok(())
//! # }
//! ```
//!
//! ## Other providers
//!
//! Each client is built from its config and used the same way:
//!
//! ```rust,no_run
//! # #[cfg(all(feature = "openai", feature = "anthropic", feature = "deepseek"))]
//! # fn main() -> Result<(), adk_core::AdkError> {
//! use adk_model::anthropic::{AnthropicClient, AnthropicConfig};
//! use adk_model::deepseek::DeepSeekClient;
//! use adk_model::openai::{OpenAIClient, OpenAIConfig, OpenAIResponsesClient, OpenAIResponsesConfig};
//! use adk_model::{OpenAICompatible, OpenAICompatibleConfig};
//!
//! let chat = OpenAIClient::new(OpenAIConfig::new("sk-...", "gpt-6.1-sol"))?;
//! let responses = OpenAIResponsesClient::new(OpenAIResponsesConfig::new("sk-...", "gpt-6.1-sol"))?;
//! let claude = AnthropicClient::new(AnthropicConfig::new("sk-ant-...", "claude-sonnet-5-5"))?;
//! let deepseek = DeepSeekClient::v4_flash("sk-...")?;
//! let grok = OpenAICompatible::new(OpenAICompatibleConfig::xai("xai-...", "grok-4.7"))?;
//! # let _ = (chat, responses, claude, deepseek, grok);
//! # Ok(())
//! # }
//! # #[cfg(not(all(feature = "openai", feature = "anthropic", feature = "deepseek")))]
//! # fn main() {}
//! ```
//!
//! ## Test doubles
//!
//! ```rust
//! use adk_core::{Content, Llm, LlmRequest};
//! use adk_model::{ScriptedLlm, ScriptedResponse};
//! use futures::StreamExt;
//!
//! # #[tokio::main]
//! # async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! let model = ScriptedLlm::new("scripted", vec![ScriptedResponse::text("Mars.")]);
//! let request = LlmRequest::new("scripted", vec![Content::new("user").with_text("Name a planet.")]);
//!
//! let response = model.generate_content(request, false).await?.next().await.ok_or("no response")??;
//! assert_eq!(response.content.unwrap().parts[0].text(), Some("Mars."));
//! assert_eq!(model.requests().len(), 1);
//! # Ok(())
//! # }
//! ```
//!
//! ## OpenRouter scope boundary
//!
//! `OpenRouterClient`'s native methods cover model discovery and credits, exact chat and
//! responses payloads, routing and fallback, plugins, and built-in tools. Its [`adk_core::Llm`]
//! adapter covers streaming, reasoning parts, tool calling, and multimodal requests, takes
//! OpenRouter tuning through `openrouter::OpenRouterRequestOptions`, and maps responses into
//! the generic [`adk_core::LlmResponse`] shape.
pub
/// Curated provider model catalog, lifecycle metadata, and recommended defaults.
/// Gemini model provider (Google AI Studio and Vertex AI).
/// Connect and idle timeouts for the HTTP transport of model clients.
/// Mock LLM for testing without real API calls.
/// Conversion outcomes for content parts sent to a provider.
/// Canonical provider identifiers and metadata.
/// Retry logic with exponential backoff for transient provider errors.
/// Scripted LLM test double with per-call replies and request capture.
pub
pub
pub
pub use AnthropicClient;
pub use ;
pub use ;
pub use ;
pub use ;
pub use GeminiModel;
pub use ;
pub use HttpTimeouts;
pub use MockLlm;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use PricingCatalog;
pub use ModelProvider;
pub use RetryConfig;
pub use ServerRetryHint;
pub use ;