diff --git a/litellm/proxy/_types.py b/litellm/proxy/_types.py index 9b2bfbe2405f..d395ede7f318 100644 --- a/litellm/proxy/_types.py +++ b/litellm/proxy/_types.py @@ -332,6 +332,9 @@ class LiteLLMRoutes(enum.Enum): "/global/predict/spend/logs", "/global/spend/report", "/global/spend/provider", + "/global/spend/tags", + "/global/activity", + "/global/activity/model", ] public_routes = [ @@ -351,16 +354,10 @@ class LiteLLMRoutes(enum.Enum): "/key/update", "/key/delete", "/key/info", - "/global/spend/tags", - "/global/spend/keys", - "/global/spend/models", - "/global/spend/provider", - "/global/spend/end_users", - "/global/activity", - "/global/activity/model", ] + spend_tracking_routes + sso_only_routes + + global_spend_tracking_routes ) internal_user_view_only_routes = ( diff --git a/litellm/proxy/example_config_yaml/simple_config.yaml b/litellm/proxy/example_config_yaml/simple_config.yaml index 14b39a12518e..75b191efc846 100644 --- a/litellm/proxy/example_config_yaml/simple_config.yaml +++ b/litellm/proxy/example_config_yaml/simple_config.yaml @@ -1,4 +1,9 @@ model_list: - model_name: gpt-3.5-turbo litellm_params: - model: gpt-3.5-turbo \ No newline at end of file + model: gpt-3.5-turbo + - model_name: fake-gpt-3.5-turbo + litellm_params: + model: openai/gpt-3.5-turbo + api_key: fake-key + api_base: https://exampleopenaiendpoint-production.up.railway.app/ \ No newline at end of file diff --git a/litellm/proxy/proxy_config.yaml b/litellm/proxy/proxy_config.yaml index 69e6b52a38af..10bb7552045d 100644 --- a/litellm/proxy/proxy_config.yaml +++ b/litellm/proxy/proxy_config.yaml @@ -1,27 +1,28 @@ model_list: - - model_name: gpt-3.5-turbo + - model_name: fake-gpt-3.5-turbo litellm_params: model: openai/gpt-3.5-turbo - api_key: os.environ/OPENAI_API_KEY + api_key: fake-key + api_base: https://exampleopenaiendpoint-production.up.railway.app/ + tags: ["teamB"] model_info: - supported_environments: ["development", "production", "staging"] - - model_name: gpt-4 + id: "team-b-model" + - model_name: rerank-english-v3.0 litellm_params: - model: openai/gpt-4 - api_key: os.environ/OPENAI_API_KEY - model_info: - supported_environments: ["production", "staging"] - - model_name: gpt-4o + model: cohere/rerank-english-v3.0 + api_key: os.environ/COHERE_API_KEY + - model_name: llava-hf litellm_params: - model: openai/gpt-4o - api_key: os.environ/OPENAI_API_KEY + model: openai/llava-hf/llava-v1.6-vicuna-7b-hf + api_base: http://localhost:8000 + api_key: fake-key model_info: - supported_environments: ["production"] + supports_vision: True litellm_settings: cache: true - callbacks: ["otel"] + # callbacks: ["otel"] general_settings: diff --git a/tests/proxy_admin_ui_tests/e2e_ui_tests/internal_user_create_key.spec.ts b/tests/proxy_admin_ui_tests/e2e_ui_tests/internal_user_create_key.spec.ts new file mode 100644 index 000000000000..73b594cbfdcc --- /dev/null +++ b/tests/proxy_admin_ui_tests/e2e_ui_tests/internal_user_create_key.spec.ts @@ -0,0 +1,61 @@ +/* + +Login to Admin UI +Basic UI Test + +Click on all the tabs ensure nothing is broken +*/ + +import { test, expect } from '@playwright/test'; + +test('internal user', async ({ page }) => { + // Go to the specified URL + await page.goto('http://localhost:4000/ui'); + + // Enter "internal user id" in the username input field + await page.fill('input[name="username"]', 'sw12@berri.ai'); + + // Enter "gm" in the password input field + await page.fill('input[name="password"]', 'gm'); + + // Optionally, you can add an assertion to verify the login button is enabled + const loginButton = page.locator('input[type="submit"]'); + await expect(loginButton).toBeEnabled(); + + // Optionally, you can click the login button to submit the form + await loginButton.click(); + + + // Create a new key for the user + // click on span '+ Create New Key' + + await page.locator('span:has-text("+ Create New Key")').click(); + + + // set a random string for input where id="key_alias" + const key_alias = Math.random().toString(36).slice(-8); + await page.locator('input#key_alias').fill('key_alias' + key_alias); + + // select model = "fake-gpt-3.5-turbo" for the + // Select the model "fake-gpt-3.5-turbo" + await page.click('#models'); // Open the select dropdown + await page.click('div[title="fake-gpt-3.5-turbo"]'); // Select the specific option + + // click this button + await page.click('button[type="submit"]'); + + // store the content under here as "key" -
sk-9vEIOyLVd2Hmjrif9DQHJA
+ const key = await page.textContent('pre'); + + console.log(key); + + + + + + + + + + +}); diff --git a/tests/proxy_admin_ui_tests/e2e_ui_tests/internal_user_view_usage.spec.ts b/tests/proxy_admin_ui_tests/e2e_ui_tests/internal_user_view_usage.spec.ts new file mode 100644 index 000000000000..c703ea0b20b3 --- /dev/null +++ b/tests/proxy_admin_ui_tests/e2e_ui_tests/internal_user_view_usage.spec.ts @@ -0,0 +1,45 @@ +/* + +Login to Admin UI +Basic UI Test + +Click on all the tabs ensure nothing is broken +*/ + +import { test, expect } from '@playwright/test'; + +test('internal user', async ({ page }) => { + // Go to the specified URL + await page.goto('http://localhost:4000/ui'); + + // Enter "internal user id" in the username input field + await page.fill('input[name="username"]', 'sw12@berri.ai'); + + // Enter "gm" in the password input field + await page.fill('input[name="password"]', 'gm'); + + // Optionally, you can add an assertion to verify the login button is enabled + const loginButton = page.locator('input[type="submit"]'); + await expect(loginButton).toBeEnabled(); + + // Optionally, you can click the login button to submit the form + await loginButton.click(); + + // Navigate to the 'Usage' tab + const usageTab = page.locator('p.text-tremor-default.text-tremor-content.dark\\:text-dark-tremor-content', { hasText: 'Usage' }); + await usageTab.click(); + + // wait 3 seconds + await page.waitForTimeout(1000); + + + + + + + + + + + +});