Creates a dynamic wrapper around existing model classes (OpenAI, Anthropic)
based on user-provided configuration. The returned provider can be registered
in the global ProviderRegistry.
create_custom_provider(
provider_name,
base_url,
api_key = NULL,
api_format = c("chat_completions", "responses", "anthropic_messages"),
use_max_completion_tokens = FALSE
)A custom provider object with a language_model(model_id) method.
The identifier name for this custom provider (e.g. "my_custom_openai_proxy").
The base URL for the API endpoint.
The API key for authentication. If NULL, defaults to checking environmental variables.
The underlying API format to use. Supports "chat_completions" (OpenAI default), "responses" (OpenAI Responses API), and "anthropic_messages" (Anthropic Messages API).
A boolean flag. If TRUE, injects the is_reasoning_model capability
to ensure the model uses max_completion_tokens instead of max_tokens.