Skip to main content
Guardrails has support for 100+ LLMs through its integration with LiteLLM. This integration allows the Guardrails call API to use the same clean interface that LiteLLM and OpenAI use. To interact with a model, set the desired LLM API KEY and specify the model with the model property.

OpenAI

Basic usage

Streaming

Tools/Function calling

Anthropic

Basic usage

Streaming

Azure OpenAI

Basic usage

Streaming

Tools/Function calling

Gemini

Basic usage

Streaming

Databricks

Basic usage

Streaming

Other LLMs

Over 100 LLMs are supported through our LiteLLM integration, including:
  • Anthropic
  • AWS Bedrock
  • Anyscale
  • Huggingface
  • Mistral
  • Predibase
  • Fireworks
Find your LLM in LiteLLM’s documentation. Then, follow those same steps and set the same environment variables they guide you to use, but invoke a Guard object instead of the litellm object. Guardrails will wire through the arguments to litellm, run the Guarding process, and return a validated outcome.

Custom LLM wrappers

If you’re using an LLM that isn’t natively supported by Guardrails and you don’t want to use LiteLLM, you can build a custom LLM API wrapper. Create a function that accepts a positional argument for the prompt as a string and any other arguments as keyword args. The function should return the output of the LLM API as a string. Install ProfanityFree from hub: