Installation and setup
Installing NeMo Guardrails does not choose a model. The model is a few lines of config.yml, and a free Groq or Gemini key fits there.
pip install nemoguardrails 0.24.0
The package brings a runtime, a parser for the Colang configuration language and an embedding index, but no model client.
pip install "nemoguardrails==0.24.0"from importlib.metadata import version
print(version("nemoguardrails"))A model entry in config.ymlOptional
This course registers a stand-in chat model in lessons 5 and 6 and a stand-in embedding model in lesson 10, so it runs without a key. For a hosted model, the docs point any OpenAI-compatible provider, Groq and OpenRouter among them, at the openai engine with a base_url. Engines whose API is not OpenAI-compatible, such as anthropic and vertexai, need a LangChain package and NEMOGUARDRAILS_LLM_FRAMEWORK=langchain.
models:
- type: main
engine: openai
model: openai/gpt-oss-120b
api_key_env_var: GROQ_API_KEY
parameters:
base_url: https://api.groq.com/openai/v1| Provider | Key | Variable | base_url and model |
|---|---|---|---|
| Groq | Free, console.groq.com/keys | GROQ_API_KEY | https://api.groq.com/openai/v1, openai/gpt-oss-120b |
| Gemini | Free, aistudio.google.com/apikey | GEMINI_API_KEY | https://generativelanguage.googleapis.com/v1beta/openai/, gemini-2.5-flash |
| OpenRouter | Free models end in :free, openrouter.ai/keys | OPENROUTER_API_KEY | https://openrouter.ai/api/v1, google/gemma-4-31b-it:free |
| OpenAI | Paid, platform.openai.com/api-keys | OPENAI_API_KEY | Leave out base_url and api_key_env_var |
export GROQ_API_KEY=gsk_...The first time a message is matched to an intent with the real embedding model, it downloads, about ninety megabytes.
- Change
modelin the snippet togemini-2.5-flashand work out the other two lines that must change with it.
Little by little, you're building something great.