Skip to content

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]

Anthrpoic QOL

yuneng-jiangf34371375fd0
diff --git a/ui/litellm-dashboard/src/components/add_model/conditional_public_model_name.test.tsx b/ui/litellm-dashboard/src/components/add_model/conditional_public_model_name.test.tsx
new file mode 100644
index 00000000000..81633bd7a8a
--- /dev/null
+++ b/ui/litellm-dashboard/src/components/add_model/conditional_public_model_name.test.tsx
@@ -0,0 +1,28 @@
+import { render, screen } from "@testing-library/react";
+import { Form } from "antd";
+import { describe, expect, it } from "vitest";
+import ConditionalPublicModelName from "./conditional_public_model_name";
+
+describe("ConditionalPublicModelName", () => {
+ it("should render", () => {
+ render(
+ <Form
+ initialValues={{
+ model: ["gpt-4"],
+ model_mappings: [
+ {
+ public_name: "gpt-4",
+ litellm_model: "gpt-4",
+ },
+ ],
+ }}
+ >
+ <ConditionalPublicModelName />
+ </Form>,
+ );
+
+ expect(screen.getByText("Model Mappings")).toBeInTheDocument();
+ expect(screen.getByText("Public Model Name")).toBeInTheDocument();
+ expect(screen.getByText("LiteLLM Model Name")).toBeInTheDocument();
+ });
+});
diff --git a/ui/litellm-dashboard/src/components/add_model/conditional_public_model_name.tsx b/ui/litellm-dashboard/src/components/add_model/conditional_public_model_name.tsx
index b21a91dbe3c..0a77c252133 100644
--- a/ui/litellm-dashboard/src/components/add_model/conditional_public_model_name.tsx
+++ b/ui/litellm-dashboard/src/components/add_model/conditional_public_model_name.tsx
@@ -129,8 +129,31 @@ const ConditionalPublicModelName: React.FC = () => {
<TextInput
value={text}
onChange={(e) => {
+ const newValue = e.target.value;
const newMappings = [...form.getFieldValue("model_mappings")];
- newMappings[index].public_name = e.target.value;
+
+ // Check conditions for Anthropic -1m suffix handling
+ const isAnthropic = selectedProvider === Providers.Anthropic;
+ const endsWith1m = newValue.endsWith("-1m");
+ const litellmParams = form.getFieldValue("litellm_extra_params");
+ const isLitellmParamsEmpty = !litellmParams || litellmParams.trim() === "";
+
+ let finalPublicName = newValue;
+
+ if (isAnthropic && endsWith1m && isLitellmParamsEmpty) {
+ // Set litellm params with extra_headers
+ const litellmParamsValue = JSON.stringify(
+ { extra_headers: { "anthropic-beta": "context-1m-2025-08-07" } },
+ null,
+ 2,
+ );
+ form.setFieldValue("litellm_extra_params", litellmParamsValue);
+
+ // Remove -1m suffix from public_name
+ finalPublicName = newValue.slice(0, -3); // Remove "-1m" (3 characters)
+ }
+
+ newMappings[index].public_name = finalPublicName;
form.setFieldValue("model_mappings", newMappings);
}}
/>