The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Package {aisdk.providers}


Title: Additional Model Provider Adapters for the 'aisdk' Toolkit
Version: 0.1.0
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.
License: MIT + file LICENSE
Encoding: UTF-8
RoxygenNote: 7.3.3
Imports: aisdk (≥ 1.4.12), R6, rlang, base64enc, jsonlite, curl, utils
Suggests: withr, testthat (≥ 3.0.0)
Config/testthat/edition: 3
URL: https://github.com/YuLab-SMU/aisdk.providers
BugReports: https://github.com/YuLab-SMU/aisdk.providers/issues
Depends: R (≥ 4.1.0)
NeedsCompilation: no
Packaged: 2026-06-02 10:47:44 UTC; xiayh
Author: Yonghe Xia [aut, cre]
Maintainer: Yonghe Xia <xiayh17@gmail.com>
Repository: CRAN
Date/Publication: 2026-06-08 17:50:20 UTC

aisdk.providers: 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.

Author(s)

Maintainer: Yonghe Xia xiayh17@gmail.com

See Also

Useful links:


AiHubMix Language Model Class

Description

Language model implementation for AiHubMix's chat completions API. Inherits from OpenAILanguageModel as AiHubMix provides an OpenAI-compatible API.

Super classes

aisdk::LanguageModelV1 -> aisdk::OpenAILanguageModel -> AiHubMixLanguageModel

Methods

Public methods

Inherited methods

Method parse_response()

Parse the API response into a GenerateResult. Overrides parent to extract AiHubMix-specific reasoning fields.

Usage
AiHubMixLanguageModel$parse_response(response)
Arguments
response

The parsed API response.

Returns

A GenerateResult object.


Method build_payload()

Build the request payload for non-streaming generation. Overrides parent to process caching and reasoning parameters.

Usage
AiHubMixLanguageModel$build_payload(params)
Arguments
params

A list of call options.

Returns

A list with url, headers, and body.


Method build_stream_payload()

Build the request payload for streaming generation. Overrides parent to process caching and reasoning parameters.

Usage
AiHubMixLanguageModel$build_stream_payload(params)
Arguments
params

A list of call options.

Returns

A list with url, headers, and body.


Method clone()

The objects of this class are cloneable with this method.

Usage
AiHubMixLanguageModel$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


AiHubMix Provider Class

Description

Provider class for AiHubMix.

Super class

aisdk::OpenAIProvider -> AiHubMixProvider

Methods

Public methods

Inherited methods

Method new()

Initialize the AiHubMix provider.

Usage
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
)
Arguments
api_key

AiHubMix API key. Defaults to AIHUBMIX_API_KEY env var.

base_url

Base URL. Defaults to https://aihubmix.com/v1.

headers

Optional additional headers.

timeout_seconds

Legacy alias for total_timeout_seconds.

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.


Method language_model()

Create a language model.

Usage
AiHubMixProvider$language_model(model_id = NULL)
Arguments
model_id

The model ID (e.g., "claude-sonnet-3-5", "claude-opus-3", "gpt-4o").

Returns

An AiHubMixLanguageModel object.


Method image_model()

Create an image model.

Usage
AiHubMixProvider$image_model(model_id = NULL)
Arguments
model_id

The model ID (e.g., "gpt-image-2").

Returns

An OpenAIImageModel object.


Method clone()

The objects of this class are cloneable with this method.

Usage
AiHubMixProvider$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


Bailian Language Model Class

Description

Language model implementation for Alibaba Cloud DashScope's chat completions API. Inherits from OpenAI model but adds support for DashScope-specific features like reasoning content extraction from Qwen reasoning models.

Super classes

aisdk::LanguageModelV1 -> aisdk::OpenAILanguageModel -> BailianLanguageModel

Methods

Public methods

Inherited methods

Method parse_response()

Parse the API response into a GenerateResult. Overrides parent to extract DashScope-specific reasoning_content.

Usage
BailianLanguageModel$parse_response(response)
Arguments
response

The parsed API response.

Returns

A GenerateResult object.


Method clone()

The objects of this class are cloneable with this method.

Usage
BailianLanguageModel$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


Bailian Provider Class

Description

Provider class for Alibaba Cloud Bailian / DashScope platform.

Super class

aisdk::OpenAIProvider -> BailianProvider

Methods

Public methods

Inherited methods

Method new()

Initialize the Bailian provider.

Usage
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
)
Arguments
api_key

DashScope API key. Defaults to DASHSCOPE_API_KEY env var.

base_url

Base URL. Defaults to https://dashscope.aliyuncs.com/compatible-mode/v1.

headers

Optional additional headers.

timeout_seconds

Legacy alias for total_timeout_seconds.

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.


Method language_model()

Create a language model.

Usage
BailianProvider$language_model(model_id = NULL)
Arguments
model_id

The model ID (e.g., "qwen-plus", "qwen-turbo", "qwq-32b").

Returns

A BailianLanguageModel object.


Method clone()

The objects of this class are cloneable with this method.

Usage
BailianProvider$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


DeepSeek Language Model Class

Description

Language model implementation for DeepSeek's chat completions API. Inherits from OpenAI model but adds support for DeepSeek-specific features like reasoning content extraction and DeepSeek thinking-mode parameters.

Super classes

aisdk::LanguageModelV1 -> aisdk::OpenAILanguageModel -> DeepSeekLanguageModel

Methods

Public methods

Inherited methods

Method new()

Initialize the DeepSeek language model.

Usage
DeepSeekLanguageModel$new(model_id, config)
Arguments
model_id

The model ID.

config

Provider configuration.


Method parse_response()

Parse the API response into a GenerateResult. Overrides parent to extract DeepSeek-specific reasoning_content.

Usage
DeepSeekLanguageModel$parse_response(response)
Arguments
response

The parsed API response.

Returns

A GenerateResult object.


Method build_payload()

Build request payload with DeepSeek-specific reasoning params.

Usage
DeepSeekLanguageModel$build_payload(params)
Arguments
params

A list of call options.

Returns

A list with url, headers, and body.


Method build_stream_payload()

Build stream payload with DeepSeek-specific reasoning params.

Usage
DeepSeekLanguageModel$build_stream_payload(params)
Arguments
params

A list of call options.

Returns

A list with url, headers, and body.


Method clone()

The objects of this class are cloneable with this method.

Usage
DeepSeekLanguageModel$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


DeepSeek Provider Class

Description

Provider class for DeepSeek.

Super class

aisdk::OpenAIProvider -> DeepSeekProvider

Methods

Public methods

Inherited methods

Method new()

Initialize the DeepSeek provider.

Usage
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
)
Arguments
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.

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.


Method language_model()

Create a language model.

Usage
DeepSeekProvider$language_model(model_id = NULL)
Arguments
model_id

The model ID (e.g., "deepseek-chat", "deepseek-reasoner", or a ⁠deepseek-v4*⁠ model).

Returns

A DeepSeekLanguageModel object.


Method clone()

The objects of this class are cloneable with this method.

Usage
DeepSeekProvider$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


Kimi Code Anthropic Provider Class

Description

Anthropic-compatible provider wrapper for Kimi Code.

Super class

aisdk::AnthropicProvider -> KimiCodeAnthropicProvider

Methods

Public methods

Inherited methods

Method language_model()

Create a Kimi Code Anthropic-compatible language model.

Usage
KimiCodeAnthropicProvider$language_model(model_id = NULL)
Arguments
model_id

The model ID. Defaults to ⁠kimi-for-coding⁠.

Returns

An AnthropicLanguageModel object.


Method clone()

The objects of this class are cloneable with this method.

Usage
KimiCodeAnthropicProvider$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


Moonshot Language Model Class

Description

Language model implementation for Moonshot / Kimi Chat Completions APIs.

Super classes

aisdk::LanguageModelV1 -> aisdk::OpenAILanguageModel -> MoonshotLanguageModel

Methods

Public methods

Inherited methods

Method new()

Initialize the Moonshot language model.

Usage
MoonshotLanguageModel$new(model_id, config)
Arguments
model_id

The model ID.

config

Provider configuration.


Method build_payload()

Build the request payload for non-streaming generation.

Usage
MoonshotLanguageModel$build_payload(params)
Arguments
params

A list of call options.

Returns

A list with url, headers, and body.


Method build_stream_payload()

Build the request payload for streaming generation.

Usage
MoonshotLanguageModel$build_stream_payload(params)
Arguments
params

A list of call options.

Returns

A list with url, headers, and body.


Method parse_response()

Parse the API response into a GenerateResult.

Usage
MoonshotLanguageModel$parse_response(response)
Arguments
response

The parsed API response.

Returns

A GenerateResult object.


Method clone()

The objects of this class are cloneable with this method.

Usage
MoonshotLanguageModel$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


Moonshot / Kimi Provider Class

Description

Provider class for Moonshot AI Kimi models.

Super class

aisdk::OpenAIProvider -> MoonshotProvider

Methods

Public methods

Inherited methods

Method new()

Initialize the Moonshot provider.

Usage
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
)
Arguments
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.

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.

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.


Method language_model()

Create a language model.

Usage
MoonshotProvider$language_model(model_id = NULL)
Arguments
model_id

The model ID.

Returns

A MoonshotLanguageModel object.


Method clone()

The objects of this class are cloneable with this method.

Usage
MoonshotProvider$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


NVIDIA Language Model Class

Description

Language model implementation for NVIDIA's chat completions API. Inherits from OpenAI model but adds support for NVIDIA-specific features like "enable_thinking" and reasoning content extraction.

Super classes

aisdk::LanguageModelV1 -> aisdk::OpenAILanguageModel -> NvidiaLanguageModel

Methods

Public methods

Inherited methods

Method parse_response()

Parse the API response into a GenerateResult. Overrides parent to extract NVIDIA-specific reasoning_content.

Usage
NvidiaLanguageModel$parse_response(response)
Arguments
response

The parsed API response.

Returns

A GenerateResult object.


Method clone()

The objects of this class are cloneable with this method.

Usage
NvidiaLanguageModel$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


NVIDIA Provider Class

Description

Provider class for NVIDIA.

Super class

aisdk::OpenAIProvider -> NvidiaProvider

Methods

Public methods

Inherited methods

Method new()

Initialize the NVIDIA provider.

Usage
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
)
Arguments
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.

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.


Method language_model()

Create a language model.

Usage
NvidiaProvider$language_model(model_id = NULL)
Arguments
model_id

The model ID (e.g., "z-ai/glm4.7").

Returns

A NvidiaLanguageModel object.


Method clone()

The objects of this class are cloneable with this method.

Usage
NvidiaProvider$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


OpenRouter Language Model Class

Description

Language model implementation for OpenRouter's chat completions API. Inherits from OpenAI model but adds support for OpenRouter-specific features like reasoning content extraction from reasoning models.

Super classes

aisdk::LanguageModelV1 -> aisdk::OpenAILanguageModel -> OpenRouterLanguageModel

Methods

Public methods

Inherited methods

Method parse_response()

Parse the API response into a GenerateResult. Overrides parent to extract reasoning_content from reasoning models.

Usage
OpenRouterLanguageModel$parse_response(response)
Arguments
response

The parsed API response.

Returns

A GenerateResult object.


Method clone()

The objects of this class are cloneable with this method.

Usage
OpenRouterLanguageModel$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


OpenRouter Provider Class

Description

Provider class for OpenRouter.

Super class

aisdk::OpenAIProvider -> OpenRouterProvider

Methods

Public methods

Inherited methods

Method new()

Initialize the OpenRouter provider.

Usage
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
)
Arguments
api_key

OpenRouter API key. Defaults to OPENROUTER_API_KEY env var.

base_url

Base URL. Defaults to https://openrouter.ai/api/v1.

headers

Optional additional headers.

timeout_seconds

Legacy alias for total_timeout_seconds.

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.


Method language_model()

Create a language model.

Usage
OpenRouterProvider$language_model(model_id = NULL)
Arguments
model_id

The model ID (e.g., "openai/gpt-4o", "anthropic/claude-sonnet-4-20250514", "deepseek/deepseek-r1", "google/gemini-2.5-pro").

Returns

An OpenRouterLanguageModel object.


Method image_model()

Create an image model.

Usage
OpenRouterProvider$image_model(model_id = NULL)
Arguments
model_id

The model ID (e.g., "openai/gpt-image-2").

Returns

An OpenAIImageModel object.


Method clone()

The objects of this class are cloneable with this method.

Usage
OpenRouterProvider$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


Stepfun Image Model Class

Description

Image model implementation for Stepfun image generation and editing APIs.

Super class

aisdk::ImageModelV1 -> StepfunImageModel

Methods

Public methods

Inherited methods

Method new()

Initialize the Stepfun image model.

Usage
StepfunImageModel$new(model_id, config)
Arguments
model_id

The model ID.

config

Configuration list.


Method do_generate_image()

Generate images.

Usage
StepfunImageModel$do_generate_image(params)
Arguments
params

A list of call options.

Returns

A GenerateImageResult object.


Method do_edit_image()

Edit images.

Usage
StepfunImageModel$do_edit_image(params)
Arguments
params

A list of call options.

Returns

A GenerateImageResult object.


Method clone()

The objects of this class are cloneable with this method.

Usage
StepfunImageModel$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


Stepfun Language Model Class

Description

Language model implementation for Stepfun's chat completions API. Inherits from OpenAILanguageModel as Stepfun provides an OpenAI-compatible API.

Super classes

aisdk::LanguageModelV1 -> aisdk::OpenAILanguageModel -> StepfunLanguageModel

Methods

Public methods

Inherited methods

Method build_payload()

Build the payload for the Stepfun API.

Usage
StepfunLanguageModel$build_payload(params)
Arguments
params

A list of parameters for the API call.


Method build_stream_payload()

Build the stream payload for the Stepfun API.

Usage
StepfunLanguageModel$build_stream_payload(params)
Arguments
params

A list of parameters for the API call.


Method clone()

The objects of this class are cloneable with this method.

Usage
StepfunLanguageModel$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


Stepfun Provider Class

Description

Provider class for Stepfun.

Super class

aisdk::OpenAIProvider -> StepfunProvider

Methods

Public methods

Inherited methods

Method new()

Initialize the Stepfun provider.

Usage
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
)
Arguments
api_key

Stepfun API key. Defaults to STEPFUN_API_KEY env var.

base_url

Base URL. Defaults to https://api.stepfun.com/v1.

headers

Optional additional headers.

timeout_seconds

Legacy alias for total_timeout_seconds.

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.


Method language_model()

Create a language model.

Usage
StepfunProvider$language_model(model_id = NULL)
Arguments
model_id

The model ID (e.g., "step-3.5-flash").

Returns

A StepfunLanguageModel object.


Method image_model()

Create an image model.

Usage
StepfunProvider$image_model(model_id = NULL)
Arguments
model_id

The model ID (e.g., "step-1x-medium", "step-1x-edit").

Returns

A StepfunImageModel object.


Method clone()

The objects of this class are cloneable with this method.

Usage
StepfunProvider$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


Volcengine Image Model Class

Description

Image model implementation for Volcengine Ark image generation models such as Doubao Seedream. Volcengine exposes these models through an OpenAI-compatible image generation endpoint.

Super class

aisdk::ImageModelV1 -> VolcengineImageModel

Methods

Public methods

Inherited methods

Method new()

Initialize the Volcengine image model.

Usage
VolcengineImageModel$new(model_id, config)
Arguments
model_id

The model ID (e.g., "doubao-seedream-5-0").

config

Configuration list.


Method do_generate_image()

Generate images.

Usage
VolcengineImageModel$do_generate_image(params)
Arguments
params

A list of call options.

Returns

A GenerateImageResult object.


Method do_edit_image()

Edit images by providing one or more reference images.

Usage
VolcengineImageModel$do_edit_image(params)
Arguments
params

A list of call options.

Returns

A GenerateImageResult object.


Method clone()

The objects of this class are cloneable with this method.

Usage
VolcengineImageModel$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


Volcengine Language Model Class

Description

Language model implementation for Volcengine's chat completions API. Inherits from OpenAI model but adds support for Volcengine-specific features like reasoning content extraction from models that support reasoning_content.

Super classes

aisdk::LanguageModelV1 -> aisdk::OpenAILanguageModel -> VolcengineLanguageModel

Methods

Public methods

Inherited methods

Method parse_response()

Parse the API response into a GenerateResult. Overrides parent to extract Volcengine-specific reasoning_content.

Usage
VolcengineLanguageModel$parse_response(response)
Arguments
response

The parsed API response.

Returns

A GenerateResult object.


Method clone()

The objects of this class are cloneable with this method.

Usage
VolcengineLanguageModel$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


Volcengine Provider Class

Description

Provider class for the Volcengine Ark platform.

Super class

aisdk::OpenAIProvider -> VolcengineProvider

Methods

Public methods

Inherited methods

Method new()

Initialize the Volcengine provider.

Usage
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
)
Arguments
api_key

Volcengine API key. Defaults to ARK_API_KEY env var.

base_url

Base URL. Defaults to https://ark.cn-beijing.volces.com/api/v3.

headers

Optional additional headers.

timeout_seconds

Legacy alias for total_timeout_seconds.

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.


Method language_model()

Create a language model.

Usage
VolcengineProvider$language_model(model_id = NULL)
Arguments
model_id

The model ID (e.g., "doubao-1-5-pro-256k-250115" or "gpt-4o").

Returns

A VolcengineLanguageModel object.


Method image_model()

Create an image model.

Usage
VolcengineProvider$image_model(
  model_id = Sys.getenv("ARK_IMAGE_MODEL", "doubao-seedream-5-0")
)
Arguments
model_id

The model ID (e.g., "doubao-seedream-5-0").

Returns

A VolcengineImageModel object.


Method clone()

The objects of this class are cloneable with this method.

Usage
VolcengineProvider$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


xAI Image Model Class

Description

Image model implementation for xAI image generation and editing APIs.

Super class

aisdk::ImageModelV1 -> XAIImageModel

Methods

Public methods

Inherited methods

Method new()

Initialize the xAI image model.

Usage
XAIImageModel$new(model_id, config)
Arguments
model_id

The model ID.

config

Configuration list.


Method do_generate_image()

Generate images.

Usage
XAIImageModel$do_generate_image(params)
Arguments
params

A list of call options.

Returns

A GenerateImageResult object.


Method do_edit_image()

Edit images.

Usage
XAIImageModel$do_edit_image(params)
Arguments
params

A list of call options.

Returns

A GenerateImageResult object.


Method clone()

The objects of this class are cloneable with this method.

Usage
XAIImageModel$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


xAI Language Model Class

Description

Language model implementation for xAI's chat completions API. Inherits from OpenAILanguageModel as xAI provides An OpenAI-compatible API.

Super classes

aisdk::LanguageModelV1 -> aisdk::OpenAILanguageModel -> XAILanguageModel

Methods

Public methods

Inherited methods

Method parse_response()

Parse the API response into a GenerateResult. Overrides parent to extract xAI-specific reasoning_content.

Usage
XAILanguageModel$parse_response(response)
Arguments
response

The parsed API response.

Returns

A GenerateResult object.


Method clone()

The objects of this class are cloneable with this method.

Usage
XAILanguageModel$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


xAI Provider Class

Description

Provider class for xAI.

Super class

aisdk::OpenAIProvider -> XAIProvider

Methods

Public methods

Inherited methods

Method new()

Initialize the xAI provider.

Usage
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
)
Arguments
api_key

xAI API key. Defaults to XAI_API_KEY env var.

base_url

Base URL. Defaults to https://api.x.ai/v1.

headers

Optional additional headers.

timeout_seconds

Legacy alias for total_timeout_seconds.

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.


Method language_model()

Create a language model.

Usage
XAIProvider$language_model(model_id = NULL)
Arguments
model_id

The model ID (e.g., "grok-beta", "grok-2-1212").

Returns

A XAILanguageModel object.


Method image_model()

Create an image model.

Usage
XAIProvider$image_model(model_id = NULL)
Arguments
model_id

The model ID (e.g., "grok-2-image").

Returns

A XAIImageModel object.


Method clone()

The objects of this class are cloneable with this method.

Usage
XAIProvider$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


Create AiHubMix Provider

Description

Factory function to create an AiHubMix provider.

AiHubMix provides a unified API for various models including Claude, OpenAI, Gemini, etc.

Usage

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
)

Arguments

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.

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.

Value

An AiHubMixProvider object.

Examples


if (interactive()) {
    aihubmix <- create_aihubmix()
    model <- aihubmix$language_model("claude-sonnet-3-5")
    result <- generate_text(model, "Explain quantum computing in one sentence.")
}


Create AiHubMix Provider (Anthropic API Format)

Description

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.

Usage

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
)

Arguments

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.

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.

Details

AiHubMix provides an Anthropic-compatible endpoint at ⁠https://aihubmix.com/v1⁠. This convenience function wraps create_anthropic() with AiHubMix-specific defaults.

Value

An AnthropicProvider object configured for AiHubMix.

Examples


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!")
}


Create AiHubMix Provider (Gemini API Format)

Description

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.

Usage

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
)

Arguments

api_key

AiHubMix API key. Defaults to AIHUBMIX_API_KEY env var.

headers

Optional additional headers.

timeout_seconds

Legacy alias for total_timeout_seconds.

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.

Details

AiHubMix provides a Gemini-compatible endpoint at ⁠https://aihubmix.com/gemini/v1beta/models⁠. This convenience function wraps create_gemini() with AiHubMix-specific defaults.

Value

A GeminiProvider object configured for AiHubMix.

Examples


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!")
}


Create Alibaba Cloud Bailian Provider

Description

Factory function to create an Alibaba Cloud Bailian provider using the DashScope API.

Usage

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
)

Arguments

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.

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.

Value

A BailianProvider object.

Supported Models

Examples


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()
}


Create DeepSeek Provider

Description

Factory function to create a DeepSeek provider.

Usage

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
)

Arguments

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.

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.

Details

DeepSeek supports classic aliases plus newer model families such as DeepSeek V4.

Common model IDs include:

Additional DeepSeek-specific request fields such as thinking, thinking_budget, and reasoning_effort are passed through when supplied to ⁠$generate()⁠ or ⁠$stream()⁠.

Value

A DeepSeekProvider object.

Supported Models

Examples


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")
}


Create DeepSeek Provider (Anthropic API Format)

Description

Factory function to create a DeepSeek provider using the Anthropic-compatible API. This allows you to use DeepSeek models with the Anthropic API format.

Usage

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
)

Arguments

api_key

DeepSeek API key. Defaults to DEEPSEEK_API_KEY env var.

headers

Optional additional headers.

timeout_seconds

Legacy alias for total_timeout_seconds.

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.

Details

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.

Value

An AnthropicProvider object configured for DeepSeek.

Examples


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
}


Create Kimi Code Provider

Description

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.

Usage

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
)

Arguments

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.

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.

Value

A provider object configured for Kimi Code.


Create Kimi Code Provider (Anthropic API Format)

Description

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⁠.

Usage

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
)

Arguments

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.

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.

Value

An AnthropicProvider object configured for Kimi Code.


Create Moonshot / Kimi Provider

Description

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.

Usage

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
)

Arguments

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.

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.

Value

A MoonshotProvider object.

Supported Models

Examples


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")
}


Create NVIDIA Provider

Description

Factory function to create a NVIDIA provider.

Usage

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
)

Arguments

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.

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.

Value

A NvidiaProvider object.

Examples


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)
}


Create OpenRouter Provider

Description

Factory function to create an OpenRouter provider.

Usage

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
)

Arguments

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.

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.

Value

An OpenRouterProvider object.

Supported Models

Examples


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)
}


Create Stepfun Provider

Description

Factory function to create a Stepfun provider.

Usage

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
)

Arguments

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.

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.

Value

A StepfunProvider object.

Supported Models

Examples


if (interactive()) {
    stepfun <- create_stepfun()
    model <- stepfun$language_model("step-1-8k")
    result <- generate_text(model, "Explain quantum computing in one sentence.")
}


Create Volcengine/Ark Provider

Description

Factory function to create a Volcengine provider using the Ark API.

Usage

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
)

Arguments

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.

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.

Value

A VolcengineProvider object.

Supported Models

API Formats

Volcengine supports both Chat Completions API and Responses API:

Token Limit Parameters for Volcengine Responses API

Volcengine's Responses API has two mutually exclusive token limit parameters:

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:

Examples


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")
}


Create xAI Provider

Description

Factory function to create an xAI provider.

Usage

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
)

Arguments

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.

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.

Value

A XAIProvider object.

Supported Models

Examples


if (interactive()) {
    xai <- create_xai()
    model <- xai$language_model("grok-beta")
    result <- generate_text(model, "Explain quantum computing in one sentence.")
}


AiHubMix Provider

Description

Implementation for AiHubMix models. AiHubMix API is OpenAI-compatible, but provides extended support for features like Claude's extended thinking and prompt caching.


Alibaba Cloud Bailian Provider

Description

Implementation for Alibaba Cloud Bailian (DashScope) hosted models. DashScope API is OpenAI-compatible with support for Qwen series models including reasoning models (QwQ, Qwen3 etc.).


DeepSeek Provider

Description

Implementation for DeepSeek models. DeepSeek API is OpenAI-compatible with support for reasoning models.


Moonshot / Kimi Provider

Description

Implementation for Moonshot AI Kimi models. The public Kimi Open Platform uses ⁠https://api.moonshot.cn/v1⁠; Kimi Code membership API uses ⁠https://api.kimi.com/coding/v1⁠. These are separate account systems and their API keys are not interchangeable.


NVIDIA Provider

Description

Implementation for NVIDIA NIM and other NVIDIA-hosted models.


OpenRouter Provider

Description

Implementation for OpenRouter, a unified API gateway for multiple LLM providers. OpenRouter API is OpenAI-compatible and provides access to models from OpenAI, Anthropic, Google, Meta, Mistral, DeepSeek, and many more.


Stepfun Provider

Description

Implementation for Stepfun models. Stepfun API is OpenAI-compatible.


Volcengine Provider

Description

Implementation for Volcengine Ark hosted models. Volcengine API is OpenAI-compatible with support for reasoning models (e.g., Doubao, DeepSeek).


xAI Provider

Description

Implementation for xAI (Grok) models. xAI API is OpenAI-compatible.

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.