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.
| Node | Model prefix | Connection env vars |
|---|---|---|
AI21 | ai21/ | AI21_API_KEY |
Anthropic | anthropic/ | ANTHROPIC_API_KEY |
Anyscale | anyscale/ | ANYSCALE_API_KEY |
AzureAI | azure/ | AZURE_API_KEY, AZURE_URL, AZURE_API_VERSION |
Bedrock | bedrock/ | AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_DEFAULT_REGION (or AWS_DEFAULT_PROFILE) |
Cerebras | cerebras/ | CEREBRAS_API_KEY |
Cohere | — | COHERE_API_KEY |
CustomLLM | configurable | explicit HttpApiKey(url=..., api_key=...) |
Databricks | databricks/ | DATABRICKS_API_BASE, DATABRICKS_API_KEY |
DeepInfra | deepinfra/ | DEEPINFRA_API_KEY |
DeepSeek | deepseek/ | DEEPSEEK_API_KEY |
FireworksAI | fireworks_ai/ | FIREWORKS_AI_API_KEY |
Gemini | gemini/ | GEMINI_API_KEY |
Groq | groq/ | GROQ_API_KEY |
HuggingFace | huggingface/ | HUGGINGFACE_API_KEY |
Mistral | mistral/ | MISTRAL_API_KEY |
NvidiaNIM | nvidia_nim/ | NVIDIA_NIM_URL, NVIDIA_NIM_API_KEY |
Ollama | ollama/ | none — url defaults to http://localhost:11434 |
OpenAI | openai/ | OPENAI_API_KEY (optional OPENAI_URL) |
OpenRouter | openrouter/ | OPENROUTER_API_KEY (optional OPENROUTER_API_BASE) |
Perplexity | perplexity/ | PERPLEXITYAI_API_KEY |
Replicate | replicate/ | REPLICATE_API_KEY |
SambaNova | sambanova/ | SAMBANOVA_API_KEY |
TogetherAI | together_ai/ | TOGETHER_API_KEY |
VertexAI | vertex_ai/ | VERTEXAI_PROJECT_ID, VERTEXAI_PROJECT_LOCATION, plus GOOGLE_CLOUD_* service-account fields |
WatsonX | watsonx/ | WATSONX_API_KEY, WATSONX_PROJECT_ID, WATSONX_URL |
xAI | xai/ | 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:
modelstringrequiredconnectionBaseConnectionpromptPrompttemperaturefloatmax_tokensintstoplist[str]top_pfloatseedintpresence_penalty / frequency_penaltyfloattoolslist[Tool | dict]tool_choicestringresponse_formatdictstrict_toolsbool | list[str]thinking_enabledboolbudget_tokensintfallbackFallbackConfigmodel_infoModelInfoerror_handlingErrorHandlingUnknown 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-dependentCapability 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
Prompts & Messages
Jinja templating, message roles, vision and file inputs.
Streaming & Callbacks
Stream tokens from any provider with the same callback handler.
Platform Connections & Gateway
Route SDK LLM calls through the Dynamiq AI Gateway.
LLM node on the platform
The same node in the visual workflow builder.
Retrievers & Rankers
Query vector stores with per-store retriever nodes, bundle retrieval into an agent tool, and re-rank results with Cohere, an LLM, or time weighting.
Prompts & Messages
Build Prompt and Message objects with Jinja templating, send images and files with VisionMessage, and attach tools and response schemas.