| Title: | Additional Model Provider Adapters for the 'aisdk' Toolkit |
|---|---|
| Description: | Additional AI model provider adapters for the 'aisdk' toolkit, covering OpenAI-compatible and Anthropic-compatible services such as 'DeepSeek', 'Moonshot'/'Kimi', 'Stepfun', 'Volcengine', 'AiHubMix', 'xAI', 'OpenRouter', 'Bailian', and 'NVIDIA'. Providers register themselves with the core 'aisdk' provider registry on load. |
| Authors: | Yonghe Xia [aut, cre] |
| Maintainer: | Yonghe Xia <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0 |
| Built: | 2026-06-08 20:18:47 UTC |
| Source: | https://github.com/cran/aisdk.providers |
Provider class for AiHubMix.
aisdk::OpenAIProvider -> AiHubMixProvider
new()
Initialize the AiHubMix provider.
AiHubMixProvider$new( api_key = NULL, base_url = NULL, headers = NULL, timeout_seconds = NULL, total_timeout_seconds = NULL, first_byte_timeout_seconds = NULL, connect_timeout_seconds = NULL, idle_timeout_seconds = NULL )
api_keyAiHubMix API key. Defaults to AIHUBMIX_API_KEY env var.
base_urlBase URL. Defaults to https://aihubmix.com/v1.
headersOptional additional headers.
timeout_secondsLegacy alias for total_timeout_seconds.
total_timeout_secondsOptional total request timeout in seconds for API calls.
first_byte_timeout_secondsOptional time-to-first-byte timeout in seconds for API calls.
connect_timeout_secondsOptional connection-establishment timeout in seconds for API calls.
idle_timeout_secondsOptional stall timeout in seconds for API calls.
language_model()
Create a language model.
AiHubMixProvider$language_model(model_id = NULL)
model_idThe model ID (e.g., "claude-sonnet-3-5", "claude-opus-3", "gpt-4o").
An AiHubMixLanguageModel object.
image_model()
Create an image model.
AiHubMixProvider$image_model(model_id = NULL)
model_idThe model ID (e.g., "gpt-image-2").
An OpenAIImageModel object.
clone()
The objects of this class are cloneable with this method.
AiHubMixProvider$clone(deep = FALSE)
deepWhether to make a deep clone.
Provider class for Alibaba Cloud Bailian / DashScope platform.
aisdk::OpenAIProvider -> BailianProvider
aisdk::OpenAIProvider$create_conversation()aisdk::OpenAIProvider$delete_conversation()aisdk::OpenAIProvider$embedding_model()aisdk::OpenAIProvider$get_conversation()aisdk::OpenAIProvider$image_model()aisdk::OpenAIProvider$model()aisdk::OpenAIProvider$responses_model()aisdk::OpenAIProvider$smart_model()new()
Initialize the Bailian provider.
BailianProvider$new( api_key = NULL, base_url = NULL, headers = NULL, timeout_seconds = NULL, total_timeout_seconds = NULL, first_byte_timeout_seconds = NULL, connect_timeout_seconds = NULL, idle_timeout_seconds = NULL )
api_keyDashScope API key. Defaults to DASHSCOPE_API_KEY env var.
base_urlBase URL. Defaults to https://dashscope.aliyuncs.com/compatible-mode/v1.
headersOptional additional headers.
timeout_secondsLegacy alias for total_timeout_seconds.
total_timeout_secondsOptional total request timeout in seconds for API calls.
first_byte_timeout_secondsOptional time-to-first-byte timeout in seconds for API calls.
connect_timeout_secondsOptional connection-establishment timeout in seconds for API calls.
idle_timeout_secondsOptional stall timeout in seconds for API calls.
language_model()
Create a language model.
BailianProvider$language_model(model_id = NULL)
model_idThe model ID (e.g., "qwen-plus", "qwen-turbo", "qwq-32b").
A BailianLanguageModel object.
clone()
The objects of this class are cloneable with this method.
BailianProvider$clone(deep = FALSE)
deepWhether to make a deep clone.
Factory function to create an AiHubMix provider.
AiHubMix provides a unified API for various models including Claude, OpenAI, Gemini, etc.
create_aihubmix( api_key = NULL, base_url = NULL, headers = NULL, timeout_seconds = NULL, total_timeout_seconds = NULL, first_byte_timeout_seconds = NULL, connect_timeout_seconds = NULL, idle_timeout_seconds = NULL )create_aihubmix( api_key = NULL, base_url = NULL, headers = NULL, timeout_seconds = NULL, total_timeout_seconds = NULL, first_byte_timeout_seconds = NULL, connect_timeout_seconds = NULL, idle_timeout_seconds = NULL )
api_key |
AiHubMix API key. Defaults to AIHUBMIX_API_KEY env var. |
base_url |
Base URL for API calls. Defaults to https://aihubmix.com/v1. |
headers |
Optional additional headers. |
timeout_seconds |
Legacy alias for |
total_timeout_seconds |
Optional total request timeout in seconds for API calls. |
first_byte_timeout_seconds |
Optional time-to-first-byte timeout in seconds for API calls. |
connect_timeout_seconds |
Optional connection-establishment timeout in seconds for API calls. |
idle_timeout_seconds |
Optional stall timeout in seconds for API calls. |
An AiHubMixProvider object.
if (interactive()) { aihubmix <- create_aihubmix() model <- aihubmix$language_model("claude-sonnet-3-5") result <- generate_text(model, "Explain quantum computing in one sentence.") }if (interactive()) { aihubmix <- create_aihubmix() model <- aihubmix$language_model("claude-sonnet-3-5") result <- generate_text(model, "Explain quantum computing in one sentence.") }
Factory function to create an AiHubMix provider using the Anthropic-compatible API. This allows you to use AiHubMix Claude models with the native Anthropic API format, unlocking advanced features like Prompt Caching.
create_aihubmix_anthropic( api_key = NULL, extended_caching = FALSE, headers = NULL, timeout_seconds = NULL, total_timeout_seconds = NULL, first_byte_timeout_seconds = NULL, connect_timeout_seconds = NULL, idle_timeout_seconds = NULL )create_aihubmix_anthropic( api_key = NULL, extended_caching = FALSE, headers = NULL, timeout_seconds = NULL, total_timeout_seconds = NULL, first_byte_timeout_seconds = NULL, connect_timeout_seconds = NULL, idle_timeout_seconds = NULL )
api_key |
AiHubMix API key. Defaults to AIHUBMIX_API_KEY env var. |
extended_caching |
Logical. If TRUE, enables the 1-hour beta cache for Claude. |
headers |
Optional additional headers. |
timeout_seconds |
Legacy alias for |
total_timeout_seconds |
Optional total request timeout in seconds for API calls. |
first_byte_timeout_seconds |
Optional time-to-first-byte timeout in seconds for API calls. |
connect_timeout_seconds |
Optional connection-establishment timeout in seconds for API calls. |
idle_timeout_seconds |
Optional stall timeout in seconds for API calls. |
AiHubMix provides an Anthropic-compatible endpoint at https://aihubmix.com/v1.
This convenience function wraps create_anthropic() with AiHubMix-specific defaults.
An AnthropicProvider object configured for AiHubMix.
if (interactive()) { # Use AiHubMix via Anthropic API format (unlocks caching) aihubmix_claude <- create_aihubmix_anthropic() model <- aihubmix_claude$language_model("claude-3-5-sonnet-20241022") result <- generate_text(model, "Hello Claude!") }if (interactive()) { # Use AiHubMix via Anthropic API format (unlocks caching) aihubmix_claude <- create_aihubmix_anthropic() model <- aihubmix_claude$language_model("claude-3-5-sonnet-20241022") result <- generate_text(model, "Hello Claude!") }
Factory function to create an AiHubMix provider using the Gemini-compatible API. This allows you to use Gemini models with the native Gemini API structure.
create_aihubmix_gemini( api_key = NULL, headers = NULL, timeout_seconds = NULL, total_timeout_seconds = NULL, first_byte_timeout_seconds = NULL, connect_timeout_seconds = NULL, idle_timeout_seconds = NULL )create_aihubmix_gemini( api_key = NULL, headers = NULL, timeout_seconds = NULL, total_timeout_seconds = NULL, first_byte_timeout_seconds = NULL, connect_timeout_seconds = NULL, idle_timeout_seconds = NULL )
api_key |
AiHubMix API key. Defaults to AIHUBMIX_API_KEY env var. |
headers |
Optional additional headers. |
timeout_seconds |
Legacy alias for |
total_timeout_seconds |
Optional total request timeout in seconds for API calls. |
first_byte_timeout_seconds |
Optional time-to-first-byte timeout in seconds for API calls. |
connect_timeout_seconds |
Optional connection-establishment timeout in seconds for API calls. |
idle_timeout_seconds |
Optional stall timeout in seconds for API calls. |
AiHubMix provides a Gemini-compatible endpoint at https://aihubmix.com/gemini/v1beta/models.
This convenience function wraps create_gemini() with AiHubMix-specific defaults.
A GeminiProvider object configured for AiHubMix.
if (interactive()) { # Use AiHubMix via Gemini API format aihubmix_gemini <- create_aihubmix_gemini() model <- aihubmix_gemini$language_model("gemini-2.5-flash") result <- generate_text(model, "Hello Gemini!") }if (interactive()) { # Use AiHubMix via Gemini API format aihubmix_gemini <- create_aihubmix_gemini() model <- aihubmix_gemini$language_model("gemini-2.5-flash") result <- generate_text(model, "Hello Gemini!") }
Factory function to create an Alibaba Cloud Bailian provider using the DashScope API.
create_bailian( api_key = NULL, base_url = NULL, headers = NULL, timeout_seconds = NULL, total_timeout_seconds = NULL, first_byte_timeout_seconds = NULL, connect_timeout_seconds = NULL, idle_timeout_seconds = NULL )create_bailian( api_key = NULL, base_url = NULL, headers = NULL, timeout_seconds = NULL, total_timeout_seconds = NULL, first_byte_timeout_seconds = NULL, connect_timeout_seconds = NULL, idle_timeout_seconds = NULL )
api_key |
DashScope API key. Defaults to DASHSCOPE_API_KEY env var. |
base_url |
Base URL for API calls. Defaults to https://dashscope.aliyuncs.com/compatible-mode/v1. |
headers |
Optional additional headers. |
timeout_seconds |
Legacy alias for |
total_timeout_seconds |
Optional total request timeout in seconds for API calls. |
first_byte_timeout_seconds |
Optional time-to-first-byte timeout in seconds for API calls. |
connect_timeout_seconds |
Optional connection-establishment timeout in seconds for API calls. |
idle_timeout_seconds |
Optional stall timeout in seconds for API calls. |
A BailianProvider object.
qwen3.6-plus: Latest Qwen flagship with 1M context. Strong reasoning and multimodal capabilities. (Reasoning, Vision, Tools, Structured) | ctx: 1000k
qwen3.5-plus: Balanced model with excellent reasoning at ultra-low cost. (Reasoning, Vision, Tools, Structured) | ctx: 1000k
qwen-plus: Most popular general-purpose model. Good balance of capability and cost. (Reasoning, Vision, Tools, Structured) | ctx: 1000k
qwen-max: Previous generation premium model for complex reasoning and analysis. (Reasoning, Vision, Tools, Structured) | ctx: 128k
qwen-turbo: Fast and cost-efficient model for high-volume simple tasks. (Vision, Tools, Structured) | ctx: 128k
qwen-coder-plus: Coding specialist optimized for agentic software engineering. (Reasoning, Tools, Structured) | ctx: 128k
qwq-32b: 32B parameter reasoning model with strong math and logic capabilities. (Reasoning, Tools, Structured) | ctx: 128k
qwen-vl-plus: Vision-language model for image understanding and visual reasoning. (Vision, Tools, Structured) | ctx: 32k
qwen3.5-omni-plus: Multimodal model supporting text, image, video, and audio input. (Reasoning, Vision, Tools, Audio, Structured) | ctx: 32k
text-embedding-v3: Text embedding model for similarity search and retrieval. | ctx: 8k
if (interactive()) { bailian <- create_bailian() # Standard chat model model <- bailian$language_model("qwen-plus") result <- generate_text(model, "Hello") # Reasoning model (QwQ with chain-of-thought) model <- bailian$language_model("qwq-32b") result <- generate_text(model, "Solve: What is 15 * 23?") print(result$reasoning) # Chain-of-thought reasoning # Default model (qwen-plus) model <- bailian$language_model() }if (interactive()) { bailian <- create_bailian() # Standard chat model model <- bailian$language_model("qwen-plus") result <- generate_text(model, "Hello") # Reasoning model (QwQ with chain-of-thought) model <- bailian$language_model("qwq-32b") result <- generate_text(model, "Solve: What is 15 * 23?") print(result$reasoning) # Chain-of-thought reasoning # Default model (qwen-plus) model <- bailian$language_model() }
Factory function to create a DeepSeek provider.
create_deepseek( api_key = NULL, base_url = NULL, headers = NULL, timeout_seconds = NULL, total_timeout_seconds = NULL, first_byte_timeout_seconds = NULL, connect_timeout_seconds = NULL, idle_timeout_seconds = NULL )create_deepseek( api_key = NULL, base_url = NULL, headers = NULL, timeout_seconds = NULL, total_timeout_seconds = NULL, first_byte_timeout_seconds = NULL, connect_timeout_seconds = NULL, idle_timeout_seconds = NULL )
api_key |
DeepSeek API key. Defaults to DEEPSEEK_API_KEY env var. |
base_url |
Base URL. Defaults to "https://api.deepseek.com". |
headers |
Optional additional headers. |
timeout_seconds |
Legacy alias for |
total_timeout_seconds |
Optional total request timeout in seconds for API calls. |
first_byte_timeout_seconds |
Optional time-to-first-byte timeout in seconds for API calls. |
connect_timeout_seconds |
Optional connection-establishment timeout in seconds for API calls. |
idle_timeout_seconds |
Optional stall timeout in seconds for API calls. |
DeepSeek supports classic aliases plus newer model families such as DeepSeek V4.
Common model IDs include:
deepseek-chat: Chat alias provided by DeepSeek
deepseek-reasoner: Reasoning alias provided by DeepSeek
deepseek-v4*: DeepSeek V4 family model IDs exposed by the API
Additional DeepSeek-specific request fields such as thinking,
thinking_budget, and reasoning_effort are passed through when supplied
to $generate() or $stream().
A DeepSeekProvider object.
deepseek-v4-flash: DeepSeek V4 Flash hybrid-thinking model (Reasoning, Tools, Structured) | ctx: 1000k
deepseek-v4-pro: DeepSeek V4 Pro hybrid-thinking model (Reasoning, Tools, Structured) | ctx: 1000k
if (interactive()) { # Basic usage with deepseek-chat deepseek <- create_deepseek() model <- deepseek$language_model("deepseek-chat") result <- generate_text(model, "Hello!") # Using a reasoning-capable model model_reasoner <- deepseek$language_model("deepseek-reasoner") result <- model_reasoner$generate( messages = list(list(role = "user", content = "Solve: What is 15 * 23?")), max_tokens = 500, thinking = TRUE ) print(result$text) # Final answer print(result$reasoning) # Chain-of-thought reasoning # Streaming with reasoning stream_text(model_reasoner, "Explain quantum entanglement step by step") }if (interactive()) { # Basic usage with deepseek-chat deepseek <- create_deepseek() model <- deepseek$language_model("deepseek-chat") result <- generate_text(model, "Hello!") # Using a reasoning-capable model model_reasoner <- deepseek$language_model("deepseek-reasoner") result <- model_reasoner$generate( messages = list(list(role = "user", content = "Solve: What is 15 * 23?")), max_tokens = 500, thinking = TRUE ) print(result$text) # Final answer print(result$reasoning) # Chain-of-thought reasoning # Streaming with reasoning stream_text(model_reasoner, "Explain quantum entanglement step by step") }
Factory function to create a DeepSeek provider using the Anthropic-compatible API. This allows you to use DeepSeek models with the Anthropic API format.
create_deepseek_anthropic( api_key = NULL, headers = NULL, timeout_seconds = NULL, total_timeout_seconds = NULL, first_byte_timeout_seconds = NULL, connect_timeout_seconds = NULL, idle_timeout_seconds = NULL )create_deepseek_anthropic( api_key = NULL, headers = NULL, timeout_seconds = NULL, total_timeout_seconds = NULL, first_byte_timeout_seconds = NULL, connect_timeout_seconds = NULL, idle_timeout_seconds = NULL )
api_key |
DeepSeek API key. Defaults to DEEPSEEK_API_KEY env var. |
headers |
Optional additional headers. |
timeout_seconds |
Legacy alias for |
total_timeout_seconds |
Optional total request timeout in seconds for API calls. |
first_byte_timeout_seconds |
Optional time-to-first-byte timeout in seconds for API calls. |
connect_timeout_seconds |
Optional connection-establishment timeout in seconds for API calls. |
idle_timeout_seconds |
Optional stall timeout in seconds for API calls. |
DeepSeek provides an Anthropic-compatible endpoint at https://api.deepseek.com/anthropic.
This convenience function wraps create_anthropic() with DeepSeek-specific defaults.
Note: When using an unsupported model name, the API backend will automatically
map it to deepseek-chat.
An AnthropicProvider object configured for DeepSeek.
if (interactive()) { # Use DeepSeek via Anthropic API format deepseek <- create_deepseek_anthropic() model <- deepseek$language_model("deepseek-chat") result <- generate_text(model, "Hello!") # This is useful for tools that expect Anthropic API format # such as Claude Code integration }if (interactive()) { # Use DeepSeek via Anthropic API format deepseek <- create_deepseek_anthropic() model <- deepseek$language_model("deepseek-chat") result <- generate_text(model, "Hello!") # This is useful for tools that expect Anthropic API format # such as Claude Code integration }
Convenience wrapper for Kimi Code membership API. By default this uses the
Anthropic-compatible endpoint because it works for self-built coding agents
with their real User-Agent. Set api_format = "openai" when integrating with
OpenAI-compatible tools that Kimi Code recognizes as coding agents.
create_kimi_code( api_key = NULL, base_url = NULL, api_format = c("anthropic", "openai"), headers = NULL, prompt_cache_key = NULL, timeout_seconds = NULL, total_timeout_seconds = NULL, first_byte_timeout_seconds = NULL, connect_timeout_seconds = NULL, idle_timeout_seconds = NULL )create_kimi_code( api_key = NULL, base_url = NULL, api_format = c("anthropic", "openai"), headers = NULL, prompt_cache_key = NULL, timeout_seconds = NULL, total_timeout_seconds = NULL, first_byte_timeout_seconds = NULL, connect_timeout_seconds = NULL, idle_timeout_seconds = NULL )
api_key |
API key. Defaults to MOONSHOT_API_KEY for the Kimi Open Platform, or KIMI_API_KEY / KIMI_CODE_API_KEY for Kimi Code. |
base_url |
Base URL for API calls. |
api_format |
API protocol to use: "anthropic" or "openai". |
headers |
Optional additional headers. |
prompt_cache_key |
Default prompt cache key for Kimi Code requests. |
timeout_seconds |
Legacy alias for |
total_timeout_seconds |
Optional total request timeout in seconds. |
first_byte_timeout_seconds |
Optional time-to-first-byte timeout. |
connect_timeout_seconds |
Optional connection-establishment timeout. |
idle_timeout_seconds |
Optional stall timeout. |
A provider object configured for Kimi Code.
Convenience wrapper for Kimi Code's Anthropic-compatible endpoint. Use model
ID kimi-for-coding. The public Kimi docs list the Anthropic base as
https://api.kimi.com/coding/; aisdk's Anthropic provider appends
/messages directly, so this wrapper normalizes to
https://api.kimi.com/coding/v1.
create_kimi_code_anthropic( api_key = NULL, base_url = NULL, headers = NULL, timeout_seconds = NULL, total_timeout_seconds = NULL, first_byte_timeout_seconds = NULL, connect_timeout_seconds = NULL, idle_timeout_seconds = NULL )create_kimi_code_anthropic( api_key = NULL, base_url = NULL, headers = NULL, timeout_seconds = NULL, total_timeout_seconds = NULL, first_byte_timeout_seconds = NULL, connect_timeout_seconds = NULL, idle_timeout_seconds = NULL )
api_key |
API key. Defaults to MOONSHOT_API_KEY for the Kimi Open Platform, or KIMI_API_KEY / KIMI_CODE_API_KEY for Kimi Code. |
base_url |
Base URL for API calls. |
headers |
Optional additional headers. |
timeout_seconds |
Legacy alias for |
total_timeout_seconds |
Optional total request timeout in seconds. |
first_byte_timeout_seconds |
Optional time-to-first-byte timeout. |
connect_timeout_seconds |
Optional connection-establishment timeout. |
idle_timeout_seconds |
Optional stall timeout. |
An AnthropicProvider object configured for Kimi Code.
Factory function to create a Moonshot provider. Use platform = "platform"
for the pay-as-you-go Kimi Open Platform (https://api.moonshot.cn/v1) and
platform = "coding" for Kimi Code membership API
(https://api.kimi.com/coding/v1). The two platforms use separate API keys.
create_moonshot( api_key = NULL, base_url = NULL, platform = c("auto", "platform", "coding"), headers = NULL, prompt_cache_key = NULL, timeout_seconds = NULL, total_timeout_seconds = NULL, first_byte_timeout_seconds = NULL, connect_timeout_seconds = NULL, idle_timeout_seconds = NULL )create_moonshot( api_key = NULL, base_url = NULL, platform = c("auto", "platform", "coding"), headers = NULL, prompt_cache_key = NULL, timeout_seconds = NULL, total_timeout_seconds = NULL, first_byte_timeout_seconds = NULL, connect_timeout_seconds = NULL, idle_timeout_seconds = NULL )
api_key |
API key. Defaults to MOONSHOT_API_KEY for the Kimi Open Platform, or KIMI_API_KEY / KIMI_CODE_API_KEY for Kimi Code. |
base_url |
Base URL for API calls. |
platform |
API platform: "auto", "platform", or "coding". |
headers |
Optional additional headers. |
prompt_cache_key |
Default prompt cache key for Kimi Code requests. |
timeout_seconds |
Legacy alias for |
total_timeout_seconds |
Optional total request timeout in seconds. |
first_byte_timeout_seconds |
Optional time-to-first-byte timeout. |
connect_timeout_seconds |
Optional connection-establishment timeout. |
idle_timeout_seconds |
Optional stall timeout. |
A MoonshotProvider object.
kimi-k2.6: Kimi flagship multimodal model for agentic coding, long-context reasoning, and general agent tasks (Reasoning, Vision, Tools, Structured) | ctx: 262k
kimi-k2.5: Kimi K2.5 multimodal model for agent, coding, vision, thinking, and conversation tasks (Reasoning, Vision, Tools, Structured) | ctx: 262k
kimi-k2-0905-preview: Kimi K2 preview model with enhanced agentic coding, frontend, and context understanding capabilities (Reasoning, Tools, Structured) | ctx: 262k
kimi-for-coding: Stable Kimi Code membership model ID for coding agents; backend maps it to the latest coding model (Reasoning, Vision, Tools, Structured) | ctx: 262k
moonshot-v1-8k: Moonshot V1 text generation model with 8k context (Tools, Structured) | ctx: 8k
moonshot-v1-32k: Moonshot V1 text generation model with 32k context (Tools, Structured) | ctx: 33k
moonshot-v1-128k: Moonshot V1 text generation model with 128k context (Tools, Structured) | ctx: 131k
if (interactive()) { moonshot <- create_moonshot() model <- moonshot$language_model("kimi-k2.6") result <- generate_text(model, "Hello", temperature = 1) kimi_code <- create_moonshot(platform = "coding") coding_model <- kimi_code$language_model() result <- generate_text(coding_model, "Review this function", prompt_cache_key = "task-1") }if (interactive()) { moonshot <- create_moonshot() model <- moonshot$language_model("kimi-k2.6") result <- generate_text(model, "Hello", temperature = 1) kimi_code <- create_moonshot(platform = "coding") coding_model <- kimi_code$language_model() result <- generate_text(coding_model, "Review this function", prompt_cache_key = "task-1") }
Factory function to create a NVIDIA provider.
create_nvidia( api_key = NULL, base_url = NULL, headers = NULL, timeout_seconds = NULL, total_timeout_seconds = NULL, first_byte_timeout_seconds = NULL, connect_timeout_seconds = NULL, idle_timeout_seconds = NULL )create_nvidia( api_key = NULL, base_url = NULL, headers = NULL, timeout_seconds = NULL, total_timeout_seconds = NULL, first_byte_timeout_seconds = NULL, connect_timeout_seconds = NULL, idle_timeout_seconds = NULL )
api_key |
NVIDIA API key. Defaults to NVIDIA_API_KEY env var. |
base_url |
Base URL. Defaults to "https://integrate.api.nvidia.com/v1". |
headers |
Optional additional headers. |
timeout_seconds |
Legacy alias for |
total_timeout_seconds |
Optional total request timeout in seconds for API calls. |
first_byte_timeout_seconds |
Optional time-to-first-byte timeout in seconds for API calls. |
connect_timeout_seconds |
Optional connection-establishment timeout in seconds for API calls. |
idle_timeout_seconds |
Optional stall timeout in seconds for API calls. |
A NvidiaProvider object.
if (interactive()) { nvidia <- create_nvidia() model <- nvidia$language_model("z-ai/glm4.7") # Enable thinking/reasoning result <- generate_text(model, "Who are you?", chat_template_kwargs = list(enable_thinking = TRUE) ) print(result$reasoning) }if (interactive()) { nvidia <- create_nvidia() model <- nvidia$language_model("z-ai/glm4.7") # Enable thinking/reasoning result <- generate_text(model, "Who are you?", chat_template_kwargs = list(enable_thinking = TRUE) ) print(result$reasoning) }
Factory function to create an OpenRouter provider.
create_openrouter( api_key = NULL, base_url = NULL, headers = NULL, timeout_seconds = NULL, total_timeout_seconds = NULL, first_byte_timeout_seconds = NULL, connect_timeout_seconds = NULL, idle_timeout_seconds = NULL )create_openrouter( api_key = NULL, base_url = NULL, headers = NULL, timeout_seconds = NULL, total_timeout_seconds = NULL, first_byte_timeout_seconds = NULL, connect_timeout_seconds = NULL, idle_timeout_seconds = NULL )
api_key |
OpenRouter API key. Defaults to OPENROUTER_API_KEY env var. |
base_url |
Base URL for API calls. Defaults to https://openrouter.ai/api/v1. |
headers |
Optional additional headers. |
timeout_seconds |
Legacy alias for |
total_timeout_seconds |
Optional total request timeout in seconds for API calls. |
first_byte_timeout_seconds |
Optional time-to-first-byte timeout in seconds for API calls. |
connect_timeout_seconds |
Optional connection-establishment timeout in seconds for API calls. |
idle_timeout_seconds |
Optional stall timeout in seconds for API calls. |
An OpenRouterProvider object.
openai/gpt-5.5: OpenAI's latest frontier model via OpenRouter. (Reasoning, Vision, Tools, Structured) | ctx: 1000k
openai/gpt-5.4: OpenAI's previous flagship with computer use and 1M context. (Reasoning, Vision, Tools, Structured) | ctx: 1000k
anthropic/claude-opus-4-7: Anthropic's most capable model via OpenRouter. (Reasoning, Vision, Tools, Structured) | ctx: 1000k
anthropic/claude-sonnet-4-6: Balanced Claude model with 1M context and strong coding. (Reasoning, Vision, Tools, Structured) | ctx: 1000k
google/gemini-3.1-pro: Google's most capable multimodal model via OpenRouter. (Reasoning, Vision, Tools, Audio, Structured, Search) | ctx: 1000k
google/gemini-2.5-flash: Fast and cost-efficient Gemini with 1M context. (Reasoning, Vision, Tools, Audio, Structured, Search) | ctx: 1000k
xai/grok-4.1-fast: xAI's fastest model with 2M context at aggressive pricing. (Reasoning, Vision, Tools, Structured, Search) | ctx: 2000k
xai/grok-4: xAI frontier model with always-on reasoning. (Reasoning, Vision, Tools, Structured, Search) | ctx: 256k
deepseek/deepseek-chat: DeepSeek's general-purpose chat model. (Vision, Tools, Structured) | ctx: 64k
deepseek/deepseek-reasoner: DeepSeek's reasoning specialist (R1). (Reasoning, Tools, Structured) | ctx: 64k
meta-llama/llama-4-maverick: Meta's open-weight frontier model with 10M context (Scout). (Reasoning, Vision, Tools, Structured) | ctx: 10000k
qwen/qwen3.6-plus: Alibaba's latest Qwen flagship with 1M context. (Reasoning, Vision, Tools, Structured) | ctx: 1000k
moonshotai/kimi-k2: Moonshot's agentic swarm model with 256K context. (Reasoning, Vision, Tools, Structured) | ctx: 256k
openai/gpt-4.1: OpenAI's production workhorse with 1M context. (Vision, Tools, Structured) | ctx: 1000k
anthropic/claude-haiku-4-5: Fast and cost-effective Claude for simple tasks. (Vision, Tools, Structured) | ctx: 200k
if (interactive()) { openrouter <- create_openrouter() # Access any model via a unified API model <- openrouter$language_model("openai/gpt-4o") result <- generate_text(model, "Hello!") # Reasoning model model <- openrouter$language_model("deepseek/deepseek-r1") result <- generate_text(model, "Solve: 15 * 23") print(result$reasoning) }if (interactive()) { openrouter <- create_openrouter() # Access any model via a unified API model <- openrouter$language_model("openai/gpt-4o") result <- generate_text(model, "Hello!") # Reasoning model model <- openrouter$language_model("deepseek/deepseek-r1") result <- generate_text(model, "Solve: 15 * 23") print(result$reasoning) }
Factory function to create a Stepfun provider.
create_stepfun( api_key = NULL, base_url = NULL, headers = NULL, timeout_seconds = NULL, total_timeout_seconds = NULL, first_byte_timeout_seconds = NULL, connect_timeout_seconds = NULL, idle_timeout_seconds = NULL )create_stepfun( api_key = NULL, base_url = NULL, headers = NULL, timeout_seconds = NULL, total_timeout_seconds = NULL, first_byte_timeout_seconds = NULL, connect_timeout_seconds = NULL, idle_timeout_seconds = NULL )
api_key |
Stepfun API key. Defaults to STEPFUN_API_KEY env var. |
base_url |
Base URL for API calls. Defaults to https://api.stepfun.com/v1. |
headers |
Optional additional headers. |
timeout_seconds |
Legacy alias for |
total_timeout_seconds |
Optional total request timeout in seconds for API calls. |
first_byte_timeout_seconds |
Optional time-to-first-byte timeout in seconds for API calls. |
connect_timeout_seconds |
Optional connection-establishment timeout in seconds for API calls. |
idle_timeout_seconds |
Optional stall timeout in seconds for API calls. |
A StepfunProvider object.
step-1-32k: Model: step-1-32k (Tools) | ctx: 32k
step-1v-32k: Vision enabled model with 32k context (Vision, Tools) | ctx: 32k
step-1-8k: Model: step-1-8k
step-1-256k: Model: step-1-256k
step-1v-8k: Model: step-1v-8k (Vision)
step-2-16k: Model: step-2-16k
step-1x-medium: Model: step-1x-medium
step-tts-mini: Model: step-tts-mini (Audio)
step-2-16k-202411: Model: step-2-16k-202411
step-asr: Model: step-asr (Audio)
step-1o-vision-32k: Model: step-1o-vision-32k (Vision)
step-2-mini: Model: step-2-mini
step-2-16k-exp: Model: step-2-16k-exp
step-1o-turbo-vision: Model: step-1o-turbo-vision (Vision)
step-1o-audio: Model: step-1o-audio (Audio)
... and 16 more models. Use list_models("stepfun") to see all.
if (interactive()) { stepfun <- create_stepfun() model <- stepfun$language_model("step-1-8k") result <- generate_text(model, "Explain quantum computing in one sentence.") }if (interactive()) { stepfun <- create_stepfun() model <- stepfun$language_model("step-1-8k") result <- generate_text(model, "Explain quantum computing in one sentence.") }
Factory function to create a Volcengine provider using the Ark API.
create_volcengine( api_key = NULL, base_url = NULL, headers = NULL, timeout_seconds = NULL, total_timeout_seconds = NULL, first_byte_timeout_seconds = NULL, connect_timeout_seconds = NULL, idle_timeout_seconds = NULL )create_volcengine( api_key = NULL, base_url = NULL, headers = NULL, timeout_seconds = NULL, total_timeout_seconds = NULL, first_byte_timeout_seconds = NULL, connect_timeout_seconds = NULL, idle_timeout_seconds = NULL )
api_key |
Volcengine API key. Defaults to ARK_API_KEY env var. |
base_url |
Base URL for API calls. Defaults to https://ark.cn-beijing.volces.com/api/v3. |
headers |
Optional additional headers. |
timeout_seconds |
Legacy alias for |
total_timeout_seconds |
Optional total request timeout in seconds for API calls. |
first_byte_timeout_seconds |
Optional time-to-first-byte timeout in seconds for API calls. |
connect_timeout_seconds |
Optional connection-establishment timeout in seconds for API calls. |
idle_timeout_seconds |
Optional stall timeout in seconds for API calls. |
A VolcengineProvider object.
doubao-lite-128k-240428: Model: doubao-lite-128k-240428
doubao-pro-128k-240515: Model: doubao-pro-128k-240515
doubao-lite-4k-240328: Model: doubao-lite-4k-240328
doubao-lite-32k-240428: Model: doubao-lite-32k-240428
doubao-pro-4k-240515: Model: doubao-pro-4k-240515
doubao-lite-4k-character-240515: Model: doubao-lite-4k-character-240515
doubao-embedding-text-240515: Model: doubao-embedding-text-240515
mistral-7b-instruct-v0.2: Model: mistral-7b-instruct-v0.2
doubao-pro-4k-character-240515: Model: doubao-pro-4k-character-240515
doubao-pro-4k-functioncall-240515: Model: doubao-pro-4k-functioncall-240515
doubao-lite-4k-pretrain-character-240516: Model: doubao-lite-4k-pretrain-character-240516
doubao-pro-32k-character-240528: Model: doubao-pro-32k-character-240528
doubao-pro-4k-browsing-240524: Model: doubao-pro-4k-browsing-240524
doubao-pro-32k-functioncall-240515: Model: doubao-pro-32k-functioncall-240515
doubao-pro-4k-functioncall-240615: Doubao Pro function-calling model (4K); suited to low-latency function-calling. (Tools, Structured) | ctx: 4k
... and 95 more models. Use list_models("volcengine") to see all.
Volcengine supports both Chat Completions API and Responses API:
language_model(): Uses Chat Completions API (standard)
responses_model(): Uses Responses API (for reasoning models)
smart_model(): Auto-selects based on model ID
Volcengine's Responses API has two mutually exclusive token limit parameters:
max_output_tokens: Total limit including reasoning + answer (default mapping)
max_tokens (API level): Answer-only limit, excluding reasoning
The SDK's unified max_tokens parameter maps to max_output_tokens by default,
which is the safe choice to prevent runaway reasoning costs.
For advanced users who want answer-only limits:
Use max_answer_tokens parameter to explicitly set answer-only limit
Use max_output_tokens parameter to explicitly set total limit
if (interactive()) { volcengine <- create_volcengine() # Chat API (standard models) model <- volcengine$language_model("doubao-1-5-pro-256k-250115") result <- generate_text(model, "Hello") # Responses API (reasoning models like DeepSeek) model <- volcengine$responses_model("deepseek-r1-250120") # Default: max_tokens limits total output (reasoning + answer) result <- model$generate(messages = msgs, max_tokens = 2000) # Advanced: limit only the answer part (reasoning can be longer) result <- model$generate(messages = msgs, max_answer_tokens = 500) # Smart model selection (auto-detects best API) model <- volcengine$smart_model("deepseek-r1-250120") }if (interactive()) { volcengine <- create_volcengine() # Chat API (standard models) model <- volcengine$language_model("doubao-1-5-pro-256k-250115") result <- generate_text(model, "Hello") # Responses API (reasoning models like DeepSeek) model <- volcengine$responses_model("deepseek-r1-250120") # Default: max_tokens limits total output (reasoning + answer) result <- model$generate(messages = msgs, max_tokens = 2000) # Advanced: limit only the answer part (reasoning can be longer) result <- model$generate(messages = msgs, max_answer_tokens = 500) # Smart model selection (auto-detects best API) model <- volcengine$smart_model("deepseek-r1-250120") }
Factory function to create an xAI provider.
create_xai( api_key = NULL, base_url = NULL, headers = NULL, timeout_seconds = NULL, total_timeout_seconds = NULL, first_byte_timeout_seconds = NULL, connect_timeout_seconds = NULL, idle_timeout_seconds = NULL )create_xai( api_key = NULL, base_url = NULL, headers = NULL, timeout_seconds = NULL, total_timeout_seconds = NULL, first_byte_timeout_seconds = NULL, connect_timeout_seconds = NULL, idle_timeout_seconds = NULL )
api_key |
xAI API key. Defaults to XAI_API_KEY env var. |
base_url |
Base URL for API calls. Defaults to https://api.x.ai/v1. |
headers |
Optional additional headers. |
timeout_seconds |
Legacy alias for |
total_timeout_seconds |
Optional total request timeout in seconds for API calls. |
first_byte_timeout_seconds |
Optional time-to-first-byte timeout in seconds for API calls. |
connect_timeout_seconds |
Optional connection-establishment timeout in seconds for API calls. |
idle_timeout_seconds |
Optional stall timeout in seconds for API calls. |
A XAIProvider object.
grok-4: xAI frontier model with always-on reasoning and multi-agent architecture. (Reasoning, Vision, Tools, Structured, Search) | ctx: 256k
grok-4.1-fast: High-throughput production model with 2M context. Best default for most workloads. (Reasoning, Vision, Tools, Structured, Search) | ctx: 2000k
grok-3: Legacy enterprise-grade model optimized for data extraction and summarization. (Reasoning, Vision, Tools, Structured, Search) | ctx: 131k
grok-3-mini: Lightweight low-latency option with reasoning capabilities. (Reasoning, Tools, Structured, Search) | ctx: 131k
grok-2-image: Image generation model via xAI API. (Image-Out) | ctx: 33k
if (interactive()) { xai <- create_xai() model <- xai$language_model("grok-beta") result <- generate_text(model, "Explain quantum computing in one sentence.") }if (interactive()) { xai <- create_xai() model <- xai$language_model("grok-beta") result <- generate_text(model, "Explain quantum computing in one sentence.") }
Provider class for DeepSeek.
aisdk::OpenAIProvider -> DeepSeekProvider
aisdk::OpenAIProvider$create_conversation()aisdk::OpenAIProvider$delete_conversation()aisdk::OpenAIProvider$embedding_model()aisdk::OpenAIProvider$get_conversation()aisdk::OpenAIProvider$image_model()aisdk::OpenAIProvider$model()aisdk::OpenAIProvider$responses_model()aisdk::OpenAIProvider$smart_model()new()
Initialize the DeepSeek provider.
DeepSeekProvider$new( api_key = NULL, base_url = NULL, headers = NULL, timeout_seconds = NULL, total_timeout_seconds = NULL, first_byte_timeout_seconds = NULL, connect_timeout_seconds = NULL, idle_timeout_seconds = NULL )
api_keyDeepSeek API key. Defaults to DEEPSEEK_API_KEY env var.
base_urlBase URL. Defaults to https://api.deepseek.com.
headersOptional additional headers.
timeout_secondsLegacy alias for total_timeout_seconds.
total_timeout_secondsOptional total request timeout in seconds for API calls.
first_byte_timeout_secondsOptional time-to-first-byte timeout in seconds for API calls.
connect_timeout_secondsOptional connection-establishment timeout in seconds for API calls.
idle_timeout_secondsOptional stall timeout in seconds for API calls.
language_model()
Create a language model.
DeepSeekProvider$language_model(model_id = NULL)
model_idThe model ID (e.g., "deepseek-chat", "deepseek-reasoner", or a deepseek-v4* model).
A DeepSeekLanguageModel object.
clone()
The objects of this class are cloneable with this method.
DeepSeekProvider$clone(deep = FALSE)
deepWhether to make a deep clone.
Provider class for Moonshot AI Kimi models.
aisdk::OpenAIProvider -> MoonshotProvider
aisdk::OpenAIProvider$create_conversation()aisdk::OpenAIProvider$delete_conversation()aisdk::OpenAIProvider$embedding_model()aisdk::OpenAIProvider$get_conversation()aisdk::OpenAIProvider$image_model()aisdk::OpenAIProvider$model()aisdk::OpenAIProvider$responses_model()aisdk::OpenAIProvider$smart_model()new()
Initialize the Moonshot provider.
MoonshotProvider$new(
api_key = NULL,
base_url = NULL,
platform = c("auto", "platform", "coding"),
headers = NULL,
prompt_cache_key = NULL,
timeout_seconds = NULL,
total_timeout_seconds = NULL,
first_byte_timeout_seconds = NULL,
connect_timeout_seconds = NULL,
idle_timeout_seconds = NULL
)api_keyAPI key. Defaults to MOONSHOT_API_KEY for the Kimi Open Platform, or KIMI_API_KEY / KIMI_CODE_API_KEY for Kimi Code.
base_urlBase URL.
platformAPI platform: "auto", "platform", or "coding".
headersOptional additional headers.
prompt_cache_keyDefault prompt cache key for Kimi Code requests.
timeout_secondsLegacy alias for total_timeout_seconds.
total_timeout_secondsOptional total request timeout in seconds.
first_byte_timeout_secondsOptional time-to-first-byte timeout.
connect_timeout_secondsOptional connection-establishment timeout.
idle_timeout_secondsOptional stall timeout.
language_model()
Create a language model.
MoonshotProvider$language_model(model_id = NULL)
model_idThe model ID.
A MoonshotLanguageModel object.
clone()
The objects of this class are cloneable with this method.
MoonshotProvider$clone(deep = FALSE)
deepWhether to make a deep clone.
Provider class for NVIDIA.
aisdk::OpenAIProvider -> NvidiaProvider
aisdk::OpenAIProvider$create_conversation()aisdk::OpenAIProvider$delete_conversation()aisdk::OpenAIProvider$embedding_model()aisdk::OpenAIProvider$get_conversation()aisdk::OpenAIProvider$image_model()aisdk::OpenAIProvider$model()aisdk::OpenAIProvider$responses_model()aisdk::OpenAIProvider$smart_model()new()
Initialize the NVIDIA provider.
NvidiaProvider$new( api_key = NULL, base_url = NULL, headers = NULL, timeout_seconds = NULL, total_timeout_seconds = NULL, first_byte_timeout_seconds = NULL, connect_timeout_seconds = NULL, idle_timeout_seconds = NULL )
api_keyNVIDIA API key. Defaults to NVIDIA_API_KEY env var.
base_urlBase URL. Defaults to https://integrate.api.nvidia.com/v1.
headersOptional additional headers.
timeout_secondsLegacy alias for total_timeout_seconds.
total_timeout_secondsOptional total request timeout in seconds for API calls.
first_byte_timeout_secondsOptional time-to-first-byte timeout in seconds for API calls.
connect_timeout_secondsOptional connection-establishment timeout in seconds for API calls.
idle_timeout_secondsOptional stall timeout in seconds for API calls.
language_model()
Create a language model.
NvidiaProvider$language_model(model_id = NULL)
model_idThe model ID (e.g., "z-ai/glm4.7").
A NvidiaLanguageModel object.
clone()
The objects of this class are cloneable with this method.
NvidiaProvider$clone(deep = FALSE)
deepWhether to make a deep clone.
Provider class for OpenRouter.
aisdk::OpenAIProvider -> OpenRouterProvider
new()
Initialize the OpenRouter provider.
OpenRouterProvider$new( api_key = NULL, base_url = NULL, headers = NULL, timeout_seconds = NULL, total_timeout_seconds = NULL, first_byte_timeout_seconds = NULL, connect_timeout_seconds = NULL, idle_timeout_seconds = NULL )
api_keyOpenRouter API key. Defaults to OPENROUTER_API_KEY env var.
base_urlBase URL. Defaults to https://openrouter.ai/api/v1.
headersOptional additional headers.
timeout_secondsLegacy alias for total_timeout_seconds.
total_timeout_secondsOptional total request timeout in seconds for API calls.
first_byte_timeout_secondsOptional time-to-first-byte timeout in seconds for API calls.
connect_timeout_secondsOptional connection-establishment timeout in seconds for API calls.
idle_timeout_secondsOptional stall timeout in seconds for API calls.
language_model()
Create a language model.
OpenRouterProvider$language_model(model_id = NULL)
model_idThe model ID (e.g., "openai/gpt-4o", "anthropic/claude-sonnet-4-20250514", "deepseek/deepseek-r1", "google/gemini-2.5-pro").
An OpenRouterLanguageModel object.
image_model()
Create an image model.
OpenRouterProvider$image_model(model_id = NULL)
model_idThe model ID (e.g., "openai/gpt-image-2").
An OpenAIImageModel object.
clone()
The objects of this class are cloneable with this method.
OpenRouterProvider$clone(deep = FALSE)
deepWhether to make a deep clone.
Provider class for Stepfun.
aisdk::OpenAIProvider -> StepfunProvider
new()
Initialize the Stepfun provider.
StepfunProvider$new( api_key = NULL, base_url = NULL, headers = NULL, timeout_seconds = NULL, total_timeout_seconds = NULL, first_byte_timeout_seconds = NULL, connect_timeout_seconds = NULL, idle_timeout_seconds = NULL )
api_keyStepfun API key. Defaults to STEPFUN_API_KEY env var.
base_urlBase URL. Defaults to https://api.stepfun.com/v1.
headersOptional additional headers.
timeout_secondsLegacy alias for total_timeout_seconds.
total_timeout_secondsOptional total request timeout in seconds for API calls.
first_byte_timeout_secondsOptional time-to-first-byte timeout in seconds for API calls.
connect_timeout_secondsOptional connection-establishment timeout in seconds for API calls.
idle_timeout_secondsOptional stall timeout in seconds for API calls.
language_model()
Create a language model.
StepfunProvider$language_model(model_id = NULL)
model_idThe model ID (e.g., "step-3.5-flash").
A StepfunLanguageModel object.
image_model()
Create an image model.
StepfunProvider$image_model(model_id = NULL)
model_idThe model ID (e.g., "step-1x-medium", "step-1x-edit").
A StepfunImageModel object.
clone()
The objects of this class are cloneable with this method.
StepfunProvider$clone(deep = FALSE)
deepWhether to make a deep clone.
Provider class for the Volcengine Ark platform.
aisdk::OpenAIProvider -> VolcengineProvider
new()
Initialize the Volcengine provider.
VolcengineProvider$new( api_key = NULL, base_url = NULL, headers = NULL, timeout_seconds = NULL, total_timeout_seconds = NULL, first_byte_timeout_seconds = NULL, connect_timeout_seconds = NULL, idle_timeout_seconds = NULL )
api_keyVolcengine API key. Defaults to ARK_API_KEY env var.
base_urlBase URL. Defaults to https://ark.cn-beijing.volces.com/api/v3.
headersOptional additional headers.
timeout_secondsLegacy alias for total_timeout_seconds.
total_timeout_secondsOptional total request timeout in seconds for API calls.
first_byte_timeout_secondsOptional time-to-first-byte timeout in seconds for API calls.
connect_timeout_secondsOptional connection-establishment timeout in seconds for API calls.
idle_timeout_secondsOptional stall timeout in seconds for API calls.
language_model()
Create a language model.
VolcengineProvider$language_model(model_id = NULL)
model_idThe model ID (e.g., "doubao-1-5-pro-256k-250115" or "gpt-4o").
A VolcengineLanguageModel object.
image_model()
Create an image model.
VolcengineProvider$image_model(
model_id = Sys.getenv("ARK_IMAGE_MODEL", "doubao-seedream-5-0")
)model_idThe model ID (e.g., "doubao-seedream-5-0").
A VolcengineImageModel object.
clone()
The objects of this class are cloneable with this method.
VolcengineProvider$clone(deep = FALSE)
deepWhether to make a deep clone.
Provider class for xAI.
aisdk::OpenAIProvider -> XAIProvider
new()
Initialize the xAI provider.
XAIProvider$new( api_key = NULL, base_url = NULL, headers = NULL, timeout_seconds = NULL, total_timeout_seconds = NULL, first_byte_timeout_seconds = NULL, connect_timeout_seconds = NULL, idle_timeout_seconds = NULL )
api_keyxAI API key. Defaults to XAI_API_KEY env var.
base_urlBase URL. Defaults to https://api.x.ai/v1.
headersOptional additional headers.
timeout_secondsLegacy alias for total_timeout_seconds.
total_timeout_secondsOptional total request timeout in seconds for API calls.
first_byte_timeout_secondsOptional time-to-first-byte timeout in seconds for API calls.
connect_timeout_secondsOptional connection-establishment timeout in seconds for API calls.
idle_timeout_secondsOptional stall timeout in seconds for API calls.
language_model()
Create a language model.
XAIProvider$language_model(model_id = NULL)
model_idThe model ID (e.g., "grok-beta", "grok-2-1212").
A XAILanguageModel object.
image_model()
Create an image model.
XAIProvider$image_model(model_id = NULL)
model_idThe model ID (e.g., "grok-2-image").
A XAIImageModel object.
clone()
The objects of this class are cloneable with this method.
XAIProvider$clone(deep = FALSE)
deepWhether to make a deep clone.