Skip to content

SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.

feat(frontend): LLM pricing UI update and tests [5/6] (#11910)

Gaurav Tewari165c94551134
diff --git a/frontend/public/locales/en-GB/titles.json b/frontend/public/locales/en-GB/titles.json
index 7dd6000c60..d5a8b4c5a2 100644
--- a/frontend/public/locales/en-GB/titles.json
+++ b/frontend/public/locales/en-GB/titles.json
@@ -62,6 +62,6 @@
"TRACES_FUNNELS_DETAIL": "SigNoz | Funnel",
"INTEGRATIONS_DETAIL": "SigNoz | Integration",
"PUBLIC_DASHBOARD": "SigNoz | Dashboard",
- "LLM_OBSERVABILITY_BASE": "SigNoz | LLM Observability",
- "LLM_OBSERVABILITY_MODEL_PRICING": "SigNoz | Model Pricing"
-}
+ "LLM_OBSERVABILITY_OVERVIEW": "SigNoz | LLM Observability Overview",
+ "LLM_OBSERVABILITY_CONFIGURATION": "SigNoz | LLM Observability Configuration"
+}
\ No newline at end of file
diff --git a/frontend/public/locales/en/titles.json b/frontend/public/locales/en/titles.json
index cb0f91a67e..d0c875dfad 100644
--- a/frontend/public/locales/en/titles.json
+++ b/frontend/public/locales/en/titles.json
@@ -87,6 +87,6 @@
"TRACES_FUNNELS_DETAIL": "SigNoz | Funnel",
"INTEGRATIONS_DETAIL": "SigNoz | Integration",
"PUBLIC_DASHBOARD": "SigNoz | Dashboard",
- "LLM_OBSERVABILITY_BASE": "SigNoz | LLM Observability",
- "LLM_OBSERVABILITY_MODEL_PRICING": "SigNoz | Model Pricing"
-}
+ "LLM_OBSERVABILITY_OVERVIEW": "SigNoz | LLM Observability Overview",
+ "LLM_OBSERVABILITY_CONFIGURATION": "SigNoz | LLM Observability Configuration"
+}
\ No newline at end of file
diff --git a/frontend/src/AppRoutes/pageComponents.ts b/frontend/src/AppRoutes/pageComponents.ts
index 8b3ebd8e8a..0f1edd2b74 100644
--- a/frontend/src/AppRoutes/pageComponents.ts
+++ b/frontend/src/AppRoutes/pageComponents.ts
@@ -329,10 +329,3 @@ export const LLMObservabilityPage = Loadable(
/* webpackChunkName: "LLM Observability Page" */ 'pages/LLMObservability'
),
);
-
-export const LLMObservabilityModelPricingPage = Loadable(
- () =>
- import(
- /* webpackChunkName: "LLM Observability Model Pricing Page" */ 'pages/LLMObservabilityModelPricing'
- ),
-);
diff --git a/frontend/src/AppRoutes/routes.ts b/frontend/src/AppRoutes/routes.ts
index 86a9504d49..7ae954f452 100644
--- a/frontend/src/AppRoutes/routes.ts
+++ b/frontend/src/AppRoutes/routes.ts
@@ -24,7 +24,6 @@ import {
LicensePage,
ListAllALertsPage,
LLMObservabilityPage,
- LLMObservabilityModelPricingPage,
LiveLogs,
Login,
Logs,
@@ -515,17 +514,17 @@ const routes: AppRoutes[] = [
isPrivate: true,
},
{
- path: ROUTES.LLM_OBSERVABILITY_BASE,
+ path: ROUTES.LLM_OBSERVABILITY_OVERVIEW,
exact: true,
component: LLMObservabilityPage,
- key: 'LLM_OBSERVABILITY_BASE',
+ key: 'LLM_OBSERVABILITY_OVERVIEW',
isPrivate: true,
},
{
- path: ROUTES.LLM_OBSERVABILITY_MODEL_PRICING,
+ path: ROUTES.LLM_OBSERVABILITY_CONFIGURATION,
exact: true,
- component: LLMObservabilityModelPricingPage,
- key: 'LLM_OBSERVABILITY_MODEL_PRICING',
+ component: LLMObservabilityPage,
+ key: 'LLM_OBSERVABILITY_CONFIGURATION',
isPrivate: true,
},
];
diff --git a/frontend/src/constants/routes.ts b/frontend/src/constants/routes.ts
index 3fc7941b4d..110292cbf1 100644
--- a/frontend/src/constants/routes.ts
+++ b/frontend/src/constants/routes.ts
@@ -90,7 +90,8 @@ const ROUTES = {
AI_ASSISTANT_ICON_PREVIEW: '/ai-assistant-icon-preview',
MCP_SERVER: '/settings/mcp-server',
LLM_OBSERVABILITY_BASE: '/llm-observability',
- LLM_OBSERVABILITY_MODEL_PRICING: '/llm-observability/settings/model-pricing',
+ LLM_OBSERVABILITY_OVERVIEW: '/llm-observability/overview',
+ LLM_OBSERVABILITY_CONFIGURATION: '/llm-observability/configuration',
} as const;
export default ROUTES;
diff --git a/frontend/src/container/LLMObservability/LLMObservability.module.scss b/frontend/src/container/LLMObservability/LLMObservability.module.scss
index f8b5d9df74..abba2c816c 100644
--- a/frontend/src/container/LLMObservability/LLMObservability.module.scss
+++ b/frontend/src/container/LLMObservability/LLMObservability.module.scss
@@ -1,27 +1,7 @@
.llmObservability {
display: flex;
flex-direction: column;
- gap: var(--spacing-8);
- padding: var(--spacing-12) var(--spacing-16);
-}
-
-.pageHeader {
- display: flex;
- align-items: flex-start;
- justify-content: space-between;
- gap: var(--spacing-8);
-}
-
-.pageHeaderTitle {
- .title {
- margin: 0;
- font-size: var(--font-size-xl);
- font-weight: var(--font-weight-semibold);
- }
-
- .subtitle {
- margin: var(--spacing-2) 0 0;
- color: var(--text-vanilla-400);
- font-size: var(--periscope-font-size-base);
- }
+ height: 100%;
+ margin-top: var(--spacing-2);
+ margin-left: var(--spacing-2);
}
diff --git a/frontend/src/container/LLMObservability/LLMObservability.tsx b/frontend/src/container/LLMObservability/LLMObservability.tsx
index eb887c5064..d34343228c 100644
--- a/frontend/src/container/LLMObservability/LLMObservability.tsx
+++ b/frontend/src/container/LLMObservability/LLMObservability.tsx
@@ -1,16 +1,22 @@
+import { Tabs } from '@signozhq/ui/tabs';
+
+import { useLLMObservabilityTabs } from './hooks/useLLMObservabilityTabs';
import styles from './LLMObservability.module.scss';
+// Shell for the LLM Observability page: renders the top-level tab bar
+// (Overview / Configuration) using the SigNoz design-system Tabs, with
+// route-driven active state from useLLMObservabilityTabs.
function LLMObservability(): JSX.Element {
+ const { items, activeTab, onTabChange } = useLLMObservabilityTabs();
+
return (
<div className={styles.llmObservability} data-testid="llm-observability-page">
- <header className={styles.pageHeader}>
- <div className={styles.pageHeaderTitle}>
- <h1 className={styles.title}>LLM Observability</h1>
- <p className={styles.subtitle}>
- Monitor and analyze your LLM usage, costs, and performance
- </p>
- </div>
- </header>
+ <Tabs
+ items={items}
+ value={activeTab}
+ onChange={onTabChange}
+ testId="llm-observability-tabs"
+ />
</div>
);
}
diff --git a/frontend/src/container/LLMObservability/Overview/Overview.module.scss b/frontend/src/container/LLMObservability/Overview/Overview.module.scss
new file mode 100644
index 0000000000..d2b47bee8e
--- /dev/null
+++ b/frontend/src/container/LLMObservability/Overview/Overview.module.scss
@@ -0,0 +1,27 @@
+.overview {
+ display: flex;
+ flex-direction: column;
+ gap: var(--spacing-8);
+ padding: var(--spacing-12) var(--spacing-16);
+}
+
+.pageHeader {
+ display: flex;
+ align-items: flex-start;
+ justify-content: space-between;
+ gap: var(--spacing-8);
+}
+
+.pageHeaderTitle {
+ .title {
+ margin: 0;
+ font-size: var(--font-size-xl);
+ font-weight: var(--font-weight-semibold);
+ }
+
+ .subtitle {
+ margin: var(--spacing-2) 0 0;
+ color: var(--text-vanilla-400);
+ font-size: var(--periscope-font-size-base);
+ }
+}
diff --git a/frontend/src/container/LLMObservability/Overview/Overview.tsx b/frontend/src/container/LLMObservability/Overview/Overview.tsx
new file mode 100644
index 0000000000..f45384b624
--- /dev/null
+++ b/frontend/src/container/LLMObservability/Overview/Overview.tsx
@@ -0,0 +1,20 @@
+import styles from './Overview.module.scss';
+
+// Overview tab content for LLM Observability. Currently the feature's landing
+// surface; usage/cost/performance widgets land in later PRs.
+function Overview(): JSX.Element {
+ return (
+ <div className={styles.overview} data-testid="llm-observability-overview">
+ <header className={styles.pageHeader}>
+ <div className={styles.pageHeaderTitle}>
+ <h1 className={styles.title}>LLM Observability</h1>
+ <p className={styles.subtitle}>
+ Monitor and analyze your LLM usage, costs, and performance
+ </p>
+ </div>
+ </header>
+ </div>
+ );
+}
+
+export default Overview;
diff --git a/frontend/src/container/LLMObservability/Settings/ModelPricing/LLMObservabilityModelPricing.module.scss b/frontend/src/container/LLMObservability/Settings/ModelPricing/LLMObservabilityModelPricing.module.scss
index 369b3bf26c..ece63fd7db 100644
--- a/frontend/src/container/LLMObservability/Settings/ModelPricing/LLMObservabilityModelPricing.module.scss
+++ b/frontend/src/container/LLMObservability/Settings/ModelPricing/LLMObservabilityModelPricing.module.scss
@@ -2,29 +2,4 @@
display: flex;
flex-direction: column;
gap: var(--spacing-8);
- padding: var(--spacing-12) var(--spacing-16);
-}
-
-.pageHeader {
- display: flex;
- align-items: flex-start;
- justify-content: space-between;
- gap: var(--spacing-8);
-}
-
-.pageHeaderTitle {
- display: flex;
- flex-direction: column;
- gap: var(--spacing-2);
- .title {
- margin: 0;
- font-size: var(--font-size-xl);
- font-weight: var(--font-weight-semibold);
- }
-
- .subtitle {
- margin: var(--spacing-2) 0 0;
- color: var(--text-vanilla-400);
- font-size: var(--periscope-font-size-base);
- }
}
diff --git a/frontend/src/container/LLMObservability/Settings/ModelPricing/LLMObservabilityModelPricing.tsx b/frontend/src/container/LLMObservability/Settings/ModelPricing/LLMObservabilityModelPricing.tsx
index e92d131177..f774591e26 100644
--- a/frontend/src/container/LLMObservability/Settings/ModelPricing/LLMObservabilityModelPricing.tsx
+++ b/frontend/src/container/LLMObservability/Settings/ModelPricing/LLMObservabilityModelPricing.tsx
@@ -1,5 +1,4 @@
import { Tabs } from '@signozhq/ui/tabs';
-import { Typography } from '@signozhq/ui/typography';
import ModelCostTabPanel from './ModelCostTabPanel';
import styles from './LLMObservabilityModelPricing.module.scss';
@@ -10,20 +9,9 @@ function LLMObservabilityModelPricing(): JSX.Element {
className={styles.llmObservabilityModelPricing}
data-testid="llm-observability-model-pricing-page"
>
- <header className={styles.pageHeader}>
- <div className={styles.pageHeaderTitle}>
- <Typography.Text as="h1" size="large" weight="semibold">
- Configuration
- </Typography.Text>
- <Typography.Text color="muted">
- Model pricing and cost estimation settings
- </Typography.Text>
- </div>
- </header>
-
<Tabs
// Model costs is the only enabled tab for now, so default to it. When
- // the unpriced-models tab lands, this can become a URL-backed param.
+ // the unpriced-models tab lands in a later PR.
defaultValue="model-costs"
items={[
{
diff --git a/frontend/src/container/LLMObservability/Settings/ModelPricing/ModelCostTabPanel/ModelCostTabPanel.tsx b/frontend/src/container/LLMObservability/Settings/ModelPricing/ModelCostTabPanel/ModelCostTabPanel.tsx
index 51ebae9003..18ab53aba8 100644
--- a/frontend/src/container/LLMObservability/Settings/ModelPricing/ModelCostTabPanel/ModelCostTabPanel.tsx
+++ b/frontend/src/container/LLMObservability/Settings/ModelPricing/ModelCostTabPanel/ModelCostTabPanel.tsx
@@ -2,7 +2,6 @@ import { useMemo } from 'react';
import { Button } from '@signozhq/ui/button';
import { Input } from '@signozhq/ui/input';
import { SelectSimple } from '@signozhq/ui/select';
-import { Typography } from '@signozhq/ui/typography';
import { Plus, Search, X } from '@signozhq/icons';
import { useListLLMPricingRules } from 'api/generated/services/llmpricingrules';
import { type ListLLMPricingRulesParams } from 'api/generated/services/sigNoz.schemas';
@@ -161,12 +160,6 @@ function ModelCostTabPanel(): JSX.Element {
onDelete={deletion.requestDelete}
/>
- <footer>
- <Typography.Text color="muted" size="small">
- All prices per 1M tokens (USD)
- </Typography.Text>
- </footer>
-
{drawer.isOpen && (
<ModelCostDrawer
isOpen={drawer.isOpen}
diff --git a/frontend/src/container/LLMObservability/Settings/ModelPricing/ModelCostTabPanel/__tests__/ModelCostTabPanel.test.tsx b/frontend/src/container/LLMObservability/Settings/ModelPricing/ModelCostTabPanel/__tests__/ModelCostTabPanel.test.tsx
new file mode 100644
index 0000000000..92ee491918
--- /dev/null
+++ b/frontend/src/container/LLMObservability/Settings/ModelPricing/ModelCostTabPanel/__tests__/ModelCostTabPanel.test.tsx
@@ -0,0 +1,326 @@
+import { LlmpricingruletypesLLMPricingRuleUnitDTO as UnitDTO } from 'api/generated/services/sigNoz.schemas';
+import {
+ TOAST_MODEL_COST_DELETED,
+ TOAST_MODEL_COST_UPDATED,
+} from 'container/LLMObservability/Settings/ModelPricing/constants';
+import {
+ LLM_PRICING_ENDPOINT,
+ LLM_PRICING_RULE_ENDPOINT,
+ makeListResponse,
+ mockRules,
+} from 'container/LLMObservability/Settings/ModelPricing/__tests__/fixtures';
+import { rest, server } from 'mocks-server/server';
+import { render, screen, userEvent, waitFor, within } from 'tests/test-utils';
+
+import ModelCostTabPanel from '../ModelCostTabPanel';
+
+const toastSuccess = jest.fn();
+const toastError = jest.fn();
+jest.mock('@signozhq/ui/sonner', () => ({
+ ...jest.requireActual('@signozhq/ui/sonner'),
+ toast: {
+ success: (...args: unknown[]): void => toastSuccess(...args),
+ error: (...args: unknown[]): void => toastError(...args),
+ },
+}));
+
+function setupList(items = mockRules, total = items.length): void {
+ server.use(
+ rest.get(LLM_PRICING_ENDPOINT, (_req, res, ctx) =>
+ res(ctx.status(200), ctx.json(makeListResponse(items, total))),
+ ),
+ );
+}
+
+function resetUrl(): void {
+ window.history.pushState(null, '', '/');
+}
+
+async function openRowMenu(
+ user: ReturnType<typeof userEvent.setup>,
+ ruleId: string,
+): Promise<void> {
+ const row = screen.getByTestId(`model-cell-name-${ruleId}`).closest('tr');
+ await user.click(within(row as HTMLElement).getByRole('button'));
+}
+
+describe('ModelCostTabPanel (integration)', () => {
+ beforeEach(() => {
+ resetUrl();
+ });
+
+ afterEach(() => {
+ server.resetHandlers();
+ });
+
+ it('renders pricing rules returned by the list API', async () => {
+ setupList();
+ render(<ModelCostTabPanel />);
+
+ const openaiCell = await screen.findByTestId('model-cell-name-rule-openai');
+ expect(openaiCell).toHaveTextContent('gpt-4o');
+ expect(
+ screen.getByTestId('model-cell-name-rule-anthropic'),
+ ).toHaveTextContent('claude-3-5-sonnet');
+ // Canonical id under the model name + provider column.
+ expect(screen.getByText('openai:gpt-4o')).toBeInTheDocument();
+ expect(screen.getAllByText('OpenAI').length).toBeGreaterThan(0);
+ // Source badges reflect the override flag.
+ expect(screen.getByTestId('source-badge-rule-openai')).toHaveTextContent(
+ 'User override',
+ );
+ expect(screen.getByTestId('source-badge-rule-anthropic')).toHaveTextContent(
+ 'Auto',
+ );
+ });
+
+ it('shows the empty state when there are no rules', async () => {
+ setupList([], 0);
+ render(<ModelCostTabPanel />);
+
+ const empty = await screen.findByTestId('model-costs-empty');
+ expect(empty).toHaveTextContent('No model costs yet.');
+ });
+
+ it('shows an error message when the list request fails', async () => {
+ server.use(
+ rest.get(LLM_PRICING_ENDPOINT, (_req, res, ctx) => res(ctx.status(500))),
+ );
+ render(<ModelCostTabPanel />);
+
+ const alert = await screen.findByRole('alert');
+ expect(alert).toHaveTextContent(
+ 'Failed to load pricing rules. Please try again.',
+ );
+ });
+
+ it('sends the debounced search term as the q param', async () => {
+ const user = userEvent.setup({ pointerEventsCheck: 0 });
+ let lastParams: URLSearchParams | null = null;
+ server.use(
+ rest.get(LLM_PRICING_ENDPOINT, (req, res, ctx) => {
+ lastParams = req.url.searchParams;
+ return res(ctx.status(200), ctx.json(makeListResponse(mockRules)));
+ }),
+ );
+ render(<ModelCostTabPanel />);
+
+ await screen.findByTestId('model-cell-name-rule-openai');
+ await user.type(
+ screen.getByPlaceholderText('Search by model or provider'),
+ 'claude',
+ );
+
+ await waitFor(() => expect(lastParams?.get('q')).toBe('claude'));
+ });
+
+ it('clears the search via the clear button', async () => {
+ const user = userEvent.setup({ pointerEventsCheck: 0 });
+ setupList();
+ render(<ModelCostTabPanel />);
+
+ const input = screen.getByPlaceholderText(
+ 'Search by model or provider',
+ ) as HTMLInputElement;
+ await user.type(input, 'gpt');
+ expect(input.value).toBe('gpt');
+
+ await user.click(screen.getByTestId('model-cost-search-clear'));
+ await waitFor(() => expect(input.value).toBe(''));
+ });
+
+ it('sends isOverride=true when the source filter is set to User override', async () => {
+ const user = userEvent.setup({ pointerEventsCheck: 0 });
+ let lastParams: URLSearchParams | null = null;
+ server.use(
+ rest.get(LLM_PRICING_ENDPOINT, (req, res, ctx) => {
+ lastParams = req.url.searchParams;
+ return res(ctx.status(200), ctx.json(makeListResponse(mockRules)));
+ }),
+ );
+ render(<ModelCostTabPanel />);
+
+ await screen.findByTestId('model-cell-name-rule-openai');
+ await user.click(screen.getByTestId('source-filter'));
+ // Scope to the listbox option — "User override" also appears as a row badge.
+ await user.click(
+ await screen.findByRole('option', { name: 'User override' }),
+ );
+
+ await waitFor(() => expect(lastParams?.get('isOverride')).toBe('true'));
+ });
+
+ it('opens the add drawer for a manager (ADMIN)', async () => {
+ const user = userEvent.setup({ pointerEventsCheck: 0 });
+ setupList();
+ render(<ModelCostTabPanel />);
+
+ await screen.findByTestId('model-cell-name-rule-openai');
+ await user.click(screen.getByTestId('add-model-cost-btn'));
+
+ const modelInput = await screen.findByTestId('drawer-model-id-input');
+ expect(modelInput).toBeInTheDocument();
+ expect(screen.getByTestId('drawer-save-btn')).toBeInTheDocument();
+ });
+
+ it('hides the add button and row actions for a viewer', async () => {
+ setupList();
+ render(<ModelCostTabPanel />, undefined, { role: 'VIEWER' });
+
+ const row = (
+ await screen.findByTestId('model-cell-name-rule-openai')
+ ).closest('tr') as HTMLElement;
+ expect(screen.queryByTestId('add-model-cost-btn')).not.toBeInTheDocument();
+ // View-only rows render no action menu (no buttons in the row).
+ expect(within(row).queryByRole('button')).not.toBeInTheDocument();
+ });
+
+ it('opens the edit drawer prefilled from the row action menu', async () => {
+ const user = userEvent.setup({ pointerEventsCheck: 0 });
+ setupList();
+ render(<ModelCostTabPanel />);
+
+ await screen.findByTestId('model-cell-name-rule-openai');
+ await openRowMenu(user, 'rule-openai');
+ await user.click(await screen.findByText('Edit'));
+
+ const drawerTitle = await screen.findByText('Edit model cost');
+ expect(drawerTitle).toBeInTheDocument();
+ const modelInput = screen.getByTestId(
+ 'drawer-model-id-input',
+ ) as HTMLInputElement;
+ expect(modelInput.value).toBe('gpt-4o');
+ expect(modelInput).toBeDisabled();
+ });
+
+ it('deletes a rule through the confirm dialog', async () => {
+ const user = userEvent.setup({ pointerEventsCheck: 0 });
+ let deletedId: string | null = null;
+ setupList();
+ server.use(
+ rest.delete(LLM_PRICING_RULE_ENDPOINT, (req, res, ctx) => {
+ deletedId = req.params.id as string;
+ return res(ctx.status(200), ctx.json({ status: 'success' }));
+ }),
+ );
+ render(<ModelCostTabPanel />);
+
+ await screen.findByTestId('model-cell-name-rule-openai');
+ await openRowMenu(user, 'rule-openai');
+ await user.click(await screen.findByText('Delete'));
+
+ await user.click(await screen.findByTestId('drawer-delete-confirm-btn'));
+
+ await waitFor(() => expect(deletedId).toBe('rule-openai'));
+ await waitFor(() =>
+ expect(toastSuccess).toHaveBeenCalledWith(TOAST_MODEL_COST_DELETED),
+ );
+ });
+
+ it('renders cache buckets for rules that have cache pricing', async () => {
+ setupList();
+ render(<ModelCostTabPanel />);
+
+ const anthropicRow = (
+ await screen.findByTestId('model-cell-name-rule-anthropic')
+ ).closest('tr') as HTMLElement;
+ expect(within(anthropicRow).getByText(/Cache Read/i)).toBeInTheDocument();
+ expect(within(anthropicRow).getByText(/Cache Write/i)).toBeInTheDocument();
+ });
+
+ it('formats per-million prices in the row', async () => {
+ setupList();
+ render(<ModelCostTabPanel />);
+
+ const openaiRow = (
+ await screen.findByTestId('model-cell-name-rule-openai')
+ ).closest('tr') as HTMLElement;
+ // mockRules gpt-4o has input cost 3 → rendered as $3.00.
+ expect(within(openaiRow).getByText('$3.00')).toBeInTheDocument();
+ });
+
+ it('sends a normalized create payload when adding a rule', async () => {
+ const user = userEvent.setup({ pointerEventsCheck: 0 });
+ let body: Record<string, unknown> | null = null;
+ setupList();
+ server.use(
+ rest.put(LLM_PRICING_ENDPOINT, async (req, res, ctx) => {
+ body = await req.json();
+ return res(ctx.status(200), ctx.json({ status: 'success' }));
+ }),
+ );
+ render(<ModelCostTabPanel />);
+
+ await screen.findByTestId('model-cell-name-rule-openai');
+ await user.click(screen.getByTestId('add-model-cost-btn'));
+
+ // Leading/trailing whitespace should be trimmed off the model id.
+ await user.type(
+ await screen.findByTestId('drawer-model-id-input'),
+ ' gpt-4o-mini ',
+ );
+ await user.type(screen.getByTestId('drawer-input-cost'), '3');
+ await user.type(screen.getByTestId('drawer-output-cost'), '9');
+ await user.click(screen.getByTestId('drawer-save-btn'));
+
+ await waitFor(() => expect(body).not.toBeNull());
+ // The create call submits a bulk `rules` array of normalized payloads.
+ const [payload] = (
+ body as unknown as {
+ rules: Record<string, unknown>[];
+ }
+ ).rules;
+ expect(payload).toMatchObject({
+ modelName: 'gpt-4o-mini',
+ provider: 'OpenAI',
+ isOverride: true,
+ enabled: true,
+ unit: UnitDTO.per_million_tokens,
+ pricing: { input: 3, output: 9 },
+ });
+ });
+
+ it('sends an updated payload when editing a rule', async () => {
+ const user = userEvent.setup({ pointerEventsCheck: 0 });
+ let body: Record<string, unknown> | null = null;
+ setupList();
+ server.use(
+ rest.put(LLM_PRICING_ENDPOINT, async (req, res, ctx) => {
+ body = await req.json();
+ return res(ctx.status(200), ctx.json({ status: 'success' }));
+ }),
+ );
+ render(<ModelCostTabPanel />);
+
+ await screen.findByTestId('model-cell-name-rule-openai');
+ await openRowMenu(user, 'rule-openai');
+ await user.click(await screen.findByText('Edit'));
+
+ // Model id + provider are locked in edit mode; change the prefilled input cost.
+ const inputCost = await screen.findByTestId('drawer-input-cost');
+ await user.clear(inputCost);
+ await user.type(inputCost, '5');
+ await user.click(screen.getByTestId('drawer-save-btn'));
+
+ await waitFor(() => expect(body).not.toBeNull());
+ const [payload] = (
+ body as unknown as {
+ rules: Record<string, unknown>[];
+ }
+ ).rules;
+ // Edit carries the rule id; disabled model/provider are still submitted and
+ // the edited price flows through, while output keeps its prefilled value.
+ expect(payload).toMatchObject({
+ id: 'rule-openai',
+ modelName: 'gpt-4o',
+ provider: 'OpenAI',
+ isOverride: true,
+ enabled: true,
+ unit: UnitDTO.per_million_tokens,
+ pricing: { input: 5, output: 9 },
+ });
+ await waitFor(() =>
+ expect(toastSuccess).toHaveBeenCalledWith(TOAST_MODEL_COST_UPDATED),
+ );
+ });
+});
diff --git a/frontend/src/container/LLMObservability/Settings/ModelPricing/ModelCostTabPanel/components/ModelCostDrawer/__tests__/ModelCostDrawer.test.tsx b/frontend/src/container/LLMObservability/Settings/ModelPricing/ModelCostTabPanel/components/ModelCostDrawer/__tests__/ModelCostDrawer.test.tsx
new file mode 100644
index 0000000000..9c4360dbbe
--- /dev/null
+++ b/frontend/src/container/LLMObservability/Settings/ModelPricing/ModelCostTabPanel/components/ModelCostDrawer/__tests__/ModelCostDrawer.test.tsx
@@ -0,0 +1,295 @@
+import { makePricingRule } from 'container/LLMObservability/Settings/ModelPricing/__tests__/fixtures';
+import { EMPTY_DRAFT } from 'container/LLMObservability/Settings/ModelPricing/constants';
+import { draftFromRule } from 'container/LLMObservability/Settings/ModelPricing/utils';
+import { render, screen, userEvent, waitFor } from 'tests/test-utils';
+
+import ModelCostDrawer from '../ModelCostDrawer';
+
+const editDraft = draftFromRule(
+ makePricingRule({
+ id: 'rule-openai',
+ modelName: 'gpt-4o',
+ provider: 'OpenAI',
+ }),
+);
+
+describe('ModelCostDrawer (integration)', () => {
+ it('renders the add title and a save button for a manager', () => {
+ render(
+ <ModelCostDrawer
+ isOpen
+ mode="add"
+ initialDraft={EMPTY_DRAFT}
+ onClose={jest.fn()}
+ onSave={jest.fn()}
+ isSaving={false}
+ saveError={null}
+ canManage
+ />,
+ );
+
+ expect(screen.getByText('Add model cost')).toBeInTheDocument();
+ expect(screen.getByTestId('drawer-save-btn')).toBeInTheDocument();
+ });
+
+ it('disables save until the form is dirty', async () => {
+ const user = userEvent.setup({ pointerEventsCheck: 0 });
+ render(
+ <ModelCostDrawer
+ isOpen
+ mode="add"
+ initialDraft={EMPTY_DRAFT}
+ onClose={jest.fn()}
+ onSave={jest.fn()}
+ isSaving={false}
+ saveError={null}
+ canManage
+ />,
+ );
+
+ expect(screen.getByTestId('drawer-save-btn')).toBeDisabled();
+
+ await user.type(screen.getByTestId('drawer-model-id-input'), 'openai:gpt-4o');
+
+ await waitFor(() =>
+ expect(screen.getByTestId('drawer-save-btn')).toBeEnabled(),
+ );
+ });
+
+ it('shows the model id required error and does not call onSave when the name is empty', async () => {
+ const user = userEvent.setup({ pointerEventsCheck: 0 });
+ const onSave = jest.fn();
+ render(
+ <ModelCostDrawer
+ isOpen
+ mode="add"
+ initialDraft={EMPTY_DRAFT}
+ onClose={jest.fn()}
+ onSave={onSave}
+ isSaving={false}
+ saveError={null}
+ canManage
+ />,
+ );
+
+ // Make the form dirty without touching the model id: add a pattern, which
+ // mutates the `patterns` form field while leaving the name empty.
+ await user.type(screen.getByTestId('drawer-pattern-input'), 'gpt');
+ await user.click(screen.getByTestId('drawer-pattern-add-btn'));
+
+ await waitFor(() =>
+ expect(screen.getByTestId('drawer-save-btn')).toBeEnabled(),
+ );
+ await user.click(screen.getByTestId('drawer-save-btn'));
+
+ const error = await screen.findByText('Billing model ID is required.');
+ expect(error).toBeInTheDocument();
+ expect(onSave).not.toHaveBeenCalled();
+ });
+
+ it('calls onSave once on the happy path with valid model id and pricing', async () => {
+ const user = userEvent.setup({ pointerEventsCheck: 0 });
+ const onSave = jest.fn();
+ render(
+ <ModelCostDrawer
+ isOpen
+ mode="add"
+ initialDraft={EMPTY_DRAFT}
+ onClose={jest.fn()}
+ onSave={onSave}
+ isSaving={false}
+ saveError={null}
+ canManage
+ />,
+ );
+
+ await user.type(screen.getByTestId('drawer-model-id-input'), 'openai:gpt-4o');
+ await user.type(screen.getByTestId('drawer-input-cost'), '3');
+ await user.type(screen.getByTestId('drawer-output-cost'), '9');
+
+ await user.click(screen.getByTestId('drawer-save-btn'));
+
+ await waitFor(() => expect(onSave).toHaveBeenCalledTimes(1));
+ });
+
+ it('renders the edit title with disabled, prefilled model id and disabled provider', () => {
+ render(
+ <ModelCostDrawer
+ isOpen
+ mode="edit"
+ initialDraft={editDraft}
+ onClose={jest.fn()}
+ onSave={jest.fn()}
+ isSaving={false}
+ saveError={null}
+ canManage
+ />,
+ );
+
+ expect(screen.getByText('Edit model cost')).toBeInTheDocument();
+ const modelInput = screen.getByTestId(
+ 'drawer-model-id-input',
+ ) as HTMLInputElement;
+ expect(modelInput.value).toBe('gpt-4o');
+ expect(modelInput).toBeDisabled();
+ expect(screen.getByTestId('drawer-provider-select')).toBeDisabled();
+ });
+
+ it('renders a read-only view with a Close button and no save for a viewer', () => {
+ render(
+ <ModelCostDrawer
+ isOpen
+ mode="edit"
+ initialDraft={editDraft}
+ onClose={jest.fn()}
+ onSave={jest.fn()}
+ isSaving={false}
+ saveError={null}
+ canManage={false}
+ />,
+ );
+
+ expect(screen.getByText('View model cost')).toBeInTheDocument();
+ expect(screen.queryByTestId('drawer-save-btn')).not.toBeInTheDocument();
+ expect(screen.getByTestId('drawer-cancel-btn')).toHaveTextContent('Close');
+ });
+
+ it('renders the save error text', () => {
+ render(
+ <ModelCostDrawer
+ isOpen
+ mode="add"
+ initialDraft={EMPTY_DRAFT}
+ onClose={jest.fn()}
+ onSave={jest.fn()}
+ isSaving={false}
+ saveError="boom"
+ canManage
+ />,
+ );
+
+ expect(screen.getByText('boom')).toBeInTheDocument();
+ });
+
+ it('adds and removes a model pattern from the editor', async () => {
+ const user = userEvent.setup({ pointerEventsCheck: 0 });
+ render(
+ <ModelCostDrawer
+ isOpen
+ mode="add"
+ initialDraft={EMPTY_DRAFT}
+ onClose={jest.fn()}
+ onSave={jest.fn()}
+ isSaving={false}
+ saveError={null}
+ canManage
+ />,
+ );
+
+ await user.type(screen.getByTestId('drawer-pattern-input'), 'gpt-5');
+ await user.click(screen.getByTestId('drawer-pattern-add-btn'));
+ // The added pattern renders as a removable chip.
+ const removeChip = screen.getByRole('button', {
+ name: 'Remove pattern gpt-5',
+ });
+ expect(removeChip).toBeInTheDocument();
+
+ await user.click(removeChip);
+ expect(
+ screen.queryByRole('button', { name: 'Remove pattern gpt-5' }),
+ ).not.toBeInTheDocument();
+ });
+
+ it('adds a cache pricing bucket via the picker and removes it', async () => {
+ const user = userEvent.setup({ pointerEventsCheck: 0 });
+ render(
+ <ModelCostDrawer
+ isOpen
+ mode="add"
+ initialDraft={EMPTY_DRAFT}
+ onClose={jest.fn()}
+ onSave={jest.fn()}
+ isSaving={false}
+ saveError={null}
+ canManage
+ />,
+ );
+
+ await user.click(screen.getByTestId('drawer-add-bucket-btn'));
+ await user.click(screen.getByTestId('drawer-add-bucket-cache-read'));
+
+ // Adding the bucket reveals its cost input and the shared cache-mode select.
+ expect(screen.getByTestId('drawer-cache-read-cost')).toBeInTheDocument();
+ expect(screen.getByTestId('drawer-cache-mode')).toBeInTheDocument();
+
+ await user.click(screen.getByTestId('drawer-remove-cache-read'));
+ expect(
+ screen.queryByTestId('drawer-cache-read-cost'),
+ ).not.toBeInTheDocument();
+ });
+
+ it('blocks save with a pricing error when an override rule has no input cost', async () => {
+ const user = userEvent.setup({ pointerEventsCheck: 0 });
+ const onSave = jest.fn();
+ render(
+ <ModelCostDrawer
+ isOpen
+ mode="add"
+ initialDraft={EMPTY_DRAFT}
+ onClose={jest.fn()}
+ onSave={onSave}
+ isSaving={false}
+ saveError={null}
+ canManage
+ />,
+ );
+
+ // EMPTY_DRAFT defaults to an override with empty pricing. Fill only the
+ // model id + output cost so the form is dirty but the input cost is missing.
+ await user.type(screen.getByTestId('drawer-model-id-input'), 'openai:gpt-4o');
+ await user.type(screen.getByTestId('drawer-output-cost'), '9');
+ await user.click(screen.getByTestId('drawer-save-btn'));
+
+ await expect(
+ screen.findByText('Input cost must be greater than 0.'),
+ ).resolves.toBeInTheDocument();
+ expect(onSave).not.toHaveBeenCalled();
+ });
+
+ it('requires confirmation to reset an override rule back to auto', async () => {
+ const user = userEvent.setup({ pointerEventsCheck: 0 });
+ render(
+ <ModelCostDrawer
+ isOpen
+ mode="edit"
+ initialDraft={editDraft}
+ onClose={jest.fn()}
+ onSave={jest.fn()}
+ isSaving={false}
+ saveError={null}
+ canManage
+ />,
+ );
+
+ // Pricing is editable while the rule is an override.
+ expect(screen.getByTestId('drawer-input-cost')).toBeEnabled();
+
+ // Picking "auto" surfaces a confirm step instead of applying immediately.
+ await user.click(screen.getByTestId('drawer-source-auto'));
+ expect(screen.getByTestId('drawer-reset-confirm-btn')).toBeInTheDocument();
+ expect(screen.getByTestId('drawer-input-cost')).toBeEnabled();
+
+ // Keep backs out of the reset.
+ await user.click(screen.getByTestId('drawer-reset-keep-btn'));
+ expect(
+ screen.queryByTestId('drawer-reset-confirm-btn'),
+ ).not.toBeInTheDocument();
+
+ // Confirming the reset flips the rule to auto and locks pricing.
+ await user.click(screen.getByTestId('drawer-source-auto'));
+ await user.click(screen.getByTestId('drawer-reset-confirm-btn'));
+ await waitFor(() =>
+ expect(screen.getByTestId('drawer-input-cost')).toBeDisabled(),
+ );
+ });
+});
diff --git a/frontend/src/container/LLMObservability/Settings/ModelPricing/ModelCostTabPanel/components/ModelCostDrawer/hooks/useModelCostDrawer.ts b/frontend/src/container/LLMObservability/Settings/ModelPricing/ModelCostTabPanel/components/ModelCostDrawer/hooks/useModelCostDrawer.ts
index b00b9da55f..2586b3387a 100644
--- a/frontend/src/container/LLMObservability/Settings/ModelPricing/ModelCostTabPanel/components/ModelCostDrawer/hooks/useModelCostDrawer.ts
+++ b/frontend/src/container/LLMObservability/Settings/ModelPricing/ModelCostTabPanel/components/ModelCostDrawer/hooks/useModelCostDrawer.ts
@@ -6,7 +6,11 @@ import {
useCreateOrUpdateLLMPricingRules,
} from 'api/generated/services/llmpricingrules';
-import { EMPTY_DRAFT } from '../../../../constants';
+import {
+ EMPTY_DRAFT,
+ TOAST_MODEL_COST_ADDED,
+ TOAST_MODEL_COST_UPDATED,
+} from '../../../../constants';
import type { DrawerDraft, DrawerMode, PricingRule } from '../../../../types';
import { buildRulePayload, draftFromRule } from '../../../../utils';
@@ -76,7 +80,9 @@ export function useModelCostDrawer(): UseModelCostDrawerResult {
await invalidateList();
setIsOpen(false);
setSelectedRuleId(null);
- toast.success(mode === 'edit' ? 'Model cost updated' : 'Model cost added');
+ toast.success(
+ mode === 'edit' ? TOAST_MODEL_COST_UPDATED : TOAST_MODEL_COST_ADDED,
+ );
} catch (error) {
const message = error instanceof Error ? error.message : 'Save failed';
setSaveError(message);
diff --git a/frontend/src/container/LLMObservability/Settings/ModelPricing/ModelCostTabPanel/components/ModelCostsTable/ModelCostsTable.module.scss b/frontend/src/container/LLMObservability/Settings/ModelPricing/ModelCostTabPanel/components/ModelCostsTable/ModelCostsTable.module.scss
index 42b40a1ed5..b423254ae5 100644
--- a/frontend/src/container/LLMObservability/Settings/ModelPricing/ModelCostTabPanel/components/ModelCostsTable/ModelCostsTable.module.scss
+++ b/frontend/src/container/LLMObservability/Settings/ModelPricing/ModelCostTabPanel/components/ModelCostsTable/ModelCostsTable.module.scss
@@ -1,7 +1,7 @@
.modelCostsTable {
margin-top: var(--spacing-8);
--tanstack-table-row-height: 48px;
- height: calc(100vh - 250px);
+ height: calc(100vh - 170px);
overflow-y: auto;
:global(table) tbody tr {
diff --git a/frontend/src/container/LLMObservability/Settings/ModelPricing/ModelCostTabPanel/hooks/useModelCostDelete.ts b/frontend/src/container/LLMObservability/Settings/ModelPricing/ModelCostTabPanel/hooks/useModelCostDelete.ts
index b8de9467bc..0bae90b02f 100644
--- a/frontend/src/container/LLMObservability/Settings/ModelPricing/ModelCostTabPanel/hooks/useModelCostDelete.ts
+++ b/frontend/src/container/LLMObservability/Settings/ModelPricing/ModelCostTabPanel/hooks/useModelCostDelete.ts
@@ -6,6 +6,7 @@ import {
useDeleteLLMPricingRule,
} from 'api/generated/services/llmpricingrules';
+import { TOAST_MODEL_COST_DELETED } from '../../constants';
import type { PricingRule } from '../../types';
// The minimal slice of a rule the delete-confirm flow needs: the id to delete
@@ -49,7 +50,7 @@ export function useModelCostDelete(): UseModelCostDeleteResult {
queryKey: getListLLMPricingRulesQueryKey(),
});
setPendingDelete(null);
- toast.success('Model cost deleted');
+ toast.success(TOAST_MODEL_COST_DELETED);
} catch (error) {
const message = error instanceof Error ? error.message : 'Delete failed';
toast.error(message);
diff --git a/frontend/src/container/LLMObservability/Settings/ModelPricing/__tests__/fixtures.ts b/frontend/src/container/LLMObservability/Settings/ModelPricing/__tests__/fixtures.ts
new file mode 100644
index 0000000000..1f06f2573d
--- /dev/null
+++ b/frontend/src/container/LLMObservability/Settings/ModelPricing/__tests__/fixtures.ts
@@ -0,0 +1,80 @@
+import {
+ LlmpricingruletypesLLMPricingRuleCacheModeDTO as CacheModeDTO,
+ LlmpricingruletypesLLMPricingRuleUnitDTO as UnitDTO,
+ type ListLLMPricingRules200,
+} from 'api/generated/services/sigNoz.schemas';
+
+import type { PricingRule } from '../types';
+
+// Endpoint glob used by MSW handlers. The generated client hits a relative
+// `/api/v1/llm_pricing_rules`, so the `*` prefix matches regardless of base URL.
+export const LLM_PRICING_ENDPOINT = '*/api/v1/llm_pricing_rules';
+export const LLM_PRICING_RULE_ENDPOINT = '*/api/v1/llm_pricing_rules/:id';
+
+// Builds a valid pricing rule, with overrides merged shallowly. Pricing is
+// replaced wholesale when provided so callers can shape cache buckets freely.
+export function makePricingRule(
+ overrides: Partial<PricingRule> = {},
+): PricingRule {
+ const { pricing, ...rest } = overrides;
+ return {
+ id: 'rule-1',
+ enabled: true,
+ isOverride: true,
+ modelName: 'gpt-4o',
+ modelPattern: ['gpt-4o'],
+ orgId: 'org-1',
+ provider: 'OpenAI',
+ sourceId: 'source-1',
+ unit: UnitDTO.per_million_tokens,
+ createdAt: '2023-10-01T00:00:00.000Z',
+ updatedAt: '2023-10-10T00:00:00.000Z',
+ syncedAt: '2023-10-10T00:00:00.000Z',
+ pricing: {
+ input: 3,
+ output: 9,
+ ...pricing,
+ },
+ ...rest,
+ };
+}
+
+export const mockRules: PricingRule[] = [
+ makePricingRule({
+ id: 'rule-openai',
+ modelName: 'gpt-4o',
+ provider: 'OpenAI',
+ isOverride: true,
+ pricing: { input: 3, output: 9 },
+ }),
+ makePricingRule({
+ id: 'rule-anthropic',
+ modelName: 'claude-3-5-sonnet',
+ provider: 'Anthropic',
+ isOverride: false,
+ pricing: {
+ input: 2,
+ output: 30,
+ cache: { mode: CacheModeDTO.additive, read: 3, write: 6 },
+ },
+ }),
+];
+
+// Wraps items in the list response envelope the list query reads
+// (`data.data.items` / `data.data.total`).
+export function makeListResponse(
+ items: PricingRule[],
+ total = items.length,
+ offset = 0,
+ limit = 20,
+): ListLLMPricingRules200 {
+ return {
+ status: 'success',
+ data: {
+ items,
+ total,
+ offset,
+ limit,
+ },
+ };
+}
diff --git a/frontend/src/container/LLMObservability/Settings/ModelPricing/constants.ts b/frontend/src/container/LLMObservability/Settings/ModelPricing/constants.ts
index 2511692db5..02144e2b1e 100644
--- a/frontend/src/container/LLMObservability/Settings/ModelPricing/constants.ts
+++ b/frontend/src/container/LLMObservability/Settings/ModelPricing/constants.ts
@@ -4,6 +4,10 @@ import type { CacheBucketDef, DrawerDraft } from './types';
export const PAGE_SIZE = 20;
+export const TOAST_MODEL_COST_ADDED = 'Model cost added';
+export const TOAST_MODEL_COST_UPDATED = 'Model cost updated';
+export const TOAST_MODEL_COST_DELETED = 'Model cost deleted';
+
export const PAGE_KEY = 'page';
export const LIMIT_KEY = 'limit';
export const SEARCH_KEY = 'search';
diff --git a/frontend/src/container/LLMObservability/__tests__/LLMObservability.test.tsx b/frontend/src/container/LLMObservability/__tests__/LLMObservability.test.tsx
new file mode 100644
index 0000000000..a1b0c98e38
--- /dev/null
+++ b/frontend/src/container/LLMObservability/__tests__/LLMObservability.test.tsx
@@ -0,0 +1,69 @@
+import { safeNavigateMock } from '__tests__/safeNavigateMock';
+import ROUTES from 'constants/routes';
+import {
+ LLM_PRICING_ENDPOINT,
+ makeListResponse,
+ mockRules,
+} from 'container/LLMObservability/Settings/ModelPricing/__tests__/fixtures';
+import { rest, server } from 'mocks-server/server';
+import { render, screen, userEvent, waitFor } from 'tests/test-utils';
+
+import LLMObservability from '../LLMObservability';
+
+function setupList(items = mockRules): void {
+ server.use(
+ rest.get(LLM_PRICING_ENDPOINT, (_req, res, ctx) =>
+ res(ctx.status(200), ctx.json(makeListResponse(items))),
+ ),
+ );
+}
+
+describe('LLMObservability (integration)', () => {
+ beforeEach(() => {
+ window.history.pushState(null, '', '/');
+ });
+
+ afterEach(() => {
+ server.resetHandlers();
+ });
+
+ it('renders the overview panel and the tab bar on the overview route', () => {
+ render(<LLMObservability />, undefined, {
+ initialRoute: ROUTES.LLM_OBSERVABILITY_OVERVIEW,
+ });
+
+ expect(screen.getByTestId('llm-observability-tabs')).toBeInTheDocument();
+ expect(screen.getByTestId('llm-observability-overview')).toBeInTheDocument();
+ expect(screen.getByText('LLM Observability')).toBeInTheDocument();
+ expect(screen.getByRole('tab', { name: 'Overview' })).toBeInTheDocument();
+ expect(
+ screen.getByRole('tab', { name: 'Model pricing' }),
+ ).toBeInTheDocument();
+ });
+
+ it('navigates to the configuration route when the Model pricing tab is clicked', async () => {
+ const user = userEvent.setup({ pointerEventsCheck: 0 });
+ render(<LLMObservability />, undefined, {
+ initialRoute: ROUTES.LLM_OBSERVABILITY_OVERVIEW,
+ });
+
+ await user.click(screen.getByRole('tab', { name: 'Model pricing' }));
+
+ expect(safeNavigateMock).toHaveBeenCalledWith(
+ ROUTES.LLM_OBSERVABILITY_CONFIGURATION,
+ );
+ });
+
+ it('renders the model-pricing page on the configuration route', async () => {
+ setupList();
+ render(<LLMObservability />, undefined, {
+ initialRoute: ROUTES.LLM_OBSERVABILITY_CONFIGURATION,
+ });
+
+ await waitFor(() =>
+ expect(
+ screen.getByTestId('llm-observability-model-pricing-page'),
+ ).toBeInTheDocument(),
+ );
+ });
+});
diff --git a/frontend/src/container/LLMObservability/hooks/useLLMObservabilityTabs.tsx b/frontend/src/container/LLMObservability/hooks/useLLMObservabilityTabs.tsx
new file mode 100644
index 0000000000..85f0bce638
--- /dev/null
+++ b/frontend/src/container/LLMObservability/hooks/useLLMObservabilityTabs.tsx
@@ -0,0 +1,52 @@
+import { useCallback } from 'react';
+import { useLocation } from 'react-router-dom';
+import { type TabItemProps } from '@signozhq/ui/tabs';
+import ROUTES from 'constants/routes';
+import { useSafeNavigate } from 'hooks/useSafeNavigate';
+
+import Overview from '../Overview/Overview';
+import LLMObservabilityModelPricing from '../Settings/ModelPricing/LLMObservabilityModelPricing';
+
+const OVERVIEW_KEY = ROUTES.LLM_OBSERVABILITY_OVERVIEW;
+const CONFIGURATION_KEY = ROUTES.LLM_OBSERVABILITY_CONFIGURATION;
+
+interface UseLLMObservabilityTabsResult {
+ items: TabItemProps[];
+ activeTab: string;
+ onTabChange: (key: string) => void;
+}
+
+// Drives the top-level LLM Observability tabs. Route-driven: the active tab is
+// derived from the pathname (each tab owns a URL) and changing tabs navigates,
+// so tabs stay shareable/back-button friendly while rendering with the SigNoz
+// design-system Tabs.
+export function useLLMObservabilityTabs(): UseLLMObservabilityTabsResult {
+ const { pathname } = useLocation();
+ const { safeNavigate } = useSafeNavigate();
+
+ const activeTab = pathname.startsWith(CONFIGURATION_KEY)
+ ? CONFIGURATION_KEY
+ : OVERVIEW_KEY;
+
+ const onTabChange = useCallback(
+ (key: string): void => {
+ safeNavigate(key);
+ },
+ [safeNavigate],
+ );
+
+ const items: TabItemProps[] = [
+ {
+ key: OVERVIEW_KEY,
+ label: 'Overview',
+ children: <Overview />,
+ },
+ {
+ key: CONFIGURATION_KEY,
+ label: 'Model pricing',
+ children: <LLMObservabilityModelPricing />,
+ },
+ ];
+
+ return { items, activeTab, onTabChange };
+}
diff --git a/frontend/src/container/TopNav/DateTimeSelectionV2/constants.ts b/frontend/src/container/TopNav/DateTimeSelectionV2/constants.ts
index e6d445b8c3..683da78e59 100644
--- a/frontend/src/container/TopNav/DateTimeSelectionV2/constants.ts
+++ b/frontend/src/container/TopNav/DateTimeSelectionV2/constants.ts
@@ -203,8 +203,8 @@ export const routesToSkip = [
ROUTES.METER_EXPLORER_VIEWS,
ROUTES.METRICS_EXPLORER_VOLUME_CONTROL,
ROUTES.SOMETHING_WENT_WRONG,
- ROUTES.LLM_OBSERVABILITY_BASE,
- ROUTES.LLM_OBSERVABILITY_MODEL_PRICING,
+ ROUTES.LLM_OBSERVABILITY_OVERVIEW,
+ ROUTES.LLM_OBSERVABILITY_CONFIGURATION,
];
export const routesToDisable = [ROUTES.LOGS_EXPLORER, ROUTES.LIVE_LOGS];
diff --git a/frontend/src/pages/LLMObservabilityModelPricing/index.tsx b/frontend/src/pages/LLMObservabilityModelPricing/index.tsx
deleted file mode 100644
index f16339765b..0000000000
--- a/frontend/src/pages/LLMObservabilityModelPricing/index.tsx
+++ /dev/null
@@ -1,7 +0,0 @@
-import LLMObservabilityModelPricing from 'container/LLMObservability/Settings/ModelPricing/LLMObservabilityModelPricing';
-
-function LLMObservabilityModelPricingPage(): JSX.Element {
- return <LLMObservabilityModelPricing />;
-}
-
-export default LLMObservabilityModelPricingPage;
diff --git a/frontend/src/utils/permission/index.ts b/frontend/src/utils/permission/index.ts
index 23d80c8d82..541ade6344 100644
--- a/frontend/src/utils/permission/index.ts
+++ b/frontend/src/utils/permission/index.ts
@@ -137,5 +137,6 @@ export const routePermission: Record<keyof typeof ROUTES, ROLES[]> = {
MCP_SERVER: ['ADMIN', 'EDITOR', 'VIEWER'],
AI_ASSISTANT_BASE: ['ADMIN', 'EDITOR', 'VIEWER'],
LLM_OBSERVABILITY_BASE: ['ADMIN', 'EDITOR', 'VIEWER'],
- LLM_OBSERVABILITY_MODEL_PRICING: ['ADMIN', 'EDITOR', 'VIEWER'],
+ LLM_OBSERVABILITY_OVERVIEW: ['ADMIN', 'EDITOR', 'VIEWER'],
+ LLM_OBSERVABILITY_CONFIGURATION: ['ADMIN', 'EDITOR', 'VIEWER'],
};