Skip to main content

What is the LiteLLM integration?

LiteLLM is an open-source proxy that puts one endpoint in front of every model provider. Its built-in connector, generic_guardrail_api, sends each call to Unbound. Unbound checks every call twice — the prompt before the model, the reply after it — against your Security policies and Tool policies. Calls appear under Logs.

Prerequisites

  • LiteLLM 1.106.2.
  • Admin access to Unbound.

Get your API key

  1. Open Settings → API Tokens in Unbound.
  2. Generate Token with Full Access, and copy it; it is shown once.
The token expires after at most 90 days. Generate a new one before then and update the proxy, or set fail_on_error: true below so an expired token stops traffic instead of letting it through unchecked. Set it in your proxy’s environment:

Setup

Add to your LiteLLM config.yaml:
Restart the proxy.
guardrails must be at the top level of config.yaml. Under litellm_settings it is ignored.
On LiteLLM 1.106.2, a coding agent can run a blocked command before the block arrives. The block is still recorded in Logs.Coming soon: holding streamed replies until the check finishes.

Self-hosted models and cost

Unbound prices each call from its model catalog. A self-hosted model, or a model your users reach through an alias such as coding-model, is not in that catalog, so Unbound bills its calls at a default rate. To bill your own rate, price these models in LiteLLM. Add model_info to each entry in model_list:
For a model you host yourself, pick the rate you want to report. Your own GPU cost per token works, and so does a hosted provider’s list price for the same model, which lets you compare it with your other providers.

Verification

  1. Send a request. It appears under Logs with its prompt and response.
  2. Send a prompt with something your Security policy detects, such as an API key. The detection is recorded.
  3. Ask a coding agent to run a command your Tool policies block, such as printenv. The agent reports an error.
  4. A few seconds after a call, its tokens appear in Logs. If they stay at 0, check GENERIC_LOGGER_ENDPOINT and GENERIC_LOGGER_HEADERS.
If nothing reaches Logs, check that UNBOUND_API_KEY is set and api_base ends in /v1/app/analyze.

Cost for self-hosted models

Each call’s cost shows up in Cost Management. Models LiteLLM already has a price for need nothing extra. For a self-hosted model, give LiteLLM its price per token under model_info:
Restart the proxy. LiteLLM works out the cost of each call and sends it with the usage, so the success_callback and GENERIC_LOGGER_* settings from Setup need to be in place. A self-hosted model with no price shows a cost of $0. Its tokens are still counted.

Attribution

Each call is attributed to the owner of the virtual key that made it, using the key’s user_email. Calls on a shared master key are attributed to the owner of the Unbound API key. For per-user policies, give each person a virtual key with user_email.

Security Policies

Detect and redact secrets and personal data in prompts

Tool Policies

Audit, warn or block risky commands and MCP calls