Skip to content

[FEATURE]: Add LiteLLM as a provider #48938

Description

@jsilvermist

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Same as #22212 but opening a new issue as requested by GitHub Actions bot.

Users who run LiteLLM as a proxy for 100+ LLM providers can't point opencode at it. They have to configure each provider individually even when LiteLLM already provides a unified OpenAI-compatible endpoint.

It has the standard OpenAI discovery endpoint:

/v1/models

{
  "data": [
    {
      "id": "claude-fable-5-1",
      "object": "model",
      "created": 1677610602,
      "owned_by": "openai"
    },
    {
      "id": "deepseek-flash",
      "object": "model",
      "created": 1677610602,
      "owned_by": "openai",
      "mode": "chat",
      "max_input_tokens": 1000000,
      "max_output_tokens": 393216
    },
    ...
  ],
  "object": "list"
}

And the much more descriptive model info discovery endpoint:

/model/info

{
  "data": [
    {
      "model_name": "claude-fable-5-1",
      "litellm_params": {
        "litellm_credential_name": "anthropic",
        "allow_client_keepalive_override": false,
        "use_in_pass_through": false,
        "use_litellm_proxy": false,
        "use_xai_oauth": false,
        "merge_reasoning_content_in_choices": false,
        "model": "anthropic/claude-fable-5-1",
        "reasoning_effort": "high"
      },
      "model_info": {
        "id": "a4f4e83c4b403c4592f50403e15a97e90128048bcc1308301b1bb8118cf27906",
        "db_model": false,
        "access_via_team_ids": [],
        "direct_access": true,
        "key": "claude-fable-5-1",
        "max_tokens": 128000,
        "max_input_tokens": 1000000,
        "max_output_tokens": 128000,
        "input_cost_per_token": 0.00001,
        "input_cost_per_token_flex": null,
        "input_cost_per_token_priority": null,
        "input_cost_per_token_ultrafast": null,
        "cache_creation_input_token_cost": 0.0000125,
        "cache_creation_input_token_cost_above_200k_tokens": null,
        "cache_creation_input_token_cost_above_272k_tokens": null,
        "cache_creation_input_token_cost_above_272k_tokens_priority": null,
        "cache_creation_input_token_cost_above_272k_tokens_flex": null,
        "cache_creation_input_token_cost_flex": null,
        "cache_creation_input_token_cost_priority": null,
        "cache_creation_input_token_cost_ultrafast": null,
        "cache_read_input_token_cost": 2.5E-7,
        "prompt_cache_min_tokens": 512,
        "cache_read_input_token_cost_above_200k_tokens": null,
        "cache_read_input_token_cost_above_200k_tokens_priority": null,
        "cache_read_input_token_cost_above_272k_tokens": null,
        "cache_read_input_token_cost_above_272k_tokens_priority": null,
        "cache_read_input_token_cost_above_272k_tokens_flex": null,
        "cache_read_input_token_cost_above_512k_tokens": null,
        "cache_read_input_token_cost_flex": null,
        "cache_read_input_token_cost_priority": null,
        "cache_read_input_token_cost_ultrafast": null,
        "cache_creation_input_token_cost_above_1hr": 0.00002,
        "input_cost_per_character": null,
        "input_cost_per_token_above_128k_tokens": null,
        "input_cost_per_token_above_200k_tokens": null,
        "input_cost_per_token_above_200k_tokens_priority": null,
        "input_cost_per_token_above_272k_tokens": null,
        "input_cost_per_token_above_272k_tokens_priority": null,
        "input_cost_per_token_above_272k_tokens_flex": null,
        "input_cost_per_token_above_512k_tokens": null,
        "input_cost_per_query": null,
        "input_cost_per_second": null,
        "input_cost_per_audio_token": null,
        "input_cost_per_image_token": null,
        "input_cost_per_video_token": null,
        "input_cost_per_image": null,
        "input_cost_per_audio_per_second": null,
        "input_cost_per_video_per_second": null,
        "input_cost_per_token_batches": null,
        "output_cost_per_token_batches": null,
        "output_cost_per_token": 0.00005,
        "output_cost_per_token_flex": null,
        "output_cost_per_token_priority": null,
        "output_cost_per_token_ultrafast": null,
        "regional_processing_uplift_multiplier_eu": null,
        "regional_processing_uplift_multiplier_us": null,
        "regional_endpoint_uplift_multiplier": null,
        "output_cost_per_audio_token": null,
        "output_cost_per_character": null,
        "output_cost_per_reasoning_token": null,
        "output_cost_per_reasoning_token_flex": null,
        "output_cost_per_reasoning_token_priority": 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_token_above_200k_tokens_priority": null,
        "output_cost_per_token_above_272k_tokens": null,
        "output_cost_per_token_above_272k_tokens_priority": null,
        "output_cost_per_token_above_272k_tokens_flex": null,
        "output_cost_per_token_above_512k_tokens": null,
        "output_cost_per_second": null,
        "output_cost_per_second_1080p": null,
        "output_cost_per_video_per_second": null,
        "output_cost_per_image": null,
        "output_cost_per_image_token": null,
        "output_cost_per_video_token": null,
        "output_vector_size": null,
        "citation_cost_per_token": null,
        "tiered_pricing": null,
        "litellm_provider": "anthropic",
        "mode": "chat",
        "supports_system_messages": null,
        "supports_response_schema": true,
        "supports_vision": true,
        "supports_function_calling": true,
        "supports_tool_choice": true,
        "supports_assistant_prefill": false,
        "supports_prompt_caching": true,
        "supports_prompt_cache_breakpoint": null,
        "supports_audio_input": null,
        "supports_audio_output": null,
        "supports_pdf_input": true,
        "supports_embedding_image_input": null,
        "supports_native_streaming": null,
        "supports_native_structured_output": true,
        "supports_web_search": null,
        "supports_url_context": null,
        "supports_reasoning": true,
        "supports_adaptive_thinking": true,
        "thinking_always_on": true,
        "supports_tool_search": null,
        "supports_mid_conversation_system": true,
        "supports_none_reasoning_effort": null,
        "supports_minimal_reasoning_effort": null,
        "supports_low_reasoning_effort": null,
        "supports_xhigh_reasoning_effort": true,
        "supports_max_reasoning_effort": true,
        "bedrock_output_config_effort_ceiling": null,
        "bedrock_converse_supports_strict_tools": null,
        "supports_computer_use": true,
        "search_context_cost_per_query": {
          "search_context_size_high": 0.01,
          "search_context_size_low": 0.01,
          "search_context_size_medium": 0.01
        },
        "web_search_billing_unit": null,
        "tpm": null,
        "rpm": null,
        "ocr_cost_per_page": null,
        "ocr_cost_per_credit": null,
        "annotation_cost_per_page": null,
        "provider_specific_entry": {
          "us": 1.1
        },
        "uses_embed_content": null,
        "supports_image_size": null,
        "supported_openai_params": [
          "stream",
          "stop",
          "temperature",
          "top_p",
          "max_tokens",
          "max_completion_tokens",
          "tools",
          "tool_choice",
          "extra_headers",
          "parallel_tool_calls",
          "response_format",
          "user",
          "web_search_options",
          "speed",
          "context_management",
          "cache_control",
          "thinking",
          "reasoning_effort"
        ]
      }
    },
    {
      "model_name": "deepseek-flash",
      "litellm_params": {
        "litellm_credential_name": "deepseek",
        "allow_client_keepalive_override": false,
        "use_in_pass_through": false,
        "use_litellm_proxy": false,
        "use_xai_oauth": false,
        "merge_reasoning_content_in_choices": false,
        "model": "deepseek/deepseek-v4-flash-vision-exp",
        "reasoning_effort": "high"
      },
      "model_info": {
        "id": "780e0333cf29e85230de2724a95d2613ebb25617b44adaeddeeebe5a64ac35d2",
        "db_model": false,
        "access_via_team_ids": [],
        "direct_access": true,
        "key": "deepseek/deepseek-v4-flash-vision-exp",
        "max_tokens": 393216,
        "max_input_tokens": 1000000,
        "max_output_tokens": 393216,
        "input_cost_per_token": 4.4E-7,
        "input_cost_per_token_flex": null,
        "input_cost_per_token_priority": null,
        "input_cost_per_token_ultrafast": null,
        "cache_creation_input_token_cost": 0.0,
        "cache_creation_input_token_cost_above_200k_tokens": null,
        "cache_creation_input_token_cost_above_272k_tokens": null,
        "cache_creation_input_token_cost_above_272k_tokens_priority": null,
        "cache_creation_input_token_cost_above_272k_tokens_flex": null,
        "cache_creation_input_token_cost_flex": null,
        "cache_creation_input_token_cost_priority": null,
        "cache_creation_input_token_cost_ultrafast": null,
        "cache_read_input_token_cost": 1.4E-8,
        "prompt_cache_min_tokens": null,
        "cache_read_input_token_cost_above_200k_tokens": null,
        "cache_read_input_token_cost_above_200k_tokens_priority": null,
        "cache_read_input_token_cost_above_272k_tokens": null,
        "cache_read_input_token_cost_above_272k_tokens_priority": null,
        "cache_read_input_token_cost_above_272k_tokens_flex": null,
        "cache_read_input_token_cost_above_512k_tokens": null,
        "cache_read_input_token_cost_flex": null,
        "cache_read_input_token_cost_priority": null,
        "cache_read_input_token_cost_ultrafast": null,
        "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_token_above_200k_tokens_priority": null,
        "input_cost_per_token_above_272k_tokens": null,
        "input_cost_per_token_above_272k_tokens_priority": null,
        "input_cost_per_token_above_272k_tokens_flex": null,
        "input_cost_per_token_above_512k_tokens": null,
        "input_cost_per_query": null,
        "input_cost_per_second": null,
        "input_cost_per_audio_token": null,
        "input_cost_per_image_token": null,
        "input_cost_per_video_token": null,
        "input_cost_per_image": null,
        "input_cost_per_audio_per_second": null,
        "input_cost_per_video_per_second": null,
        "input_cost_per_token_batches": null,
        "output_cost_per_token_batches": null,
        "output_cost_per_token": 0.00000132,
        "output_cost_per_token_flex": null,
        "output_cost_per_token_priority": null,
        "output_cost_per_token_ultrafast": null,
        "regional_processing_uplift_multiplier_eu": null,
        "regional_processing_uplift_multiplier_us": null,
        "regional_endpoint_uplift_multiplier": null,
        "output_cost_per_audio_token": null,
        "output_cost_per_character": null,
        "output_cost_per_reasoning_token": null,
        "output_cost_per_reasoning_token_flex": null,
        "output_cost_per_reasoning_token_priority": 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_token_above_200k_tokens_priority": null,
        "output_cost_per_token_above_272k_tokens": null,
        "output_cost_per_token_above_272k_tokens_priority": null,
        "output_cost_per_token_above_272k_tokens_flex": null,
        "output_cost_per_token_above_512k_tokens": null,
        "output_cost_per_second": null,
        "output_cost_per_second_1080p": null,
        "output_cost_per_video_per_second": null,
        "output_cost_per_image": null,
        "output_cost_per_image_token": null,
        "output_cost_per_video_token": null,
        "output_vector_size": null,
        "citation_cost_per_token": null,
        "tiered_pricing": null,
        "litellm_provider": "deepseek",
        "mode": "chat",
        "supports_system_messages": true,
        "supports_response_schema": true,
        "supports_vision": true,
        "supports_function_calling": true,
        "supports_tool_choice": true,
        "supports_assistant_prefill": true,
        "supports_prompt_caching": true,
        "supports_prompt_cache_breakpoint": null,
        "supports_audio_input": null,
        "supports_audio_output": null,
        "supports_pdf_input": null,
        "supports_embedding_image_input": null,
        "supports_native_streaming": true,
        "supports_native_structured_output": null,
        "supports_web_search": null,
        "supports_url_context": null,
        "supports_reasoning": true,
        "supports_adaptive_thinking": null,
        "thinking_always_on": null,
        "supports_tool_search": null,
        "supports_mid_conversation_system": null,
        "supports_none_reasoning_effort": null,
        "supports_minimal_reasoning_effort": null,
        "supports_low_reasoning_effort": null,
        "supports_xhigh_reasoning_effort": null,
        "supports_max_reasoning_effort": null,
        "bedrock_output_config_effort_ceiling": null,
        "bedrock_converse_supports_strict_tools": null,
        "supports_computer_use": null,
        "search_context_cost_per_query": null,
        "web_search_billing_unit": null,
        "tpm": null,
        "rpm": null,
        "ocr_cost_per_page": null,
        "ocr_cost_per_credit": null,
        "annotation_cost_per_page": null,
        "provider_specific_entry": null,
        "uses_embed_content": null,
        "supports_image_size": 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",
          "prompt_cache_key",
          "prompt_cache_retention",
          "store",
          "response_format",
          "thinking",
          "reasoning_effort"
        ]
      }
    },
    ...
  ]
}

Activity

  1. github-actions commented on Sep 14, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    If this is intentionally a re-open of that closed issue, please link it clearly and explain what has changed or why it was re-opened, so maintainers have the full context.

  2. el-AI-wei commented on Sep 14, 2026

    @el-AI-wei

    Seem like a no-brainer to have a provider which can consume LiteLLM’s /model/info metadata to get limits, costs, modalities, and capabilities. It seemed like PR 8359 addresses this and got stalled so I investigated:

    What Happened

    1. PR feat(opencode): add auto model detection for OpenAI-compatible providers #8359 (feat(opencode): add auto model detection for OpenAI-compatible providers #8359) initially implemented GET {baseURL}/models for @ai-sdk/openai-compatible providers.
    2. During review, several design questions appeared:
    • Should discovery be automatic or opt-in?
    • Should the endpoint merely add models, or filter Models.dev to the models the account can access?
    • How should authenticated endpoints be queried?
    • How long may discovery delay startup?
    • What happens when /models provides only an ID and no limits or capabilities?
    1. The implementation caused an E2E problem because OpenCode’s own endpoint exposed additional models. A test selected an unexpected model and was denied. The immediate workaround was to skip discovery for the opencode provider.
    2. On January 30, 2026, maintainer rekram1-node merged it into models-endpoint, not dev, saying:
      “Merging into a separate branch that I'll play with for a bit and see if tweaks are needed”
    3. That branch then received two commits named wip. One changed discovery toward filtering known models and left adding unknown endpoint models unfinished.
    4. PR add models endpoint #13234 (add models endpoint #13234) was opened to merge models-endpoint into dev. It received no maintainer review and became increasingly stale.
    5. On May 15, PR add models endpoint #13234 was automatically closed because it was older than one month and had fewer than two positive reactions.

    Why It Stalled

    The fundamental issue was that /v1/models discovery solves only part of the problem.
    The standard response usually provides:

    {
      "id": "model-name",
      "object": "model",
      "owned_by": "..."
    }
    

    That does not provide the information OpenCode relies on for:

    • Context and output limits
    • Costs
    • Vision and PDF support
    • Reasoning capabilities
    • Tool support
    • Temperature support
    • Provider-specific transport behavior

    That deficiency was explicitly raised on both #8359 and #13234. It is exactly why generic discovery would not have removed your need for the /.well-known/ metadata.

    Other unresolved concerns were:

    • Whether inaccessible Models.dev models should be hidden
    • Whether configured models should survive if discovery fails
    • Authentication availability during config/provider initialization
    • Startup delays from unreachable endpoints
    • Automatic outbound requests to arbitrary custom URLs
    • Unknown models receiving context: 0, output: 0, and conservative capability default

    There Were Follow-Ups

    Notable examples:

    There were also several provider-specific implementations. Modal, GitLab, Ollama, and vLLM discovery work has been accepted in various forms, while the generic custom-provider implementation remains unresolved.

    I now see #29937 as something to watch as it consumes LiteLLM /model/info. Generic discovery PRs would still leave you needing the remote model metadata.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions