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
docs(model_management.md): add section on adding additional model information to proxy config
Krrish Dholakia179dd7b893c1
diff --git a/docs/my-website/docs/proxy/model_management.md b/docs/my-website/docs/proxy/model_management.mdindex 02ce4ba23b6..a8cc66ae765 100644--- a/docs/my-website/docs/proxy/model_management.md+++ b/docs/my-website/docs/proxy/model_management.md@@ -17,7 +17,7 @@ model_list:## Get Model Information - `/model/info`-Retrieve detailed information about each model listed in the `/model/info` endpoint, including descriptions from the `config.yaml` file, and additional model info (e.g. max tokens, cost per input token, etc.) pulled the model_info you set and the litellm model cost map. Sensitive details like API keys are excluded for security purposes.+Retrieve detailed information about each model listed in the `/model/info` endpoint, including descriptions from the `config.yaml` file, and additional model info (e.g. max tokens, cost per input token, etc.) pulled from the model_info you set and the [litellm model cost map](https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json). Sensitive details like API keys are excluded for security purposes.<TabsdefaultValue="curl"@@ -35,22 +35,33 @@ curl -X GET "http://0.0.0.0:4000/model/info" \## Add a New Model-Add a new model to the list in the `config.yaml` by providing the model parameters. This allows you to update the model list without restarting the proxy.+Add a new model to the proxy via the `/model/new` API, to add models without restarting the proxy.-<Tabs- defaultValue="curl"- values={[- { label: 'cURL', value: 'curl', },- ]}>- <TabItem value="curl">+<Tabs>+<TabItem value="API">```bashcurl -X POST "http://0.0.0.0:4000/model/new" \- -H "accept: application/json" \- -H "Content-Type: application/json" \- -d '{ "model_name": "azure-gpt-turbo", "litellm_params": {"model": "azure/gpt-3.5-turbo", "api_key": "os.environ/AZURE_API_KEY", "api_base": "my-azure-api-base"} }'+ -H "accept: application/json" \+ -H "Content-Type: application/json" \+ -d '{ "model_name": "azure-gpt-turbo", "litellm_params": {"model": "azure/gpt-3.5-turbo", "api_key": "os.environ/AZURE_API_KEY", "api_base": "my-azure-api-base"} }'```- </TabItem>+</TabItem>+<TabItem value="Yaml">++```yaml+model_list:+ - model_name: gpt-3.5-turbo ### RECEIVED MODEL NAME ### `openai.chat.completions.create(model="gpt-3.5-turbo",...)`+ litellm_params: # all params accepted by litellm.completion() - https://github.com/BerriAI/litellm/blob/9b46ec05b02d36d6e4fb5c32321e51e7f56e4a6e/litellm/types/router.py#L297+ model: azure/gpt-turbo-small-eu ### MODEL NAME sent to `litellm.completion()` ###+ api_base: https://my-endpoint-europe-berri-992.openai.azure.com/+ api_key: "os.environ/AZURE_API_KEY_EU" # does os.getenv("AZURE_API_KEY_EU")+ rpm: 6 # [OPTIONAL] Rate limit for this deployment: in requests per minute (rpm)+ model_info:+ my_custom_key: my_custom_value # additional model metadata+```++</TabItem></Tabs>@@ -85,4 +96,83 @@ Keep in mind that as both endpoints are in [BETA], you may need to visit the ass- Get Model Information: [Issue #933](https://github.com/BerriAI/litellm/issues/933)- Add a New Model: [Issue #964](https://github.com/BerriAI/litellm/issues/964)-Feedback on the beta endpoints is valuable and helps improve the API for all users.\ No newline at end of file+Feedback on the beta endpoints is valuable and helps improve the API for all users.+++## Add Additional Model Information++If you want the ability to add a display name, description, and labels for models, just use `model_info:`++```yaml+model_list:+ - model_name: "gpt-4"+ litellm_params:+ model: "gpt-4"+ api_key: "os.environ/OPENAI_API_KEY"+ model_info: # 👈 KEY CHANGE+ my_custom_key: "my_custom_value"+```++### Usage++1. Add additional information to model++```yaml+model_list:+ - model_name: "gpt-4"+ litellm_params:+ model: "gpt-4"+ api_key: "os.environ/OPENAI_API_KEY"+ model_info: # 👈 KEY CHANGE+ my_custom_key: "my_custom_value"+```++2. Call with `/model/info`++Use a key with access to the model `gpt-4`.++```bash+curl -L -X GET 'http://0.0.0.0:4000/v1/model/info' \+-H 'Authorization: Bearer LITELLM_KEY' \+```++3. **Expected Response**++Returned `model_info = Your custom model_info + (if exists) LITELLM MODEL INFO`+++[**How LiteLLM Model Info is found**](https://github.com/BerriAI/litellm/blob/9b46ec05b02d36d6e4fb5c32321e51e7f56e4a6e/litellm/proxy/proxy_server.py#L7460)++[Tell us how this can be improved!](https://github.com/BerriAI/litellm/issues)++```bash+{+ "data": [+ {+ "model_name": "gpt-4",+ "litellm_params": {+ "model": "gpt-4"+ },+ "model_info": {+ "id": "e889baacd17f591cce4c63639275ba5e8dc60765d6c553e6ee5a504b19e50ddc",+ "db_model": false,+ "my_custom_key": "my_custom_value", # 👈 CUSTOM INFO+ "key": "gpt-4", # 👈 KEY in LiteLLM MODEL INFO/COST MAP - https://github.com/BerriAI/litellm/blob/main/model_prices_and_context_window.json+ "max_tokens": 4096,+ "max_input_tokens": 8192,+ "max_output_tokens": 4096,+ "input_cost_per_token": 3e-05,+ "input_cost_per_character": null,+ "input_cost_per_token_above_128k_tokens": null,+ "output_cost_per_token": 6e-05,+ "output_cost_per_character": null,+ "output_cost_per_token_above_128k_tokens": null,+ "output_cost_per_character_above_128k_tokens": null,+ "output_vector_size": null,+ "litellm_provider": "openai",+ "mode": "chat"+ }+ },+ ]+}+```diff --git a/litellm/proxy/_new_secret_config.yaml b/litellm/proxy/_new_secret_config.yamlindex 87a561e3183..dfa5c16520e 100644--- a/litellm/proxy/_new_secret_config.yaml+++ b/litellm/proxy/_new_secret_config.yaml@@ -1,7 +1,6 @@model_list:- - model_name: "*"+ - model_name: "gpt-4"litellm_params:- model: "*"--litellm_settings:- success_callback: ["langsmith"]\ No newline at end of file+ model: "gpt-4"+ model_info:+ my_custom_key: "my_custom_value"\ No newline at end of file