Skip to content

[Feature]: selecting returned model_info fields in /model/info endpoint. #16878

@larcane97

Description

@larcane97

The Feature

i want to only expose selected fields in model_info in /model/info apis.

current model_info response seems like

  {
      "model_name": "gpt-4o-mini",
      "litellm_params": {
        "use_in_pass_through": false,
        "use_litellm_proxy": false,
        "merge_reasoning_content_in_choices": false,
        "model": "openai/gpt-4o-mini"
      },
      "model_info": {
        "id": "--",
        "db_model": false,
        "key": "gpt-4o-mini",
        "max_tokens": 16384,
        "max_input_tokens": 128000,
        "max_output_tokens": 16384,
        "input_cost_per_token": 1.5e-7,
        "input_cost_per_token_flex": null,
        "input_cost_per_token_priority": 2.5e-7,
        "cache_creation_input_token_cost": null,
        "cache_read_input_token_cost": 7.5e-8,
        "cache_read_input_token_cost_flex": null,
        "cache_read_input_token_cost_priority": 1.25e-7,
        "cache_creation_input_token_cost_above_1hr": null,
        "input_cost_per_character": null,
        "input_cost_per_token_above_128k_tokens": null,
        "input_cost_per_token_above_200k_tokens": null,
        "input_cost_per_query": null,
        "input_cost_per_second": null,
        "input_cost_per_audio_token": null,
        "input_cost_per_token_batches": 7.5e-8,
        "output_cost_per_token_batches": 3e-7,
        "output_cost_per_token": 6e-7,
        "output_cost_per_token_flex": null,
        "output_cost_per_token_priority": 0.000001,
        "output_cost_per_audio_token": null,
        "output_cost_per_character": null,
        "output_cost_per_reasoning_token": null,
        "output_cost_per_token_above_128k_tokens": null,
        "output_cost_per_character_above_128k_tokens": null,
        "output_cost_per_token_above_200k_tokens": null,
        "output_cost_per_second": null,
        "output_cost_per_video_per_second": null,
        "output_cost_per_image": null,
        "output_vector_size": null,
        "citation_cost_per_token": null,
        "tiered_pricing": null,
        "litellm_provider": "openai",
        "mode": "chat",
        "supports_system_messages": true,
        "supports_response_schema": true,
        "supports_vision": true,
        "supports_function_calling": true,
        "supports_tool_choice": true,
        "supports_assistant_prefill": null,
        "supports_prompt_caching": true,
        "supports_audio_input": null,
        "supports_audio_output": null,
        "supports_pdf_input": true,
        "supports_embedding_image_input": null,
        "supports_native_streaming": null,
        "supports_web_search": null,
        "supports_url_context": null,
        "supports_reasoning": null,
        "supports_computer_use": null,
        "search_context_cost_per_query": null,
        "tpm": null,
        "rpm": null,
        "ocr_cost_per_page": null,
        "annotation_cost_per_page": null,
        "supported_openai_params": [
          "frequency_penalty",
          "logit_bias",
          "logprobs",
          "top_logprobs",
          "max_tokens",
          "max_completion_tokens",
          "modalities",
          "prediction",
          "n",
          "presence_penalty",
          "seed",
          "stop",
          "stream",
          "stream_options",
          "temperature",
          "top_p",
          "tools",
          "tool_choice",
          "function_call",
          "functions",
          "max_retries",
          "extra_headers",
          "parallel_tool_calls",
          "audio",
          "web_search_options",
          "service_tier",
          "safety_identifier",
          "response_format"
        ]
      }
    }

but in some usecases, it could be too verbose and too large.
so i want to select only fields that i want to expose to the api caller.

if i send a request like http://localhost:4000/model/info?model_info_fields=key,mode
i expect that i receive the response like that

  {
      "model_name": "gpt-4o-mini",
      "litellm_params": {
        "use_in_pass_through": false,
        "use_litellm_proxy": false,
        "merge_reasoning_content_in_choices": false,
        "model": "openai/gpt-4o-mini"
      },
      "model_info": {
        "key": "gpt-4o-mini",
        "mode": "chat",
      }
    }

and also it would be good to be able to have a option returning litellm_params or not.

like, http://localhost:4000/model/info?model_info_fields=key,mode&return_litellm_params=false

i don't think its a best practice but i just want to pick only few fields in it.

Motivation, pitch

i want to expose only few fields in /model/info api to the caller

LiteLLM is hiring a founding backend engineer, are you interested in joining us and shipping to all our users?

No

Twitter / LinkedIn details

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions