Dynamiq
LLMs

LLM Providers

One unified LLM node across 27 providers — provider table, connection env vars, common parameters, vision and PDF support, and fallbacks.

Every LLM in Dynamiq is a node class in dynamiq.nodes.llms, and all of them subclass the same BaseLLM. Swapping OpenAI for Anthropic, Gemini, or a self-hosted Ollama model means changing the class, the model name, and the connection — the prompt, parameters, streaming, tools, and output shape stay identical.

Quick example

Each provider node pairs with a connection class of the same name in dynamiq.connections. Connections read their credentials from environment variables by default, so the minimal setup is one import and one env var:

# export OPENAI_API_KEY=...
from dynamiq.connections import OpenAI as OpenAIConnection
from dynamiq.nodes.llms import OpenAI
from dynamiq.prompts import Message, Prompt

llm = OpenAI(
    connection=OpenAIConnection(),
    model="gpt-4o-mini",
    prompt=Prompt(messages=[Message(role="user", content="{{question}}")]),
)

result = llm.run(input_data={"question": "What is an embedding?"})
print(result.output["content"])
# export ANTHROPIC_API_KEY=...
from dynamiq.connections import Anthropic as AnthropicConnection
from dynamiq.nodes.llms import Anthropic
from dynamiq.prompts import Message, Prompt

llm = Anthropic(
    connection=AnthropicConnection(),
    model="claude-3-5-sonnet-20240620",
    prompt=Prompt(messages=[Message(role="user", content="{{question}}")]),
)

result = llm.run(input_data={"question": "What is an embedding?"})
print(result.output["content"])
# No API key needed — Ollama runs locally.
from dynamiq.connections import Ollama as OllamaConnection
from dynamiq.nodes.llms import Ollama
from dynamiq.prompts import Message, Prompt

llm = Ollama(
    connection=OllamaConnection(url="http://localhost:11434"),
    model="llama3",
    prompt=Prompt(messages=[Message(role="user", content="{{question}}")]),
)

result = llm.run(input_data={"question": "What is an embedding?"})
print(result.output["content"])

The output dictionary always contains content (the generated text) and, when the model calls tools, a tool_calls list with parsed JSON arguments.

Several provider nodes (such as OpenAI and Anthropic) construct their connection automatically from environment variables when you omit the connection argument. Passing the connection explicitly works everywhere and keeps credentials visible in code review.

Provider table

All classes are imported from dynamiq.nodes.llms; the matching connection classes live in dynamiq.connections. Dynamiq dispatches requests through litellm and prepends the model prefix automatically — OpenAI(model="gpt-4o") and OpenAI(model="openai/gpt-4o") are equivalent.

NodeModel prefixConnection env vars
AI21ai21/AI21_API_KEY
Anthropicanthropic/ANTHROPIC_API_KEY
Anyscaleanyscale/ANYSCALE_API_KEY
AzureAIazure/AZURE_API_KEY, AZURE_URL, AZURE_API_VERSION
Bedrockbedrock/AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_DEFAULT_REGION (or AWS_DEFAULT_PROFILE)
Cerebrascerebras/CEREBRAS_API_KEY
CohereCOHERE_API_KEY
CustomLLMconfigurableexplicit HttpApiKey(url=..., api_key=...)
Databricksdatabricks/DATABRICKS_API_BASE, DATABRICKS_API_KEY
DeepInfradeepinfra/DEEPINFRA_API_KEY
DeepSeekdeepseek/DEEPSEEK_API_KEY
FireworksAIfireworks_ai/FIREWORKS_AI_API_KEY
Geminigemini/GEMINI_API_KEY
Groqgroq/GROQ_API_KEY
HuggingFacehuggingface/HUGGINGFACE_API_KEY
Mistralmistral/MISTRAL_API_KEY
NvidiaNIMnvidia_nim/NVIDIA_NIM_URL, NVIDIA_NIM_API_KEY
Ollamaollama/none — url defaults to http://localhost:11434
OpenAIopenai/OPENAI_API_KEY (optional OPENAI_URL)
OpenRouteropenrouter/OPENROUTER_API_KEY (optional OPENROUTER_API_BASE)
Perplexityperplexity/PERPLEXITYAI_API_KEY
Replicatereplicate/REPLICATE_API_KEY
SambaNovasambanova/SAMBANOVA_API_KEY
TogetherAItogether_ai/TOGETHER_API_KEY
VertexAIvertex_ai/VERTEXAI_PROJECT_ID, VERTEXAI_PROJECT_LOCATION, plus GOOGLE_CLOUD_* service-account fields
WatsonXwatsonx/WATSONX_API_KEY, WATSONX_PROJECT_ID, WATSONX_URL
xAIxai/XAI_API_KEY

CustomLLM targets any OpenAI-compatible endpoint: give it an HttpApiKey connection with the base url and api_key, and set provider_prefix (for example "openai") so the request is routed with the right protocol. This is also how you point a Dynamiq LLM node at the platform's AI Gateway.

Common parameters

Because every node inherits BaseLLM, these parameters work across all providers:

modelstringrequired
Model name. The provider prefix is added automatically if missing.
connectionBaseConnection
Provider connection. Several providers build one from env vars when omitted.
promptPrompt
Default prompt for the node. Can also be passed per-call to run()/execute().
temperaturefloat
Sampling temperature.
max_tokensint
Maximum completion tokens.
stoplist[str]
Stop sequences.
top_pfloat
Nucleus sampling probability mass.
seedint
Seed for reproducible sampling where the provider supports it.
presence_penalty / frequency_penaltyfloat
Repetition penalties.
toolslist[Tool | dict]
Function-calling tool definitions the model may invoke.
tool_choicestring
Controls which function the model calls.
response_formatdict
JSON schema for structured output.
strict_toolsbool | list[str]
Enable provider strict tool-calling (OpenAI, Anthropic) for all tools or a named subset.
thinking_enabledbool
Enables extended reasoning where supported.
budget_tokensint
Token budget for thinking. Defaults to 1024.
fallbackFallbackConfig
Secondary LLM to run when this one fails — see below.
model_infoModelInfo
Override model metadata: max_input_tokens, supports_vision, supports_pdf_input.
error_handlingErrorHandling
Timeout and retry policy. Defaults to a 600-second timeout.

Unknown extra keyword arguments are passed through to the underlying completion call, so provider-specific parameters (for example OpenAI's reasoning_effort, which the OpenAI node also exposes directly) remain available.

Vision and file input

A node reports its multimodal capabilities through two properties:

from dynamiq.connections import OpenAI as OpenAIConnection
from dynamiq.nodes.llms import OpenAI

llm = OpenAI(connection=OpenAIConnection(), model="gpt-4o-mini")
print(llm.is_vision_supported)     # True
print(llm.is_pdf_input_supported)  # model-dependent

Capability and token-limit lookups come from litellm's model database, with a bundled registry (dynamiq/nodes/llms/model_registry.json) as a fallback for models litellm does not know. For self-hosted or brand-new models missing from both, override the metadata yourself:

from dynamiq.connections import OpenAI as OpenAIConnection
from dynamiq.nodes.llms import OpenAI
from dynamiq.nodes.llms.base import ModelInfo

llm = OpenAI(
    connection=OpenAIConnection(url="https://my-gateway.internal/v1"),
    model="my-finetuned-model",
    model_info=ModelInfo(max_input_tokens=128000, supports_vision=True),
)

To actually send images or files, build a VisionMessage prompt — see Prompts & Messages.

Fallbacks

Attach a FallbackConfig to run a secondary LLM when the primary fails. Triggers can be any error, rate_limit, or connection:

from dynamiq.connections import Anthropic as AnthropicConnection
from dynamiq.connections import OpenAI as OpenAIConnection
from dynamiq.nodes.llms import Anthropic, OpenAI
from dynamiq.nodes.llms.base import FallbackConfig, FallbackTrigger
from dynamiq.prompts import Message, Prompt

backup = Anthropic(connection=AnthropicConnection(), model="claude-3-5-sonnet-20240620")

llm = OpenAI(
    connection=OpenAIConnection(),
    model="gpt-4o",
    prompt=Prompt(messages=[Message(role="user", content="{{question}}")]),
    fallback=FallbackConfig(
        llm=backup,
        enabled=True,
        triggers=[FallbackTrigger.RATE_LIMIT, FallbackTrigger.CONNECTION],
    ),
)

result = llm.run(input_data={"question": "Summarize RAG in one sentence."})
print(result.output["content"])

The fallback receives the same prepared input as the primary, and the primary node's output transformer is applied to the fallback's result, so downstream nodes see no difference.

Next steps

On this page