mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-11 22:51:28 +00:00
fix(ui): keep spend configurable in create-key advanced settings
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
a97afd7645
commit
e7322cc9bd
3 changed files with 6 additions and 1 deletions
|
|
@ -111,6 +111,7 @@ const fieldTooltips: { [key: string]: string } = {
|
|||
key: "Bring your own key value instead of an auto-generated one. Must start with 'sk-' and be at least 16 characters",
|
||||
budget_id: "Attach an existing budget (created via /budget/new) to this key",
|
||||
soft_budget: "Spend threshold that triggers an alert without blocking the key",
|
||||
spend: "Starting spend in USD recorded for this key. Counts toward its budget",
|
||||
send_invite_email: "Send an invite email to this key's user",
|
||||
max_parallel_requests: "Maximum number of concurrent requests. Requests beyond this limit receive a 429 error",
|
||||
allowed_cache_controls: "Cache control values requests with this key may use, e.g. no-cache, no-store",
|
||||
|
|
@ -160,6 +161,7 @@ const getFieldHelp = (key: string, property: SchemaProperty, type: string): stri
|
|||
const specificHelp: { [key: string]: string } = {
|
||||
max_budget: "Enter maximum budget in USD (e.g., 100.50)",
|
||||
soft_budget: "Enter alert threshold in USD (e.g., 50)",
|
||||
spend: "Enter starting spend in USD (e.g., 0)",
|
||||
budget_duration: "Select a time period for budget reset",
|
||||
budget_id: "Enter the id of an existing budget",
|
||||
tpm_limit: "Enter maximum tokens per minute (whole number)",
|
||||
|
|
|
|||
|
|
@ -98,6 +98,7 @@ const OPENAPI_SCHEMA = {
|
|||
properties: {
|
||||
key: { type: "string", title: "Key" },
|
||||
soft_budget: { type: "number", title: "Soft Budget" },
|
||||
spend: { anyOf: [{ type: "number" }, { type: "null" }], title: "Spend" },
|
||||
blocked: { anyOf: [{ type: "boolean" }, { type: "null" }], title: "Blocked" },
|
||||
max_budget: { type: "number", title: "Max Budget" },
|
||||
allowed_cache_controls: { anyOf: [{ items: {}, type: "array" }, { type: "null" }] },
|
||||
|
|
@ -173,6 +174,7 @@ const SECTION_PAYLOAD_ADDITIONS: Record<keyof typeof SECTIONS, Record<string, un
|
|||
advanced: {
|
||||
key: undefined,
|
||||
soft_budget: undefined,
|
||||
spend: undefined,
|
||||
blocked: undefined,
|
||||
allowed_cache_controls: undefined,
|
||||
model_rpm_limit: undefined,
|
||||
|
|
@ -480,10 +482,12 @@ describe("CreateKey", () => {
|
|||
await openSection(/Optional Settings/i);
|
||||
await openSection(SECTIONS.advanced);
|
||||
await userEvent.type(await screen.findByLabelText("Soft Budget"), "12");
|
||||
await userEvent.type(await screen.findByLabelText("Spend"), "5");
|
||||
await submit();
|
||||
|
||||
const payload = await createdPayload();
|
||||
expect(payload.soft_budget).toBe(12);
|
||||
expect(payload.spend).toBe(5);
|
||||
expect(payload).toHaveProperty("key");
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -1760,7 +1760,6 @@ const CreateKey: React.FC<CreateKeyProps> = ({ team, teams, data, addKey, autoOp
|
|||
"budget_duration",
|
||||
"tpm_limit",
|
||||
"rpm_limit",
|
||||
"spend",
|
||||
"user_id",
|
||||
"agent_id",
|
||||
"project_id",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue