Overview
Workflows can use AI models for text generation, summarization, structured output, and media (image, video). Most teams store provider API keys as named connections per provider (OpenAI, Gemini, Runway, and others). See AI registry connections. In each AI model task you pick a registry, optionally an API connection, and configure the model and inputs.
Setting API keys
- AI Models page – Open a registry, then add connections for that registry's provider on the registry detail page.
- Workflow builder – In an AI model task, use the API connection dropdown and the link to open the registry page to manage keys.
If your plan includes default AI keys for a registry, you may leave the connection unset for that task; otherwise add a connection before runs will succeed.
Usage and limits
AI Model tasks count toward workflow run credits (per-call and, when the step used FlowFn's platform keys, token-based platform AI charges on plans that define a rate). Large prompts and responses tend to use more tokens. When using FlowFn's platform-managed keys, premium models — flagship reasoning models (e.g. Claude Opus 4.7, GPT-5, Gemini 3.1 Pro) — cost more per call than lightweight models like Claude Haiku 4.5, GPT-5 Mini, or Gemini 3.5 Flash. Video generation models (e.g. Veo, Runway) run on your own provider key. If you connect your own API key, every AI call bills at the same flat rate regardless of model — you pay the provider directly for inference. Check your plan and Billing and Plans for allowances and top-up options.
Max tokens per call
Every LLM call has a max_tokens ceiling controlling how much output the model may generate. You can set a preferred default at two levels, and the runtime always clamps both to a per-source plan cap:
- On a team AI connection — Team Settings → AI, edit a connection, set Max tokens per message. Used as the default for any agent or workflow AI task that picks this connection.
- On your personal AI provider — My Account → AI assistant. Used when an agent has no connection set and falls back to your AI preferences (custom mode).
- On an agent — the Max tokens per message input on the agent edit page is the explicit per-agent override.
Plans cap max_tokens separately by source: system AI (FlowFn-managed keys, billed in credits) gets the tightest cap, team AI (your BYOK key) is roomier, and custom AI (your personal API key) is the loosest. The cap is enforced on every LLM call, so a value saved before a plan tightened still works correctly — it's just clamped at runtime. When you leave the field blank, the model's registry default applies (e.g. 8k for Claude Opus, 16k for GPT-5).
Best practices
- Use clear prompts and, when possible, structured output for reliability.
- Do not put API keys in workflow code; use encrypted team connections on the registry detail page.