Nonli exposes four Twig helpers for text generation: gpt(), claude(), gemini(), and mistral(). Each helper accepts a prompt and an optional provider model ID:
1{{ gpt('Write one factual sentence.', 'gpt-5.6-luna') }}If you omit the second argument, Nonli uses its deployed fallback. The optional examples below are a curated starting point, not a Nonli allowlist: actual access, pricing, regions, rate limits, and retirement dates depend on your provider account and API key.
1. Current reference#
| Provider helper | Deployed Nonli fallback when omitted | Current compatible examples | Lifecycle guidance |
|---|---|---|---|
gpt() | gpt-4o | gpt-5.6, gpt-5.6-sol, gpt-5.6-terra, gpt-5.6-luna | gpt-5.6 is a moving family alias; use a named variant when you need a more explicit capability/cost choice. |
claude() | claude-sonnet-4-5-20250929 | claude-fable-5, claude-opus-5, claude-sonnet-5, claude-haiku-4-5-20251001 | Anthropic's dateless Claude 5 IDs are pinned model IDs; the dated Haiku ID is an explicit snapshot. |
gemini() | gemini-3.7-flash | gemini-3.7-flash, gemini-3.6-flash, gemini-3.5-flash | Prefer stable entries for production. Preview and experimental IDs can change or disappear with shorter notice. |
mistral() | mistral-large-latest | mistral-medium-3-5, mistral-small-2603, mistral-large-2512 | latest is a moving alias; dated/versioned IDs are better for reproducible behavior. |
The fallbacks describe deployed Nonli behavior, not each provider's recommendation. If a provider retires a fallback or your key cannot use it, pass a model you can access and update the template after testing.
2. Copyable examples#
2.1. OpenAI#
1{# Omitted model: Nonli uses gpt-4o #}2{{ gpt('Return only a neutral, factual headline.') }}3
4{# Explicit current model #}5{{ gpt('Return only a neutral, factual headline.', 'gpt-5.6-luna') }}See the official OpenAI model catalog.
2.2. Anthropic Claude#
1{# Omitted model: Nonli uses claude-sonnet-4-5-20250929 #}2{{ claude('Return only a neutral, factual headline.') }}3
4{# Explicit current model #}5{{ claude('Return only a neutral, factual headline.', 'claude-sonnet-5') }}See the official Anthropic model overview.
2.3. Google Gemini#
1{# Omitted model: Nonli uses gemini-3.7-flash #}2{{ gemini('Return only a neutral, factual headline.') }}3
4{# Explicit stable model #}5{{ gemini('Return only a neutral, factual headline.', 'gemini-3.6-flash') }}See the official Gemini model catalog.
2.4. Mistral AI#
1{# Omitted model: Nonli uses mistral-large-latest #}2{{ mistral('Return only a neutral, factual headline.') }}3
4{# Explicit versioned model #}5{{ mistral('Return only a neutral, factual headline.', 'mistral-medium-3-5') }}See the official Mistral model catalog.
3. Which ID should you choose?#
- Use the omitted model only if you accept that Nonli may update the fallback after a provider retirement.
- Use a stable alias when you want provider-managed upgrades and can regression-test output over time.
- Use a pinned or versioned ID when reproducibility matters, then plan a deliberate migration before retirement.
- Use preview or experimental models only in controlled tests. Do not make them a production dependency without a fallback.
- Select only text/message-generation models. Image, audio, TTS, embedding, moderation, OCR, video, and agent-only models are not compatible with these helpers.
When no provider credential is available, a helper can return no content. In stricter runtime contexts, a missing or invalid token, inaccessible model, rate limit, or provider error can stop rendering with an error. Always keep a deterministic fallback in important templates, and test with the same provider account used by your brand.