The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
refactor(ui): move key rate limit fields into KeyRateLimitFields
yassinea6314492f06
diff --git a/ui/litellm-dashboard/src/components/templates/KeyEditViewControls.tsx b/ui/litellm-dashboard/src/components/templates/KeyEditViewControls.tsxindex c12a913e384..99220af7c6f 100644--- a/ui/litellm-dashboard/src/components/templates/KeyEditViewControls.tsx+++ b/ui/litellm-dashboard/src/components/templates/KeyEditViewControls.tsx@@ -7,6 +7,7 @@ import { CircleHelp } from "lucide-react";import { FormField } from "@/components/shared/form/FormField";import { toast } from "@/lib/toast";import AgentSelector from "../agent_management/AgentSelector";+import RateLimitTypeFormItem from "../common_components/RateLimitTypeFormItem";import NumericalInput from "../shared/numerical_input";import SkillSelector from "../skills/SkillSelector";import { moveTagsOutOfMetadataJson } from "./keyEditFieldNormalizers";@@ -61,9 +62,51 @@ export const KeyTypeSelect = ({const SKILLS_HINT ="Enabled skills are visible to every key. Grant disabled (private) Claude Code plugins to this key here.";-export const TPD_HINT =+const TPD_HINT ="Daily token budget for batch submissions (/v1/batches). When set, batch input files are charged against this 24h window instead of the key's TPM/RPM limits. Online requests keep using TPM/RPM.";+export const KeyRateLimitFields = ({ control }: { control: Control<KeyEditFormValues> }) => (+ <>+ <FormField control={control} name="tpm_limit" label="TPM Limit">+ {({ ref: _ref, ...field }) => <NumericalInput {...field} value={field.value ?? ""} min={0} />}+ </FormField>++ <FormField control={control} name="tpm_limit_type">+ {({ value, onChange, id }) => (+ <RateLimitTypeFormItem+ id={id}+ type="tpm"+ name="tpm_limit_type"+ showDetailedDescriptions={false}+ value={value as string | null}+ onChange={onChange}+ />+ )}+ </FormField>++ <FormField control={control} name="rpm_limit" label="RPM Limit">+ {({ ref: _ref, ...field }) => <NumericalInput {...field} value={field.value ?? ""} min={0} />}+ </FormField>++ <FormField control={control} name="rpm_limit_type">+ {({ value, onChange, id }) => (+ <RateLimitTypeFormItem+ id={id}+ type="rpm"+ name="rpm_limit_type"+ showDetailedDescriptions={false}+ value={value as string | null}+ onChange={onChange}+ />+ )}+ </FormField>++ <FormField control={control} name="tpd_limit" label={labelWithHint("TPD Limit (batch)", TPD_HINT)}>+ {({ ref: _ref, ...field }) => <NumericalInput {...field} value={field.value ?? ""} min={0} />}+ </FormField>+ </>+);+export const KeyAgentAndSkillFields = ({control,accessToken,diff --git a/ui/litellm-dashboard/src/components/templates/key_edit_view.tsx b/ui/litellm-dashboard/src/components/templates/key_edit_view.tsxindex a69d6715ef7..6a94cbcf2a0 100644--- a/ui/litellm-dashboard/src/components/templates/key_edit_view.tsx+++ b/ui/litellm-dashboard/src/components/templates/key_edit_view.tsx@@ -20,7 +20,6 @@ import BudgetDurationDropdown from "../common_components/budget_duration_dropdowimport { mapInternalToDisplayNames } from "../callback_info_helpers";import KeyLifecycleSettings from "../common_components/KeyLifecycleSettings";import PassThroughRoutesSelector from "../common_components/PassThroughRoutesSelector";-import RateLimitTypeFormItem from "../common_components/RateLimitTypeFormItem";import OrganizationDropdown from "../common_components/OrganizationDropdown";import RouterSettingsAccordion, { RouterSettingsAccordionRef } from "../common_components/RouterSettingsAccordion";import { routerSettingsEditorValue, routerSettingsUpdate } from "../common_components/routerSettingsPayload";@@ -35,10 +34,10 @@ import {KeyAgentAndSkillFields,KeyBudgetNumberField,KeyMetadataField,+ KeyRateLimitFields,KeyTypeSelect,labelWithHint,moveMetadataTagsToTagsField,- TPD_HINT,} from "./KeyEditViewControls";import {KeyEditFormValues,@@ -485,43 +484,7 @@ export function KeyEditView({/></Field>- <FormField control={form.control} name="tpm_limit" label="TPM Limit">- {({ ref: _ref, ...field }) => <NumericalInput {...field} value={field.value ?? ""} min={0} />}- </FormField>-- <FormField control={form.control} name="tpm_limit_type">- {({ value, onChange, id }) => (- <RateLimitTypeFormItem- id={id}- type="tpm"- name="tpm_limit_type"- showDetailedDescriptions={false}- value={value as string | null}- onChange={onChange}- />- )}- </FormField>-- <FormField control={form.control} name="rpm_limit" label="RPM Limit">- {({ ref: _ref, ...field }) => <NumericalInput {...field} value={field.value ?? ""} min={0} />}- </FormField>-- <FormField control={form.control} name="rpm_limit_type">- {({ value, onChange, id }) => (- <RateLimitTypeFormItem- id={id}- type="rpm"- name="rpm_limit_type"- showDetailedDescriptions={false}- value={value as string | null}- onChange={onChange}- />- )}- </FormField>-- <FormField control={form.control} name="tpd_limit" label={labelWithHint("TPD Limit (batch)", TPD_HINT)}>- {({ ref: _ref, ...field }) => <NumericalInput {...field} value={field.value ?? ""} min={0} />}- </FormField>+ <KeyRateLimitFields control={form.control} /><FormFieldcontrol={form.control}