LLM Configuration

Every specialist node in Modular9 runs an LLM call. This guide covers how the LLM gateway works, how to bring your own API keys, and how to select models per node.

The LLM Gateway

Modular9 routes all AI inference through a unified LLM gateway. The gateway abstracts over multiple providers so you can switch models without changing your workflow.

Default provider: NVIDIA NIM — a production inference platform that serves open-source models with enterprise SLAs.

Default model: meta/llama-3.3-70b-instruct (Llama 3.3 70B Instruct) — the primary model used for all specialist nodes unless overridden.

The gateway is used for:

  • Specialist node execution (agent runner)
  • Workflow Composer — the AI that builds your canvas from a plain-English description
  • Look-ahead filter evaluation

NVIDIA NIM is free to start

NVIDIA NIM offers a free tier at build.nvidia.com with generous rate limits for getting started. The NVIDIA_API_KEY environment variable must be set for Modular9 to function.

Supported Models

NVIDIA NIM (Default)

NVIDIA NIM serves open-weight models at scale. The following models are available for selection in Modular9:

| Model | ID | Best for | |-------|-----|----------| | Llama 3.3 70B | meta/llama-3.3-70b-instruct | General tasks — default for all nodes | | Llama 3.1 405B | meta/llama-3.1-405b-instruct | Complex reasoning, large context | | Llama 3.1 70B | meta/llama-3.1-70b-instruct | Balanced performance/speed | | Mistral 7B | mistralai/mistral-7b-instruct-v0.3 | Fast, lightweight tasks | | Mixtral 8x7B | mistralai/mixtral-8x7b-instruct-v01 | Mixture-of-experts quality | | Qwen 2.5 72B | qwen/qwen2.5-72b-instruct | Strong coding and analysis |

The default model (meta/llama-3.3-70b-instruct) is applied to any node where selectedModel is null. This default can be changed in your account settings.

BYOK Providers

With Bring Your Own Keys, you can use models from any of these providers:

| Provider | Models available | |----------|-----------------| | OpenAI | GPT-4o, GPT-4o mini, GPT-4 Turbo, GPT-3.5 Turbo | | Anthropic | Claude 3.5 Sonnet, Claude 3.5 Haiku, Claude 3 Opus | | Google Gemini | Gemini 1.5 Pro, Gemini 1.5 Flash, Gemini 2.0 Flash | | OpenRouter | 100+ models via unified API |

BYOK routing is in development

Gemini and OpenRouter gateway routing is currently in development. NVIDIA NIM, OpenAI, and Anthropic BYOK are fully functional.

Bring Your Own Keys (BYOK)

BYOK lets you use your own API keys from any supported provider. Your keys are never stored in plaintext — Modular9 encrypts them with AES-256-GCM before writing to the database.

Adding Keys in Settings

  1. Click your avatar in the top-right corner
  2. Go to Settings → API Keys
  3. Select the provider from the dropdown
  4. Paste your API key
  5. Click Save Key

Only the masked version of your key (e.g., sk-...a1b2) is ever sent back to the browser. The full key remains encrypted in the database.

Key Encryption

API keys are encrypted with AES-256-GCM using a server-side encryption key (ENCRYPTION_KEY environment variable). The encryption happens in the /api/settings/keys API route before the key reaches the database. Decryption happens server-side at execution time — the raw key is only ever in server memory during an LLM call.

Keep your ENCRYPTION_KEY safe

If the ENCRYPTION_KEY environment variable is lost or rotated, all stored BYOK keys become unrecoverable. You will need to re-enter them. Store your encryption key in a secrets manager (Vercel environment variables, AWS Secrets Manager, etc.).

Using BYOK Keys

Once a BYOK key is saved, it becomes available as a model source in the node settings dropdown. BYOK models are prefixed with the provider name in the selector:

NVIDIA NIM
  meta/llama-3.3-70b-instruct  ← default
  meta/llama-3.1-405b-instruct

OpenAI (BYOK)
  gpt-4o
  gpt-4o-mini

Anthropic (BYOK)
  claude-3-5-sonnet-latest
  claude-3-5-haiku-latest

Per-Node Model Selection

Each specialist node can run a different model. This lets you optimize for cost and quality:

  • Use a fast, cheap model for formatting or summarization nodes
  • Use a high-capability model for complex reasoning nodes

Changing a Node's Model

  1. Click the specialist node to select it
  2. Click the gear icon → Advanced Settings
  3. Under LLM Configuration, open the Model dropdown
  4. Select any available model
  5. Close the dialog — the selection is saved to canvas state

The selected model is stored in the node's selectedModel field. When null, the node uses your account's default model.

Match the model to the task

Not every node needs the most capable model. Nodes doing structured extraction, reformatting, or short summaries perform equally well with smaller, faster models. Reserve large models for high-complexity analysis, long-form writing, and multi-step reasoning tasks.

Model Selection Strategy by Task Type

| Task Type | Recommended Model | |-----------|-------------------| | Complex code review, security audit | Llama 3.3 70B or GPT-4o | | Blog writing, long-form content | Llama 3.3 70B or Claude 3.5 Sonnet | | Data extraction, formatting | Llama 3.1 70B or Mistral 7B | | Simple summarization | Mistral 7B or GPT-4o mini | | Legal / financial analysis | Claude 3.5 Sonnet or GPT-4o | | Code generation | Qwen 2.5 72B or GPT-4o |

Temperature and Token Settings

Two additional LLM parameters are configurable per node in Advanced Settings:

Temperature

Controls how creative or deterministic the model is:

  • 0.0 – 0.3 — Highly deterministic. Best for code review, structured analysis, data extraction.
  • 0.5 – 0.7 — Balanced. Good default for most tasks (Modular9 default: 0.7).
  • 0.8 – 1.0 — High creativity. Best for writing, brainstorming, content generation.

Max Tokens

Sets the maximum length of the model's response:

  • 2048 — Short tasks: triage, routing, quick analysis
  • 4096 — Standard tasks (default)
  • 8192 — Long-form content: full articles, detailed reports, comprehensive audits
  • 16384+ — Extended outputs: only when using models with large context windows

Max tokens affects cost

Setting max tokens higher than needed increases cost without improving quality. Models stop generating when the task is naturally complete — max tokens is a ceiling, not a target. Only raise it when output is being truncated.

Default Model Configuration

Your account's default model is applied to every new node added to the canvas. To change it:

  1. Go to Settings → LLM Configuration
  2. Select your preferred default model from the dropdown
  3. Save

Existing nodes that already have an explicit model selection are not affected. Only new nodes (and existing nodes with selectedModel: null) pick up the new default.

A "silent migration" is applied at login: if your stored default model is no longer available (e.g., deprecated), it falls back to meta/llama-3.3-70b-instruct.

Cost Considerations

NVIDIA NIM

NVIDIA NIM pricing is token-based. Llama 3.3 70B is competitively priced for production workloads. Check build.nvidia.com/pricing for current rates.

Key cost drivers in Modular9:

  • Number of nodes — each specialist node in a run makes one LLM call
  • Context length — long upstream outputs become long inputs for the next node; text grows through the chain
  • Max tokens — determines the output ceiling
  • Model choice — larger models cost more per token

Reducing Costs

  1. Use smaller models for simple tasks — a Mistral 7B call costs a fraction of a Llama 405B call
  2. Limit chain length — fewer nodes = fewer LLM calls
  3. Use look-ahead filters — filters that terminate early skip downstream LLM calls entirely
  4. Set appropriate max tokens — don't set 8192 tokens for a task that produces 500 tokens of output

Self-Hosted Deployment

If you're running the Docker self-hosted stack, you can point the LLM gateway at any OpenAI-compatible endpoint — including local models via Ollama. Set the NVIDIA_API_KEY and update the gateway base URL in your environment configuration to point at your local inference server.

Environment Variables

The LLM gateway is configured via environment variables:

| Variable | Description | |----------|-------------| | NVIDIA_API_KEY | NVIDIA NIM API key — required for default operation | | NVIDIA_DEMO_API_KEY | Separate key for the public /demo route | | ENCRYPTION_KEY | AES-256-GCM key for encrypting BYOK keys at rest |

BYOK keys are stored encrypted in the database — no separate environment variables are needed for BYOK providers.

Next Steps

  • Building Workflows — configure temperature and models while building pipelines
  • Creating Plugins — system prompts that work with your chosen model
  • Templates — pre-configured workflows with recommended model settings