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. A 401 response with code X402_USER_NOT_ALLOWED means the wallet’s Venice account is banned or deleted, or the wallet’s x402 credit account belongs to a different user.
curl --request POST \
--url https://api.venice.ai/api/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"messages": [
{
"content": "<string>",
"role": "user",
"name": "<string>"
}
],
"model": "zai-org-glm-5-1",
"frequency_penalty": 0,
"logprobs": true,
"top_logprobs": 1,
"max_completion_tokens": 123,
"max_temp": 1.5,
"max_tokens": 123,
"min_p": 0.05,
"min_temp": 0.1,
"n": 1,
"presence_penalty": 0,
"prompt_cache_key": "random-string",
"prompt_cache_retention": "24h",
"repetition_penalty": 1.2,
"reasoning": {
"effort": "medium",
"enabled": false,
"summary": "auto"
},
"reasoning_effort": "medium",
"seed": 42,
"stop": "<string>",
"stop_token_ids": [
151643,
151645
],
"stream": true,
"stream_options": {
"include_usage": true
},
"temperature": 0.7,
"top_k": 40,
"top_p": 0.9,
"user": "<string>",
"anon_user_id": "end-user-123",
"fallbacks": [
{
"model": "claude-opus-4-8"
}
],
"store": true,
"verbosity": "low",
"text": {
"verbosity": "low"
},
"include": [
"<string>"
],
"metadata": {},
"venice_parameters": {
"character_slug": "<string>",
"strip_thinking_response": false,
"disable_thinking": false,
"enable_e2ee": true,
"enable_web_search": "off",
"enable_web_scraping": false,
"enable_web_citations": false,
"include_search_results_in_stream": false,
"return_search_results_as_documents": true,
"include_venice_system_prompt": true,
"enable_x_search": true
},
"parallel_tool_calls": false,
"response_format": {
"json_schema": {
"properties": {
"age": {
"type": "number"
},
"name": {
"type": "string"
}
},
"required": [
"name",
"age"
],
"type": "object"
},
"type": "json_schema"
},
"tool_choice": {
"function": {
"name": "<string>"
},
"type": "<string>"
},
"tools": [
{}
]
}
'import requests
url = "https://api.venice.ai/api/v1/chat/completions"
payload = {
"messages": [
{
"content": "<string>",
"role": "user",
"name": "<string>"
}
],
"model": "zai-org-glm-5-1",
"frequency_penalty": 0,
"logprobs": True,
"top_logprobs": 1,
"max_completion_tokens": 123,
"max_temp": 1.5,
"max_tokens": 123,
"min_p": 0.05,
"min_temp": 0.1,
"n": 1,
"presence_penalty": 0,
"prompt_cache_key": "random-string",
"prompt_cache_retention": "24h",
"repetition_penalty": 1.2,
"reasoning": {
"effort": "medium",
"enabled": False,
"summary": "auto"
},
"reasoning_effort": "medium",
"seed": 42,
"stop": "<string>",
"stop_token_ids": [151643, 151645],
"stream": True,
"stream_options": { "include_usage": True },
"temperature": 0.7,
"top_k": 40,
"top_p": 0.9,
"user": "<string>",
"anon_user_id": "end-user-123",
"fallbacks": [{ "model": "claude-opus-4-8" }],
"store": True,
"verbosity": "low",
"text": { "verbosity": "low" },
"include": ["<string>"],
"metadata": {},
"venice_parameters": {
"character_slug": "<string>",
"strip_thinking_response": False,
"disable_thinking": False,
"enable_e2ee": True,
"enable_web_search": "off",
"enable_web_scraping": False,
"enable_web_citations": False,
"include_search_results_in_stream": False,
"return_search_results_as_documents": True,
"include_venice_system_prompt": True,
"enable_x_search": True
},
"parallel_tool_calls": False,
"response_format": {
"json_schema": {
"properties": {
"age": { "type": "number" },
"name": { "type": "string" }
},
"required": ["name", "age"],
"type": "object"
},
"type": "json_schema"
},
"tool_choice": {
"function": { "name": "<string>" },
"type": "<string>"
},
"tools": [{}]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
messages: [{content: '<string>', role: 'user', name: '<string>'}],
model: 'zai-org-glm-5-1',
frequency_penalty: 0,
logprobs: true,
top_logprobs: 1,
max_completion_tokens: 123,
max_temp: 1.5,
max_tokens: 123,
min_p: 0.05,
min_temp: 0.1,
n: 1,
presence_penalty: 0,
prompt_cache_key: 'random-string',
prompt_cache_retention: '24h',
repetition_penalty: 1.2,
reasoning: {effort: 'medium', enabled: false, summary: 'auto'},
reasoning_effort: 'medium',
seed: 42,
stop: '<string>',
stop_token_ids: [151643, 151645],
stream: true,
stream_options: {include_usage: true},
temperature: 0.7,
top_k: 40,
top_p: 0.9,
user: '<string>',
anon_user_id: 'end-user-123',
fallbacks: [{model: 'claude-opus-4-8'}],
store: true,
verbosity: 'low',
text: {verbosity: 'low'},
include: ['<string>'],
metadata: {},
venice_parameters: {
character_slug: '<string>',
strip_thinking_response: false,
disable_thinking: false,
enable_e2ee: true,
enable_web_search: 'off',
enable_web_scraping: false,
enable_web_citations: false,
include_search_results_in_stream: false,
return_search_results_as_documents: true,
include_venice_system_prompt: true,
enable_x_search: true
},
parallel_tool_calls: false,
response_format: {
json_schema: {
properties: {age: {type: 'number'}, name: {type: 'string'}},
required: ['name', 'age'],
type: 'object'
},
type: 'json_schema'
},
tool_choice: {function: {name: '<string>'}, type: '<string>'},
tools: [{}]
})
};
fetch('https://api.venice.ai/api/v1/chat/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.venice.ai/api/v1/chat/completions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'messages' => [
[
'content' => '<string>',
'role' => 'user',
'name' => '<string>'
]
],
'model' => 'zai-org-glm-5-1',
'frequency_penalty' => 0,
'logprobs' => true,
'top_logprobs' => 1,
'max_completion_tokens' => 123,
'max_temp' => 1.5,
'max_tokens' => 123,
'min_p' => 0.05,
'min_temp' => 0.1,
'n' => 1,
'presence_penalty' => 0,
'prompt_cache_key' => 'random-string',
'prompt_cache_retention' => '24h',
'repetition_penalty' => 1.2,
'reasoning' => [
'effort' => 'medium',
'enabled' => false,
'summary' => 'auto'
],
'reasoning_effort' => 'medium',
'seed' => 42,
'stop' => '<string>',
'stop_token_ids' => [
151643,
151645
],
'stream' => true,
'stream_options' => [
'include_usage' => true
],
'temperature' => 0.7,
'top_k' => 40,
'top_p' => 0.9,
'user' => '<string>',
'anon_user_id' => 'end-user-123',
'fallbacks' => [
[
'model' => 'claude-opus-4-8'
]
],
'store' => true,
'verbosity' => 'low',
'text' => [
'verbosity' => 'low'
],
'include' => [
'<string>'
],
'metadata' => [
],
'venice_parameters' => [
'character_slug' => '<string>',
'strip_thinking_response' => false,
'disable_thinking' => false,
'enable_e2ee' => true,
'enable_web_search' => 'off',
'enable_web_scraping' => false,
'enable_web_citations' => false,
'include_search_results_in_stream' => false,
'return_search_results_as_documents' => true,
'include_venice_system_prompt' => true,
'enable_x_search' => true
],
'parallel_tool_calls' => false,
'response_format' => [
'json_schema' => [
'properties' => [
'age' => [
'type' => 'number'
],
'name' => [
'type' => 'string'
]
],
'required' => [
'name',
'age'
],
'type' => 'object'
],
'type' => 'json_schema'
],
'tool_choice' => [
'function' => [
'name' => '<string>'
],
'type' => '<string>'
],
'tools' => [
[
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.venice.ai/api/v1/chat/completions"
payload := strings.NewReader("{\n \"messages\": [\n {\n \"content\": \"<string>\",\n \"role\": \"user\",\n \"name\": \"<string>\"\n }\n ],\n \"model\": \"zai-org-glm-5-1\",\n \"frequency_penalty\": 0,\n \"logprobs\": true,\n \"top_logprobs\": 1,\n \"max_completion_tokens\": 123,\n \"max_temp\": 1.5,\n \"max_tokens\": 123,\n \"min_p\": 0.05,\n \"min_temp\": 0.1,\n \"n\": 1,\n \"presence_penalty\": 0,\n \"prompt_cache_key\": \"random-string\",\n \"prompt_cache_retention\": \"24h\",\n \"repetition_penalty\": 1.2,\n \"reasoning\": {\n \"effort\": \"medium\",\n \"enabled\": false,\n \"summary\": \"auto\"\n },\n \"reasoning_effort\": \"medium\",\n \"seed\": 42,\n \"stop\": \"<string>\",\n \"stop_token_ids\": [\n 151643,\n 151645\n ],\n \"stream\": true,\n \"stream_options\": {\n \"include_usage\": true\n },\n \"temperature\": 0.7,\n \"top_k\": 40,\n \"top_p\": 0.9,\n \"user\": \"<string>\",\n \"anon_user_id\": \"end-user-123\",\n \"fallbacks\": [\n {\n \"model\": \"claude-opus-4-8\"\n }\n ],\n \"store\": true,\n \"verbosity\": \"low\",\n \"text\": {\n \"verbosity\": \"low\"\n },\n \"include\": [\n \"<string>\"\n ],\n \"metadata\": {},\n \"venice_parameters\": {\n \"character_slug\": \"<string>\",\n \"strip_thinking_response\": false,\n \"disable_thinking\": false,\n \"enable_e2ee\": true,\n \"enable_web_search\": \"off\",\n \"enable_web_scraping\": false,\n \"enable_web_citations\": false,\n \"include_search_results_in_stream\": false,\n \"return_search_results_as_documents\": true,\n \"include_venice_system_prompt\": true,\n \"enable_x_search\": true\n },\n \"parallel_tool_calls\": false,\n \"response_format\": {\n \"json_schema\": {\n \"properties\": {\n \"age\": {\n \"type\": \"number\"\n },\n \"name\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"name\",\n \"age\"\n ],\n \"type\": \"object\"\n },\n \"type\": \"json_schema\"\n },\n \"tool_choice\": {\n \"function\": {\n \"name\": \"<string>\"\n },\n \"type\": \"<string>\"\n },\n \"tools\": [\n {}\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.venice.ai/api/v1/chat/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"messages\": [\n {\n \"content\": \"<string>\",\n \"role\": \"user\",\n \"name\": \"<string>\"\n }\n ],\n \"model\": \"zai-org-glm-5-1\",\n \"frequency_penalty\": 0,\n \"logprobs\": true,\n \"top_logprobs\": 1,\n \"max_completion_tokens\": 123,\n \"max_temp\": 1.5,\n \"max_tokens\": 123,\n \"min_p\": 0.05,\n \"min_temp\": 0.1,\n \"n\": 1,\n \"presence_penalty\": 0,\n \"prompt_cache_key\": \"random-string\",\n \"prompt_cache_retention\": \"24h\",\n \"repetition_penalty\": 1.2,\n \"reasoning\": {\n \"effort\": \"medium\",\n \"enabled\": false,\n \"summary\": \"auto\"\n },\n \"reasoning_effort\": \"medium\",\n \"seed\": 42,\n \"stop\": \"<string>\",\n \"stop_token_ids\": [\n 151643,\n 151645\n ],\n \"stream\": true,\n \"stream_options\": {\n \"include_usage\": true\n },\n \"temperature\": 0.7,\n \"top_k\": 40,\n \"top_p\": 0.9,\n \"user\": \"<string>\",\n \"anon_user_id\": \"end-user-123\",\n \"fallbacks\": [\n {\n \"model\": \"claude-opus-4-8\"\n }\n ],\n \"store\": true,\n \"verbosity\": \"low\",\n \"text\": {\n \"verbosity\": \"low\"\n },\n \"include\": [\n \"<string>\"\n ],\n \"metadata\": {},\n \"venice_parameters\": {\n \"character_slug\": \"<string>\",\n \"strip_thinking_response\": false,\n \"disable_thinking\": false,\n \"enable_e2ee\": true,\n \"enable_web_search\": \"off\",\n \"enable_web_scraping\": false,\n \"enable_web_citations\": false,\n \"include_search_results_in_stream\": false,\n \"return_search_results_as_documents\": true,\n \"include_venice_system_prompt\": true,\n \"enable_x_search\": true\n },\n \"parallel_tool_calls\": false,\n \"response_format\": {\n \"json_schema\": {\n \"properties\": {\n \"age\": {\n \"type\": \"number\"\n },\n \"name\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"name\",\n \"age\"\n ],\n \"type\": \"object\"\n },\n \"type\": \"json_schema\"\n },\n \"tool_choice\": {\n \"function\": {\n \"name\": \"<string>\"\n },\n \"type\": \"<string>\"\n },\n \"tools\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.venice.ai/api/v1/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"messages\": [\n {\n \"content\": \"<string>\",\n \"role\": \"user\",\n \"name\": \"<string>\"\n }\n ],\n \"model\": \"zai-org-glm-5-1\",\n \"frequency_penalty\": 0,\n \"logprobs\": true,\n \"top_logprobs\": 1,\n \"max_completion_tokens\": 123,\n \"max_temp\": 1.5,\n \"max_tokens\": 123,\n \"min_p\": 0.05,\n \"min_temp\": 0.1,\n \"n\": 1,\n \"presence_penalty\": 0,\n \"prompt_cache_key\": \"random-string\",\n \"prompt_cache_retention\": \"24h\",\n \"repetition_penalty\": 1.2,\n \"reasoning\": {\n \"effort\": \"medium\",\n \"enabled\": false,\n \"summary\": \"auto\"\n },\n \"reasoning_effort\": \"medium\",\n \"seed\": 42,\n \"stop\": \"<string>\",\n \"stop_token_ids\": [\n 151643,\n 151645\n ],\n \"stream\": true,\n \"stream_options\": {\n \"include_usage\": true\n },\n \"temperature\": 0.7,\n \"top_k\": 40,\n \"top_p\": 0.9,\n \"user\": \"<string>\",\n \"anon_user_id\": \"end-user-123\",\n \"fallbacks\": [\n {\n \"model\": \"claude-opus-4-8\"\n }\n ],\n \"store\": true,\n \"verbosity\": \"low\",\n \"text\": {\n \"verbosity\": \"low\"\n },\n \"include\": [\n \"<string>\"\n ],\n \"metadata\": {},\n \"venice_parameters\": {\n \"character_slug\": \"<string>\",\n \"strip_thinking_response\": false,\n \"disable_thinking\": false,\n \"enable_e2ee\": true,\n \"enable_web_search\": \"off\",\n \"enable_web_scraping\": false,\n \"enable_web_citations\": false,\n \"include_search_results_in_stream\": false,\n \"return_search_results_as_documents\": true,\n \"include_venice_system_prompt\": true,\n \"enable_x_search\": true\n },\n \"parallel_tool_calls\": false,\n \"response_format\": {\n \"json_schema\": {\n \"properties\": {\n \"age\": {\n \"type\": \"number\"\n },\n \"name\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"name\",\n \"age\"\n ],\n \"type\": \"object\"\n },\n \"type\": \"json_schema\"\n },\n \"tool_choice\": {\n \"function\": {\n \"name\": \"<string>\"\n },\n \"type\": \"<string>\"\n },\n \"tools\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"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"
}
}{
"error": "<string>",
"details": {
"_errors": [],
"field": {
"_errors": [
"Field is required"
]
}
}
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "This API key is restricted to configured IP addresses, and this request's source IP is not allowed"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}venice_parameters. This endpoint is OpenAI-compatible, but the venice_parameters object unlocks features that aren’t part of the standard OpenAI API — and many integrators miss them:- Web search & citations —
enable_web_search,enable_web_citations,enable_web_scraping - Character personas —
character_slug - System prompt control —
include_venice_system_prompt - Reasoning controls —
disable_thinking,strip_thinking_response - Privacy —
enable_e2ee
venice_parameters section below.Postman Collection
For additional examples, please see this Postman Collection.Authorizations
Headers
Body
A list of messages comprising the conversation so far. Depending on the model you use, different message types (modalities) are supported, like text and images. Non-multimodal models reject image content. For vision models that support multiple images (supportsMultipleImages), images are preserved across all messages in the conversation history. For single-image vision models, only the last image-containing message retains its images.
1The user message is the input from the user. It is part of the conversation and is visible to the assistant.
- User Message
- Assistant Message
- Tool Message
- System Message
- Developer Message
Show child attributes
Show child attributes
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.
"zai-org-glm-5-1"
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.
none, minimal, low, medium, high, xhigh, max "medium"
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 ||.
1 - 128^[\x20-\x7E]+$"end-user-123"
OpenAI-compatible text configuration parameter.
Show child attributes
Show child attributes
Format in which the response should be returned.
- json_schema
- json_object
- text
Show child attributes
Show child attributes
{
"json_schema": {
"properties": {
"age": { "type": "number" },
"name": { "type": "string" }
},
"required": ["name", "age"],
"type": "object"
},
"type": "json_schema"
}
A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for.
A tool that can be called by the model. Currently, only functions are supported as tools.
- Tool Call
- Tool Call
Show child attributes
Show child attributes
Response
OK
A list of chat completion choices. Can be more than one if n is greater than 1. Certain models may not return this field under certain conditions.
Show child attributes
Show child attributes
[
{
"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
}
]
Was this page helpful?
curl --request POST \
--url https://api.venice.ai/api/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"messages": [
{
"content": "<string>",
"role": "user",
"name": "<string>"
}
],
"model": "zai-org-glm-5-1",
"frequency_penalty": 0,
"logprobs": true,
"top_logprobs": 1,
"max_completion_tokens": 123,
"max_temp": 1.5,
"max_tokens": 123,
"min_p": 0.05,
"min_temp": 0.1,
"n": 1,
"presence_penalty": 0,
"prompt_cache_key": "random-string",
"prompt_cache_retention": "24h",
"repetition_penalty": 1.2,
"reasoning": {
"effort": "medium",
"enabled": false,
"summary": "auto"
},
"reasoning_effort": "medium",
"seed": 42,
"stop": "<string>",
"stop_token_ids": [
151643,
151645
],
"stream": true,
"stream_options": {
"include_usage": true
},
"temperature": 0.7,
"top_k": 40,
"top_p": 0.9,
"user": "<string>",
"anon_user_id": "end-user-123",
"fallbacks": [
{
"model": "claude-opus-4-8"
}
],
"store": true,
"verbosity": "low",
"text": {
"verbosity": "low"
},
"include": [
"<string>"
],
"metadata": {},
"venice_parameters": {
"character_slug": "<string>",
"strip_thinking_response": false,
"disable_thinking": false,
"enable_e2ee": true,
"enable_web_search": "off",
"enable_web_scraping": false,
"enable_web_citations": false,
"include_search_results_in_stream": false,
"return_search_results_as_documents": true,
"include_venice_system_prompt": true,
"enable_x_search": true
},
"parallel_tool_calls": false,
"response_format": {
"json_schema": {
"properties": {
"age": {
"type": "number"
},
"name": {
"type": "string"
}
},
"required": [
"name",
"age"
],
"type": "object"
},
"type": "json_schema"
},
"tool_choice": {
"function": {
"name": "<string>"
},
"type": "<string>"
},
"tools": [
{}
]
}
'import requests
url = "https://api.venice.ai/api/v1/chat/completions"
payload = {
"messages": [
{
"content": "<string>",
"role": "user",
"name": "<string>"
}
],
"model": "zai-org-glm-5-1",
"frequency_penalty": 0,
"logprobs": True,
"top_logprobs": 1,
"max_completion_tokens": 123,
"max_temp": 1.5,
"max_tokens": 123,
"min_p": 0.05,
"min_temp": 0.1,
"n": 1,
"presence_penalty": 0,
"prompt_cache_key": "random-string",
"prompt_cache_retention": "24h",
"repetition_penalty": 1.2,
"reasoning": {
"effort": "medium",
"enabled": False,
"summary": "auto"
},
"reasoning_effort": "medium",
"seed": 42,
"stop": "<string>",
"stop_token_ids": [151643, 151645],
"stream": True,
"stream_options": { "include_usage": True },
"temperature": 0.7,
"top_k": 40,
"top_p": 0.9,
"user": "<string>",
"anon_user_id": "end-user-123",
"fallbacks": [{ "model": "claude-opus-4-8" }],
"store": True,
"verbosity": "low",
"text": { "verbosity": "low" },
"include": ["<string>"],
"metadata": {},
"venice_parameters": {
"character_slug": "<string>",
"strip_thinking_response": False,
"disable_thinking": False,
"enable_e2ee": True,
"enable_web_search": "off",
"enable_web_scraping": False,
"enable_web_citations": False,
"include_search_results_in_stream": False,
"return_search_results_as_documents": True,
"include_venice_system_prompt": True,
"enable_x_search": True
},
"parallel_tool_calls": False,
"response_format": {
"json_schema": {
"properties": {
"age": { "type": "number" },
"name": { "type": "string" }
},
"required": ["name", "age"],
"type": "object"
},
"type": "json_schema"
},
"tool_choice": {
"function": { "name": "<string>" },
"type": "<string>"
},
"tools": [{}]
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
messages: [{content: '<string>', role: 'user', name: '<string>'}],
model: 'zai-org-glm-5-1',
frequency_penalty: 0,
logprobs: true,
top_logprobs: 1,
max_completion_tokens: 123,
max_temp: 1.5,
max_tokens: 123,
min_p: 0.05,
min_temp: 0.1,
n: 1,
presence_penalty: 0,
prompt_cache_key: 'random-string',
prompt_cache_retention: '24h',
repetition_penalty: 1.2,
reasoning: {effort: 'medium', enabled: false, summary: 'auto'},
reasoning_effort: 'medium',
seed: 42,
stop: '<string>',
stop_token_ids: [151643, 151645],
stream: true,
stream_options: {include_usage: true},
temperature: 0.7,
top_k: 40,
top_p: 0.9,
user: '<string>',
anon_user_id: 'end-user-123',
fallbacks: [{model: 'claude-opus-4-8'}],
store: true,
verbosity: 'low',
text: {verbosity: 'low'},
include: ['<string>'],
metadata: {},
venice_parameters: {
character_slug: '<string>',
strip_thinking_response: false,
disable_thinking: false,
enable_e2ee: true,
enable_web_search: 'off',
enable_web_scraping: false,
enable_web_citations: false,
include_search_results_in_stream: false,
return_search_results_as_documents: true,
include_venice_system_prompt: true,
enable_x_search: true
},
parallel_tool_calls: false,
response_format: {
json_schema: {
properties: {age: {type: 'number'}, name: {type: 'string'}},
required: ['name', 'age'],
type: 'object'
},
type: 'json_schema'
},
tool_choice: {function: {name: '<string>'}, type: '<string>'},
tools: [{}]
})
};
fetch('https://api.venice.ai/api/v1/chat/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.venice.ai/api/v1/chat/completions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'messages' => [
[
'content' => '<string>',
'role' => 'user',
'name' => '<string>'
]
],
'model' => 'zai-org-glm-5-1',
'frequency_penalty' => 0,
'logprobs' => true,
'top_logprobs' => 1,
'max_completion_tokens' => 123,
'max_temp' => 1.5,
'max_tokens' => 123,
'min_p' => 0.05,
'min_temp' => 0.1,
'n' => 1,
'presence_penalty' => 0,
'prompt_cache_key' => 'random-string',
'prompt_cache_retention' => '24h',
'repetition_penalty' => 1.2,
'reasoning' => [
'effort' => 'medium',
'enabled' => false,
'summary' => 'auto'
],
'reasoning_effort' => 'medium',
'seed' => 42,
'stop' => '<string>',
'stop_token_ids' => [
151643,
151645
],
'stream' => true,
'stream_options' => [
'include_usage' => true
],
'temperature' => 0.7,
'top_k' => 40,
'top_p' => 0.9,
'user' => '<string>',
'anon_user_id' => 'end-user-123',
'fallbacks' => [
[
'model' => 'claude-opus-4-8'
]
],
'store' => true,
'verbosity' => 'low',
'text' => [
'verbosity' => 'low'
],
'include' => [
'<string>'
],
'metadata' => [
],
'venice_parameters' => [
'character_slug' => '<string>',
'strip_thinking_response' => false,
'disable_thinking' => false,
'enable_e2ee' => true,
'enable_web_search' => 'off',
'enable_web_scraping' => false,
'enable_web_citations' => false,
'include_search_results_in_stream' => false,
'return_search_results_as_documents' => true,
'include_venice_system_prompt' => true,
'enable_x_search' => true
],
'parallel_tool_calls' => false,
'response_format' => [
'json_schema' => [
'properties' => [
'age' => [
'type' => 'number'
],
'name' => [
'type' => 'string'
]
],
'required' => [
'name',
'age'
],
'type' => 'object'
],
'type' => 'json_schema'
],
'tool_choice' => [
'function' => [
'name' => '<string>'
],
'type' => '<string>'
],
'tools' => [
[
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.venice.ai/api/v1/chat/completions"
payload := strings.NewReader("{\n \"messages\": [\n {\n \"content\": \"<string>\",\n \"role\": \"user\",\n \"name\": \"<string>\"\n }\n ],\n \"model\": \"zai-org-glm-5-1\",\n \"frequency_penalty\": 0,\n \"logprobs\": true,\n \"top_logprobs\": 1,\n \"max_completion_tokens\": 123,\n \"max_temp\": 1.5,\n \"max_tokens\": 123,\n \"min_p\": 0.05,\n \"min_temp\": 0.1,\n \"n\": 1,\n \"presence_penalty\": 0,\n \"prompt_cache_key\": \"random-string\",\n \"prompt_cache_retention\": \"24h\",\n \"repetition_penalty\": 1.2,\n \"reasoning\": {\n \"effort\": \"medium\",\n \"enabled\": false,\n \"summary\": \"auto\"\n },\n \"reasoning_effort\": \"medium\",\n \"seed\": 42,\n \"stop\": \"<string>\",\n \"stop_token_ids\": [\n 151643,\n 151645\n ],\n \"stream\": true,\n \"stream_options\": {\n \"include_usage\": true\n },\n \"temperature\": 0.7,\n \"top_k\": 40,\n \"top_p\": 0.9,\n \"user\": \"<string>\",\n \"anon_user_id\": \"end-user-123\",\n \"fallbacks\": [\n {\n \"model\": \"claude-opus-4-8\"\n }\n ],\n \"store\": true,\n \"verbosity\": \"low\",\n \"text\": {\n \"verbosity\": \"low\"\n },\n \"include\": [\n \"<string>\"\n ],\n \"metadata\": {},\n \"venice_parameters\": {\n \"character_slug\": \"<string>\",\n \"strip_thinking_response\": false,\n \"disable_thinking\": false,\n \"enable_e2ee\": true,\n \"enable_web_search\": \"off\",\n \"enable_web_scraping\": false,\n \"enable_web_citations\": false,\n \"include_search_results_in_stream\": false,\n \"return_search_results_as_documents\": true,\n \"include_venice_system_prompt\": true,\n \"enable_x_search\": true\n },\n \"parallel_tool_calls\": false,\n \"response_format\": {\n \"json_schema\": {\n \"properties\": {\n \"age\": {\n \"type\": \"number\"\n },\n \"name\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"name\",\n \"age\"\n ],\n \"type\": \"object\"\n },\n \"type\": \"json_schema\"\n },\n \"tool_choice\": {\n \"function\": {\n \"name\": \"<string>\"\n },\n \"type\": \"<string>\"\n },\n \"tools\": [\n {}\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.venice.ai/api/v1/chat/completions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"messages\": [\n {\n \"content\": \"<string>\",\n \"role\": \"user\",\n \"name\": \"<string>\"\n }\n ],\n \"model\": \"zai-org-glm-5-1\",\n \"frequency_penalty\": 0,\n \"logprobs\": true,\n \"top_logprobs\": 1,\n \"max_completion_tokens\": 123,\n \"max_temp\": 1.5,\n \"max_tokens\": 123,\n \"min_p\": 0.05,\n \"min_temp\": 0.1,\n \"n\": 1,\n \"presence_penalty\": 0,\n \"prompt_cache_key\": \"random-string\",\n \"prompt_cache_retention\": \"24h\",\n \"repetition_penalty\": 1.2,\n \"reasoning\": {\n \"effort\": \"medium\",\n \"enabled\": false,\n \"summary\": \"auto\"\n },\n \"reasoning_effort\": \"medium\",\n \"seed\": 42,\n \"stop\": \"<string>\",\n \"stop_token_ids\": [\n 151643,\n 151645\n ],\n \"stream\": true,\n \"stream_options\": {\n \"include_usage\": true\n },\n \"temperature\": 0.7,\n \"top_k\": 40,\n \"top_p\": 0.9,\n \"user\": \"<string>\",\n \"anon_user_id\": \"end-user-123\",\n \"fallbacks\": [\n {\n \"model\": \"claude-opus-4-8\"\n }\n ],\n \"store\": true,\n \"verbosity\": \"low\",\n \"text\": {\n \"verbosity\": \"low\"\n },\n \"include\": [\n \"<string>\"\n ],\n \"metadata\": {},\n \"venice_parameters\": {\n \"character_slug\": \"<string>\",\n \"strip_thinking_response\": false,\n \"disable_thinking\": false,\n \"enable_e2ee\": true,\n \"enable_web_search\": \"off\",\n \"enable_web_scraping\": false,\n \"enable_web_citations\": false,\n \"include_search_results_in_stream\": false,\n \"return_search_results_as_documents\": true,\n \"include_venice_system_prompt\": true,\n \"enable_x_search\": true\n },\n \"parallel_tool_calls\": false,\n \"response_format\": {\n \"json_schema\": {\n \"properties\": {\n \"age\": {\n \"type\": \"number\"\n },\n \"name\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"name\",\n \"age\"\n ],\n \"type\": \"object\"\n },\n \"type\": \"json_schema\"\n },\n \"tool_choice\": {\n \"function\": {\n \"name\": \"<string>\"\n },\n \"type\": \"<string>\"\n },\n \"tools\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.venice.ai/api/v1/chat/completions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"messages\": [\n {\n \"content\": \"<string>\",\n \"role\": \"user\",\n \"name\": \"<string>\"\n }\n ],\n \"model\": \"zai-org-glm-5-1\",\n \"frequency_penalty\": 0,\n \"logprobs\": true,\n \"top_logprobs\": 1,\n \"max_completion_tokens\": 123,\n \"max_temp\": 1.5,\n \"max_tokens\": 123,\n \"min_p\": 0.05,\n \"min_temp\": 0.1,\n \"n\": 1,\n \"presence_penalty\": 0,\n \"prompt_cache_key\": \"random-string\",\n \"prompt_cache_retention\": \"24h\",\n \"repetition_penalty\": 1.2,\n \"reasoning\": {\n \"effort\": \"medium\",\n \"enabled\": false,\n \"summary\": \"auto\"\n },\n \"reasoning_effort\": \"medium\",\n \"seed\": 42,\n \"stop\": \"<string>\",\n \"stop_token_ids\": [\n 151643,\n 151645\n ],\n \"stream\": true,\n \"stream_options\": {\n \"include_usage\": true\n },\n \"temperature\": 0.7,\n \"top_k\": 40,\n \"top_p\": 0.9,\n \"user\": \"<string>\",\n \"anon_user_id\": \"end-user-123\",\n \"fallbacks\": [\n {\n \"model\": \"claude-opus-4-8\"\n }\n ],\n \"store\": true,\n \"verbosity\": \"low\",\n \"text\": {\n \"verbosity\": \"low\"\n },\n \"include\": [\n \"<string>\"\n ],\n \"metadata\": {},\n \"venice_parameters\": {\n \"character_slug\": \"<string>\",\n \"strip_thinking_response\": false,\n \"disable_thinking\": false,\n \"enable_e2ee\": true,\n \"enable_web_search\": \"off\",\n \"enable_web_scraping\": false,\n \"enable_web_citations\": false,\n \"include_search_results_in_stream\": false,\n \"return_search_results_as_documents\": true,\n \"include_venice_system_prompt\": true,\n \"enable_x_search\": true\n },\n \"parallel_tool_calls\": false,\n \"response_format\": {\n \"json_schema\": {\n \"properties\": {\n \"age\": {\n \"type\": \"number\"\n },\n \"name\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"name\",\n \"age\"\n ],\n \"type\": \"object\"\n },\n \"type\": \"json_schema\"\n },\n \"tool_choice\": {\n \"function\": {\n \"name\": \"<string>\"\n },\n \"type\": \"<string>\"\n },\n \"tools\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"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"
}
}{
"error": "<string>",
"details": {
"_errors": [],
"field": {
"_errors": [
"Field is required"
]
}
}
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "This API key is restricted to configured IP addresses, and this request's source IP is not allowed"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}