worker-vllm

runpod-workersMIT活跃维护

基于 vLLM 的 Runpod 无服务器 worker 模板,用于快速部署大语言模型推理端点,省去自己搭建服务的工作。

The Runpod worker template for serving our large language model endpoints. Powered by vLLM.

v2.30.3发布于 2026-11-05 20:32 UTC474star395fork同步于 2026-11-10 11:59 UTC

怎么上手

由 README 提炼,执行前请确认
docker pull runpod/worker-v1-vllm:<version>
硬件要求按 README 说明

README 未说明具体显存要求;GPU 数量由 TENSOR_PARALLEL_SIZE 控制,默认 1,GPU 显存占用比例由 GPU_MEMORY_UTILIZATION 控制,默认 0.9;CUDA 兼容性继承构建时所用 vllm/vllm-openai 基础镜像的 CUDA 运行时。

需要 CUDA多卡 / 张量并行
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

在 Runpod Serverless 上一键部署兼容 OpenAI 接口的 vLLM 推理端点

基于 vLLM 的 Runpod 无服务器 worker 模板,用于快速部署大语言模型推理端点,省去自己搭建服务的工作。

核心能力

  • 基于 vLLM 引擎提供 OpenAI 兼容的 Chat Completions、Models、Responses、Messages 路由
  • 通过环境变量把 vllm serve 参数自动转换为 CLI 标志
  • 支持用 VLLM_EXTRA_ARGS 追加任意 vllm serve 参数
  • 支持用 config.yaml 提供完整的 vllm serve 配置
  • 支持流式与非流式请求,并可用 TENSOR_PARALLEL_SIZE 做多卡张量并行

容易踩的坑

需要先在 Runpod 上部署 Serverless Endpoint,并把 base_url 改成 https://api.runpod.ai/v2//openai/v1;gated 或私有模型需要设置 HF_TOKEN;模型没有内置 chat template 时,需要通过 CUSTOM_CHAT_TEMPLATE 指定。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本v2.30.3
  1. v2.30.3最新正式版2026-11-05 · 2026-11-05 20:32 UTC

    What's Changed

    New Contributors

    Full Changelog: https://github.com/runpod-workers/worker-vllm/compare/v2.30.2...v2.30.3

  2. v2.30.22026-11-03 · 2026-11-03 01:05 UTC
    查看更新说明

    What's Changed

    Full Changelog: https://github.com/runpod-workers/worker-vllm/compare/v2.30.1...v2.30.2

  3. v2.30.12026-10-22 · 2026-10-22 05:59 UTC
    查看更新说明

    What's Changed

    Full Changelog: https://github.com/runpod-workers/worker-vllm/compare/v2.30.0...v2.30.1

  4. v2.30.02026-10-21 · 2026-10-21 16:32 UTC
    查看更新说明

    What's Changed

    Full Changelog: https://github.com/runpod-workers/worker-vllm/compare/v2.29.0...v2.30.0

  5. v2.29.02026-10-07 · 2026-10-07 01:29 UTC
    查看更新说明

    What's Changed

    New Contributors

    Full Changelog: https://github.com/runpod-workers/worker-vllm/compare/v2.28.0...v2.29.0

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    OpenAI-Compatible vLLM Serverless Endpoint Worker

    Deploy OpenAI-Compatible Blazing-Fast LLM Endpoints powered by the vLLM Inference Engine on Runpod Serverless with just a few clicks.

    vLLM worker banner

    Current vLLM version: 0.32.0

    Want a load balancing endpoint (direct HTTP, no job queue)? You don't need this worker — deploy the official vLLM image as-is. See Option 3: Load Balancing with the vLLM Image.

    Table of Contents

    Setting up the Serverless Worker

    Option 1: Deploy Any Model Using Pre-Built Docker Image [Recommended]

    🚀 Deploy Guide: Follow our step-by-step deployment guide to deploy using the Runpod Console.

    📦 Docker Image: runpod/worker-v1-vllm:<version>

    Configuration

    Configure worker-vllm using environment variables:

    Environment VariableDescriptionDefaultOptions
    MODEL_NAMEPath of the model weightsLocal folder or Hugging Face repo ID
    HF_TOKENHuggingFace access token for gated/private modelsYour HuggingFace access token
    MAX_MODEL_LENModel's maximum context lengthInteger (e.g., 4096)
    QUANTIZATIONQuantization method"awq", "gptq", "squeezellm", "bitsandbytes"
    TENSOR_PARALLEL_SIZENumber of GPUs1Integer
    GPU_MEMORY_UTILIZATIONFraction of GPU memory to use0.9Float between 0.0 and 1.0
    MAX_NUM_SEQSMaximum number of sequences per iteration256Integer
    CUSTOM_CHAT_TEMPLATECustom chat template overrideJinja2 template string
    ENABLE_AUTO_TOOL_CHOICEEnable automatic tool selectionfalseboolean (true or false)
    TOOL_CALL_PARSERParser for tool calls"mistral", "hermes", "llama3_json", "granite", "deepseek_v3", etc.
    OPENAI_SERVED_MODEL_NAME_OVERRIDEOverride served model name in APIString
    MAX_CONCURRENCYMaximum concurrent requests30Integer

    Pass any vLLM engine arg as an environment variable: the worker translates env vars into vllm serve CLI flags. Any env var whose name is the UPPERCASED form of a vllm serve flag is applied automatically:

    Environment VariablevLLM CLI FlagExample Value
    MAX_MODEL_LEN--max-model-len4096
    ENFORCE_EAGER--enforce-eagertrue
    ENABLE_CHUNKED_PREFILL--enable-chunked-prefilltrue
    SPECULATIVE_CONFIG--speculative-config'{"model": "org/draft", "num_speculative_tokens": 3}'

    Backward-compat aliases are also honored: MODEL_NAME (--model), MODEL_REVISION (--revision), TOKENIZER_NAME (--tokenizer), OPENAI_SERVED_MODEL_NAME_OVERRIDE (--served-model-name), CUSTOM_CHAT_TEMPLATE (--chat-template).

    Values are passed straight through to vLLM (ints, floats, JSON blobs all work). For anything not recognized — e.g. a flag newer than the worker's list — use the ultimate escape hatch, whose contents are appended verbatim to the vllm serve command (and override earlier settings):

    VLLM_EXTRA_ARGS="--override-generation-config '{\"max_new_tokens\": 512}' --uvicorn-log-level warning"
    

    Configuration File (config.yaml)

    As an alternative to environment variables, you can supply a complete vllm serve --config file using the CLI key names (hyphens or underscores both work):

    model: meta-llama/Llama-3.1-8B-Instruct
    max-model-len: 8192
    gpu-memory-utilization: 0.90
    quantization: awq
    tensor-parallel-size: 2
    

    Mount the file anywhere into the container and point the VLLM_CONFIG_FILE env var at it. CLI flags built from environment variables take precedence over config file values (standard vllm serve behavior).

    For the complete list of all available environment variables, examples, and detailed descriptions: Configuration

    When vLLM will not start

    Some startup failures a restart cannot fix: the model does not fit the GPU, MAX_MODEL_LEN is larger than the KV cache the GPU can hold, a flag or value vLLM rejects, a gated model without HF_TOKEN, a model that requires repository-provided code without TRUST_REMOTE_CODE=true, a model whose own vLLM code states a requirement this worker's GPU or settings don't meet (for example the FlashInfer attention backend, or a newer GPU generation). Exiting on those crash-loops the worker: each attempt repeats the startup (for most of these, the download and the model load), and submitted jobs receive no result.

    The worker recognises these and stays up instead, answering every job with the cause and the fix:

    {
      "error": {
        "message": "Qwen/Qwen3-30B-A3B ran out of GPU memory during startup. This GPU has 19.57 GiB. Lower MAX_MODEL_LEN or MAX_NUM_SEQS, set ENFORCE_EAGER=true to skip CUDA graph capture, use a quantized checkpoint, or redeploy on a larger GPU (or more GPUs with TENSOR_PARALLEL_SIZE). ...",
        "type": "startup_error",
        "code": null
      }
    }
    

    The same message is logged by the worker, and the full vLLM traceback stays in the worker logs above it. Anything unrecognised still exits non-zero, because a failed download or a bad host is worth another attempt; before exiting, the worker answers one queued job with a prestart_failed error that carries the end of vLLM's output, so the failure is visible without opening the logs. For model code (vllm/model_executor/models/, vllm/models/), only an error whose message states a requirement ("requires", "only supports", "not supported on") counts; any other error there, and any failed start that shows a CUDA, NCCL, NVML, cuBLAS/cuDNN, ECC or Xid fault, still restarts. A requirement can depend on the GPU type, so on an endpoint that lists several, a worker on a GPU the model can't use answers jobs with the cause instead of leaving them to a worker that can: remove those GPU types from the endpoint.

    Startup runs in a RunPod prestart hook. Jobs stay queued while the model loads, so their execution timeout does not start during the cold start.

    Option 2: Build Docker Image with Model Inside

    To build an image with the model baked in, you must specify the following docker arguments when building the image.

    Prerequisites

    • Docker

    Arguments

    • Required
      • MODEL_NAME
    • Optional
      • MODEL_REVISION: Model revision to load (default: main).
      • VLLM_VERSION: Tag of the official vllm/vllm-openai base image to use (default: v0.23.0).
      • BASE_PATH: Storage directory where huggingface cache and model will be located, along with vLLM's torch.compile cache ($BASE_PATH/vllm-cache). (default: /runpod-volume, which will utilize network storage if you attach it or create a local directory within the image if you don't. If your intention is to bake the model into the image, you should set this to something like /models to make sure there are no issues if you were to accidentally attach network storage.)
      • QUANTIZATION
      • TOKENIZER_NAME: Tokenizer repository if you would like to use a different tokenizer than the one that comes with the model. (default: None, which uses the model's tokenizer)
      • TOKENIZER_REVISION: Tokenizer revision to load (default: main).

    For the remaining settings, you may apply them as environment variables when running the container. Supported environment variables are listed in the Environment Variables section.

    Example: Building an image with OpenChat-3.5

    docker build -t username/image:tag --build-arg MODEL_NAME="openchat/openchat_3.5" --build-arg BASE_PATH="/models" .
    

    Example: Choosing the vLLM Version

    The image is based on the official vllm/vllm-openai image; switching vLLM versions is a single build arg:

    docker build -t username/image:tag --build-arg VLLM_VERSION=v0.10.0 --build-arg MODEL_NAME="meta-llama/Llama-3.1-8B-Instruct" .
    

    To run a nightly vLLM build, point VLLM_VERSION at a nightly tag or use latest at your own risk.

    (Optional) Including Huggingface Token

    If the model you would like to deploy is private or gated, you will need to include it during build time as a Docker secret, which will protect it from being exposed in the image and on DockerHub.

    1. Enable Docker BuildKit (required for secrets).
    export DOCKER_BUILDKIT=1
    
    1. Export your Hugging Face token as an environment variable
    export HF_TOKEN="your_token_here"
    
    1. Add the token as a secret when building
    docker build -t username/image:tag --secret id=HF_TOKEN --build-arg MODEL_NAME="openchat/openchat_3.5" .
    

    Option 3: Load Balancing with the vLLM Image

    If you want a load balancing endpoint — requests routed directly to workers over HTTP, with no job queue — you don't need this worker. The official vllm/vllm-openai image already serves every vLLM route (/v1/chat/completions, /v1/completions, /v1/models, embeddings, etc.) plus health checks, so you can deploy it as-is:

    1. Create a new Serverless endpoint and set the Endpoint Type to Load Balancer.

    2. Use vllm/vllm-openai:<version> as the container image (pin a version rather than latest).

    3. Set the container start args to vllm serve arguments — at minimum --model, plus any other vLLM flags:

      --model meta-llama/Llama-3.1-8B-Instruct --max-model-len 8192
      
    4. Configure the endpoint:

      • Set PORT=8000 as an environment variable and expose 8000/http under Expose HTTP Ports (vLLM serves on 8000 by default).
      • Set HF_TOKEN if your model is gated/private.
      • vLLM already serves the load balancer's default /ping health check (and /health); no extra configuration is needed. To use a different path, set HEALTH_CHECK_PATH.
    5. Once a worker is healthy, call any vLLM route directly at https://<ENDPOINT_ID>.api.runpod.ai/<PATH>. The model field is the repo passed to --model (unless you also set --served-model-name):

      curl https://<ENDPOINT_ID>.api.runpod.ai/v1/chat/completions \
        -H "Authorization: Bearer <RUNPOD_API_KEY>" \
        -H "Content-Type: application/json" \
        -d '{
          "model": "meta-llama/Llama-3.1-8B-Instruct",
          "messages": [{"role": "user", "content": "Hello!"}]
        }'
      

    Note that load balancing endpoints have no queue: a request that arrives before any worker is ready returns an error instead of waiting, so clients should retry through cold starts. See the load balancing docs for health check semantics, cold-start handling, and scaling behavior.

    Compatible Model Architectures

    You can deploy any model on Hugging Face that is supported by vLLM. For the complete and up-to-date list of supported model architectures, see the vLLM Supported Models documentation.

    Usage: OpenAI Compatibility

    The vLLM Worker is fully compatible with OpenAI's API, and you can use it with any OpenAI Codebase by changing only 3 lines in total. The supported routes are Chat Completions, Models, Responses, and Messages - with both streaming and non-streaming.

    Modifying your OpenAI Codebase to use your deployed vLLM Worker

    Python (similar to Node.js, etc.):

    1. When initializing the OpenAI Client in your code, change the api_key to your Runpod API Key and the base_url to your Runpod Serverless Endpoint URL in the following format: https://api.runpod.ai/v2/<YOUR ENDPOINT ID>/openai/v1, filling in your deployed endpoint ID. For example, if your Endpoint ID is abc1234, the URL would be https://api.runpod.ai/v2/abc1234/openai/v1.

      • Before:
      from openai import OpenAI
      
      client = OpenAI(api_key=os.environ.get("OPENAI_API_KEY"))
      
      • After:
      from openai import OpenAI
      
      client = OpenAI(
          api_key=os.environ.get("RUNPOD_API_KEY"),
          base_url="https://api.runpod.ai/v2/<YOUR ENDPOINT ID>/openai/v1",
      )
      
    2. Change the model parameter to your deployed model's name whenever using Completions or Chat Completions.

      • Before:
      response = client.chat.completions.create(
          model="gpt-3.5-turbo",
          messages=[{"role": "user", "content": "Why is Runpod the best platform?"}],
          temperature=0,
          max_tokens=100,
      )
      
      • After:
      response = client.chat.completions.create(
          model="<YOUR DEPLOYED MODEL REPO/NAME>",
          messages=[{"role": "user", "content": "Why is Runpod the best platform?"}],
          temperature=0,
          max_tokens=100,
      )
      

    Using http requests:

    1. Change the Authorization header to your Runpod API Key and the url to your Runpod Serverless Endpoint URL in the following format: https://api.runpod.ai/v2/<YOUR ENDPOINT ID>/openai/v1
      • Before:
      curl https://api.openai.com/v1/chat/completions \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer $OPENAI_API_KEY" \
      -d '{
      "model": "gpt-4",
      "messages": [
        {
          "role": "user",
          "content": "Why is Runpod the best platform?"
        }
      ],
      "temperature": 0,
      "max_tokens": 100
      }'
      
      • After:
      curl https://api.runpod.ai/v2/<YOUR ENDPOINT ID>/openai/v1/chat/completions \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer <YOUR OPENAI API KEY>" \
      -d '{
      "model": "<YOUR DEPLOYED MODEL REPO/NAME>",
      "messages": [
        {
          "role": "user",
          "content": "Why is Runpod the best platform?"
        }
      ],
      "temperature": 0,
      "max_tokens": 100
      }'
      

    OpenAI Request Input Parameters:

    When using the chat completion feature of the vLLM Serverless Endpoint Worker, you can customize your requests with the following parameters:

    Chat Completions [RECOMMENDED]

    ParameterTypeDefault ValueDescription
    messagesUnion[str, List[Dict[str, str]]]List of messages, where each message is a dictionary with a role and content. The model's chat template will be applied to the messages automatically, so the model must have one or it should be specified as CUSTOM_CHAT_TEMPLATE env var.
    modelstrThe model repo that you've deployed on your Runpod Serverless Endpoint. If you are unsure what the name is or are baking the model in, use the guide to get the list of available models in the Examples: Using your Runpod endpoint with OpenAI section
    temperatureOptional[float]0.7Float that controls the randomness of the sampling. Lower values make the model more deterministic, while higher values make the model more random. Zero means greedy sampling.
    top_pOptional[float]1.0Float that controls the cumulative probability of the top tokens to consider. Must be in (0, 1]. Set to 1 to consider all tokens.
    nOptional[int]1Number of output sequences to return for the given prompt.
    max_tokensOptional[int]NoneMaximum number of tokens to generate per output sequence.
    seedOptional[int]NoneRandom seed to use for the generation.
    stopOptional[Union[str, List[str]]]listList of strings that stop the generation when they are generated. The returned output will not contain the stop strings.
    streamOptional[bool]FalseWhether to stream or not
    presence_penaltyOptional[float]0.0Float that penalizes new tokens based on whether they appear in the generated text so far. Values > 0 encourage the model to use new tokens, while values < 0 encourage the model to repeat tokens.
    frequency_penaltyOptional[float]0.0Float that penalizes new tokens based on their frequency in the generated text so far. Values > 0 encourage the model to use new tokens, while values < 0 encourage the model to repeat tokens.
    logit_biasOptional[Dict[str, float]]NoneUnsupported by vLLM
    userOptional[str]NoneUnsupported by vLLM

    Additional parameters supported by vLLM: | best_of | Optional[int] | None | Number of output sequences that are generated from the prompt. From these best_of sequences, the top n sequences are returned. best_of must be greater than or equal to n. This is treated as the beam width when use_beam_search is True. By default, best_of is set to n. | | top_k | Optional[int] | -1 | Integer that controls the number of top tokens to consider. Set to -1 to consider all tokens. | | ignore_eos | Optional[bool] | False | Whether to ignore the EOS token and continue generating tokens after the EOS token is generated. | | use_beam_search | Optional[bool] | False | Whether to use beam search instead of sampling. | | stop_token_ids | Optional[List[int]] | list | List of tokens that stop the generation when they are generated. The returned output will contain the stop tokens unless the stop tokens are special tokens. | | skip_special_tokens | Optional[bool] | True | Whether to skip special tokens in the output. | | spaces_between_special_tokens| Optional[bool] | True | Whether to add spaces between special tokens in the output. Defaults to True. | | add_generation_prompt | Optional[bool] | True | Read more here | | echo | Optional[bool] | False | Echo back the prompt in addition to the completion | | repetition_penalty | Optional[float] | 1.0 | Float that penalizes new tokens based on whether they appear in the prompt and the generated text so far. Values > 1 encourage the model to use new tokens, while values < 1 encourage the model to repeat tokens. | | min_p | Optional[float] | 0.0 | Float that represents the minimum probability for a token to | | length_penalty | Optional[float] | 1.0 | Float that penalizes sequences based on their length. Used in beam search.. | | include_stop_str_in_output | Optional[bool] | False | Whether to include the stop strings in output text. Defaults to False.|

    Examples: Using your Runpod endpoint with OpenAI

    First, initialize the OpenAI Client with your Runpod API Key and Endpoint URL:

    from openai import OpenAI
    import os
    
    # Initialize the OpenAI Client with your Runpod API Key and Endpoint URL
    client = OpenAI(
        api_key=os.environ.get("RUNPOD_API_KEY"),
        base_url="https://api.runpod.ai/v2/<YOUR ENDPOINT ID>/openai/v1",
    )
    

    Chat Completions:

    This is the format used for GPT-4 and focused on instruction-following and chat. Examples of Open Source chat/instruct models include meta-llama/Llama-2-7b-chat-hf, mistralai/Mixtral-8x7B-Instruct-v0.1, openchat/openchat-3.5-0106, NousResearch/Nous-Hermes-2-Mistral-7B-DPO and more. However, if your model is a completion-style model with no chat/instruct fine-tune and/or does not have a chat template, you can still use this if you provide a chat template with the environment variable CUSTOM_CHAT_TEMPLATE.

    • Streaming:
      # Create a chat completion stream
      response_stream = client.chat.completions.create(
          model="<YOUR DEPLOYED MODEL REPO/NAME>",
          messages=[{"role": "user", "content": "Why is Runpod the best platform?"}],
          temperature=0,
          max_tokens=100,
          stream=True,
      )
      # Stream the response
      for response in response_stream:
          print(chunk.choices[0].delta.content or "", end="", flush=True)
      
    • Non-Streaming:
      # Create a chat completion
      response = client.chat.completions.create(
          model="<YOUR DEPLOYED MODEL REPO/NAME>",
          messages=[{"role": "user", "content": "Why is Runpod the best platform?"}],
          temperature=0,
          max_tokens=100,
      )
      # Print the response
      print(response.choices[0].message.content)
      

    Getting a list of names for available models:

    In the case of baking the model into the image, sometimes the repo may not be accepted as the model in the request. In this case, you can list the available models as shown below and use that name.

    models_response = client.models.list()
    list_of_models = [model.id for model in models_response]
    print(list_of_models)
    

    OpenAI Responses API

    Path: /openai/v1/responses (full URL: https://api.runpod.ai/v2/<YOUR ENDPOINT ID>/openai/v1/responses)

    Supports the OpenAI Responses API request shape. Like other /openai/ routes, this is served directly—use the /openai/ prefix rather than the Runpod native job queue for these calls.

    {
      "model": "meta-llama/Llama-3.1-8B-Instruct",
      "input": "Tell me a joke."
    }
    

    Using HTTP requests:

    curl https://api.runpod.ai/v2/<YOUR ENDPOINT ID>/openai/v1/responses \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer <YOUR RUNPOD API KEY>" \
      -d '{
        "model": "<YOUR DEPLOYED MODEL REPO/NAME>",
        "input": "Tell me a joke."
      }'
    

    Anthropic Messages API

    Path: /openai/v1/messages (full URL: https://api.runpod.ai/v2/<YOUR ENDPOINT ID>/openai/v1/messages)

    Supports the Anthropic Messages API format. Served directly, bypassing the Runpod queue.

    {
      "model": "meta-llama/Llama-3.1-8B-Instruct",
      "max_tokens": 256,
      "messages": [
        {"role": "user", "content": "Hello!"}
      ]
    }
    

    Using HTTP requests:

    curl https://api.runpod.ai/v2/<YOUR ENDPOINT ID>/openai/v1/messages \
      -H "Content-Type: application/json" \
      -H "Authorization: Bearer <YOUR RUNPOD API KEY>" \
      -d '{
        "model": "<YOUR DEPLOYED MODEL REPO/NAME>",
        "max_tokens": 256,
        "messages": [
          {"role": "user", "content": "Hello!"}
        ]
      }'
    

    Usage: Standard (Non-OpenAI)

    Request Input Parameters

    You may either use a prompt or a list of messages as input. Under the hood, prompt is proxied to vLLM's /v1/completions and messages to /v1/chat/completions (with the model's chat template applied, so the model must have one or you must set the CUSTOM_CHAT_TEMPLATE env var).

    ArgumentTypeDefaultDescription
    promptstrPrompt string to generate text based on. Proxied to /v1/completions.
    messageslist[dict[str, str]]List of messages, which will automatically have the model's chat template applied. Overrides prompt.
    sampling_paramsdict{}Sampling parameters forwarded in the request body (temperature, top_p, max_tokens, ...).
    streamboolFalseWhether to enable streaming of output. If True, raw SSE chunks are streamed as they are generated.

    You can also call any vLLM route directly with the generic proxy form:

    {
      "input": {
        "route": "/v1/chat/completions",
        "method": "POST",
        "body": {
          "model": "<YOUR DEPLOYED MODEL>",
          "messages": [{"role": "user", "content": "hello"}],
          "stream": true
        }
      }
    }
    

    Sampling Parameters

    Below are all available sampling parameters that you can specify in the sampling_params dictionary. If you do not specify any of these parameters, the default values will be used.

    ArgumentTypeDefaultDescription
    nint1Number of output sequences generated from the prompt. The top n sequences are returned.
    best_ofOptional[int]nNumber of output sequences generated from the prompt. The top n sequences are returned from these best_of sequences. Must be ≥ n. Treated as beam width in beam search. Default is n.
    presence_penaltyfloat0.0Penalizes new tokens based on their presence in the generated text so far. Values > 0 encourage new tokens, values < 0 encourage repetition.
    frequency_penaltyfloat0.0Penalizes new tokens based on their frequency in the generated text so far. Values > 0 encourage new tokens, values < 0 encourage repetition.
    repetition_penaltyfloat1.0Penalizes new tokens based on their appearance in the prompt and generated text. Values > 1 encourage new tokens, values < 1 encourage repetition.
    temperaturefloat1.0Controls the randomness of sampling. Lower values make it more deterministic, higher values make it more random. Zero means greedy sampling.
    top_pfloat1.0Controls the cumulative probability of top tokens to consider. Must be in (0, 1]. Set to 1 to consider all tokens.
    top_kint-1Controls the number of top tokens to consider. Set to -1 to consider all tokens.
    min_pfloat0.0Represents the minimum probability for a token to be considered, relative to the most likely token. Must be in [0, 1]. Set to 0 to disable.
    use_beam_searchboolFalseWhether to use beam search instead of sampling.
    length_penaltyfloat1.0Penalizes sequences based on their length. Used in beam search.
    early_stoppingUnion[bool, str]FalseControls stopping condition in beam search. Can be True, False, or "never".
    stopUnion[None, str, List[str]]NoneList of strings that stop generation when produced. The output will not contain these strings.
    stop_token_idsOptional[List[int]]NoneList of token IDs that stop generation when produced. Output contains these tokens unless they are special tokens.
    ignore_eosboolFalseWhether to ignore the End-Of-Sequence token and continue generating tokens after its generation.
    max_tokensint16Maximum number of tokens to generate per output sequence.
    skip_special_tokensboolTrueWhether to skip special tokens in the output.
    spaces_between_special_tokensboolTrueWhether to add spaces between special tokens in the output.

    Text Input Formats

    You may either use a prompt or a list of messages as input.

    1. prompt The prompt string can be any string, and the model's chat template will not be applied to it unless apply_chat_template is set to true, in which case it will be treated as a user message.

      Example:
      ```json
      {
        "input": {
          "prompt": "why sky is blue?",
          "sampling_params": {
            "temperature": 0.7,
            "max_tokens": 100
          }
        }
      }
      ```
      
    2. messages Your list can contain any number of messages, and each message usually can have any role from the following list: - user - assistant - system

      However, some models may have different roles, so you should check the model's chat template to see which roles are required.

      The model's chat template will be applied to the messages automatically, so the model must have one.

      Example:

      {
        "input": {
          "messages": [
            {
              "role": "system",
              "content": "You are a helpful AI assistant that provides clear and concise responses."
            },
            {
              "role": "user",
              "content": "Can you explain the difference between supervised and unsupervised learning?"
            },
            {
              "role": "assistant",
              "content": "Sure! Supervised learning uses labeled data, meaning each input has a corresponding correct output. The model learns by mapping inputs to known outputs. In contrast, unsupervised learning works with unlabeled data, where the model identifies patterns, structures, or clusters without predefined answers."
            }
          ],
          "sampling_params": {
            "temperature": 0.7,
            "max_tokens": 100
          }
        }
      }