Chat

/api/v1/chat/completions

Run text inference based on the supplied parameters. Supports multimodal inputs including text, images (image_url), audio (input_audio), video (video_url), and files (file) for compatible models. File inputs (PDF, DOCX, PPTX, XLSX, TXT, etc.) are automatically extracted to text before being sent to the model. Long running requests should use the streaming API by setting stream=true in your request.

Authentication: This endpoint accepts either a Bearer API key or a SIGN-IN-WITH-X header for x402 wallet-based authentication. The legacy X-Sign-In-With-X header is also accepted during migration. When using x402, a 402 Payment Required response indicates insufficient balance and includes top-up instructions.

post/api/v1/chat/completions

Request

  • Base URL: https://api.venice.ai
  • URL: https://api.venice.ai/api/v1/chat/completions
  • Auth: one of:
    • HTTP bearer
    • API key in header SIGN-IN-WITH-X

Headers

Accept-Encodingstring
Example:gzip, br

Supported compression encodings (gzip, br). Only applied when stream is false.

Request body

frequency_penaltynumber

Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.

logprobsboolean

Whether to include log probabilities in the response. This is not supported by all models.

top_logprobsinteger

The number of highest probability tokens to return for each token position.

max_completion_tokensinteger

An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and reasoning tokens.

max_tempnumber

Maximum temperature value for dynamic temperature scaling.

max_tokensinteger

The maximum number of tokens that can be generated in the chat completion. This value can be used to control costs for text generated via API. Values of 0 or less are ignored and the model will use its default maximum. This value is now deprecated in favor of max_completion_tokens.

min_pnumber

Sets a minimum probability threshold for token selection. Tokens with probabilities below this value are filtered out.

min_tempnumber

Minimum temperature value for dynamic temperature scaling.

modelstring required

The ID of the model you wish to prompt. May also be a model trait, or a model compatibility mapping. See the models endpoint for a list of models available to you. You can use feature suffixes to enable features from the venice_parameters object. Please see "Model Feature Suffix" documentation for more details.

ninteger

How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all of the choices. Keep n as 1 to minimize costs.

presence_penaltynumber

Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.

prompt_cache_keystring

When supplied, this field may be used to optimize conversation routing to improve cache performance and thus reduce latency.

prompt_cache_retention'default' | 'extended' | '24h'

OpenAI-compatible parameter to control prompt cache retention. "extended" or "24h" extends retention to 24 hours for supported models.

repetition_penaltynumber

The parameter for repetition penalty. 1.0 means no penalty. Values > 1.0 discourage repetition.

reasoning_effort'none' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh' | 'max'

OpenAI-compatible parameter to control reasoning effort level for supported models. Takes precedence over reasoning.effort if both are provided. Direct OpenAI models validate concrete levels against their reasoningEffortOptions; none and minimal may map to the minimum supported effort on mandatory-reasoning models, with reasoning tokens still billed.

seedinteger

The random seed used to generate the response. This is useful for reproducibility.

stop_token_idsnumber[]

Array of token IDs where the API will stop generating further tokens.

streamboolean

Whether to stream back partial progress. Defaults to false.

temperaturenumber

What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or top_p but not both.

top_kinteger

The number of highest probability vocabulary tokens to keep for top-k-filtering.

top_pnumber

An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered.

userstring

This field is discarded on the request but is supported in the Venice API for compatibility with OpenAI clients. It is not an alias of anon_user_id.

anon_user_idstring

Optional identifier for the API customer's end user. Combined with the Venice user id when attributing the request to upstream providers. Distinct from the discarded OpenAI user field. Must be printable ASCII and must not contain ||.

storeboolean

This field is accepted for OpenAI compatibility but is not used by Venice.

verbosity'low' | 'medium' | 'high' | 'auto'

Controls the verbosity of the text response. Currently supported values are low, medium, and high.

includestring[]

OpenAI-compatible parameter specifying additional data to include in the response.

metadataobject

OpenAI-compatible metadata parameter for request tracking.

parallel_tool_callsboolean

Whether to enable parallel function calling during tool use.

Example request

{
  "logprobs": true,
  "top_logprobs": 1,
  "max_temp": 1.5,
  "messages": [
    {
      "content": [
        {
          "text": "Why is the sky blue?",
          "type": "text"
        }
      ]
    }
  ],
  "min_p": 0.05,
  "min_temp": 0.1,
  "model": "zai-org-glm-5-1",
  "prompt_cache_key": "random-string",
  "prompt_cache_retention": "24h",
  "repetition_penalty": 1.2,
  "reasoning": {
    "effort": "medium",
    "summary": "auto"
  },
  "reasoning_effort": "medium",
  "seed": 42,
  "stop_token_ids": [
    151643,
    151645
  ],
  "stream": true,
  "temperature": 0.7,
  "top_k": 40,
  "top_p": 0.9,
  "anon_user_id": "end-user-123",
  "fallbacks": [
    {
      "model": "claude-opus-4-8"
    }
  ],
  "verbosity": "low",
  "text": {
    "verbosity": "low"
  },
  "venice_parameters": {
    "enable_e2ee": true,
    "enable_web_search": "off",
    "enable_x_search": true
  },
  "response_format": {
    "json_schema": {
      "properties": {
        "age": {
          "type": "number"
        },
        "name": {
          "type": "string"
        }
      },
      "required": [
        "name",
        "age"
      ],
      "type": "object"
    },
    "type": "json_schema"
  }
}

Response

OK

createdinteger required

The time at which the request was created.

idstring required

The ID of the request.

modelstring required

The model id used for the request.

object'chat.completion' required

The type of the object returned.

Example response

{
  "choices": [
    {
      "finish_reason": "stop",
      "index": 0,
      "logprobs": null,
      "message": {
        "content": "The sky appears blue because of the way Earth's atmosphere scatters sunlight. When sunlight reaches Earth's atmosphere, it is made up of various colors of the spectrum, but blue light waves are shorter and scatter more easily when they hit the gases and particles in the atmosphere. This scattering occurs in all directions, but from our perspective on the ground, it appears as a blue hue that dominates the sky's color. This phenomenon is known as Rayleigh scattering. During sunrise and sunset, the sunlight has to travel further through the atmosphere, which allows more time for the blue light to scatter away from our direct line of sight, leaving the longer wavelengths, such as red, yellow, and orange, to dominate the sky's color.",
        "reasoning_content": null,
        "role": "assistant",
        "tool_calls": []
      },
      "stop_reason": null
    }
  ],
  "created": 1739928524,
  "cost": {
    "diem": 0,
    "usd": 0.00042
  },
  "id": "chatcmpl-a81fbc2d81a7a083bb83ccf9f44c6e5e",
  "model": "zai-org-glm-5-1",
  "object": "chat.completion",
  "prompt_logprobs": null,
  "usage": {
    "completion_tokens": 146,
    "completion_tokens_details": null,
    "prompt_tokens": 612,
    "prompt_tokens_details": null,
    "total_tokens": 758
  },
  "venice_parameters": {
    "enable_e2ee": true,
    "include_venice_system_prompt": true,
    "include_search_results_in_stream": false,
    "return_search_results_as_documents": false,
    "web_search_citations": [],
    "enable_web_search": "auto",
    "enable_web_scraping": false,
    "enable_web_citations": true,
    "strip_thinking_response": true,
    "disable_thinking": true,
    "character_slug": "venice"
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.