docs(proxy): document the unified custom_key_policy key hook - #1446
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Author
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 396ce5e. Configure here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TLDR
Documents the new
general_settings.custom_key_policyhook for proxy virtual keys: one policy function that runs on every key operation (/key/generate,/key/service-account/generate,/key/update,/key/bulk_update,/team/key/bulk_update, and/key/{key}/regenerate, so every Admin UI create, edit, and regenerate flow) and receives the operation plus the effective key state, meaning the existing key merged with the requested changes with a relativedurationalready turned into an absoluteexpires. The new section in the virtual keys page explains thepolicy_requestcontract (operation,existing_key,effective_key,request), the{"decision", "message"}return shape and its403, where in the request path the hook runs, and that the legacycustom_key_generateandcustom_key_updatehooks keep working unchanged and run first when also configured, with a worked example that caps every key at seven days. The two legacy sections now point at it as the recommended single hook, and the config settings table gains acustom_key_policyrow. It pairs with the litellm code PR on branchlitellm_unified_key_policy_hook; the code PR is being opened separately, and this docs PR merges after it landsLinear ticket
Resolves LIT-7524
Preview
docs/proxy/virtual_keys.mdgains the "Custom key policy (one hook for every key operation)" section between "Custom /key/update" and "Upperbound /key/generate params", plus one pointer sentence in each of the two legacy hook sections.docs/proxy/config_settings.mdgains thecustom_key_policyrow right aftercustom_key_updatein thegeneral_settingstable, linking to the new sectionNote
Low Risk
Documentation-only change with no runtime or configuration behavior in this PR.
Overview
Adds documentation for
general_settings.custom_key_policy, a unified virtual-key policy hook that runs on generate, update, and regenerate with the effective merged key state (including absoluteexpiresfrom relativeduration).docs/proxy/virtual_keys.mdgains a full section covering thepolicy_requestcontract (operation,existing_key,effective_key,request), the{"decision", "message"}/403behavior, covered routes (including Admin UI flows), ordering when used withcustom_key_generateandcustom_key_update, and a seven-day expiry example. The legacy generate/update sections and their warning now point readers to this hook as the recommended approach.docs/proxy/config_settings.mdadds acustom_key_policyrow to thegeneral_settingsreference table, linked to the new section.Reviewed by Cursor Bugbot for commit 396ce5e. Bugbot is set up for automated code reviews on this repo. Configure here.