import OpenAI from "openai";const client = new OpenAI({ apiKey: process.env.VENICE_API_KEY!, baseURL: "https://api.venice.ai/api/v1",});const completion = await client.chat.completions.create({ model: "zai-org-glm-5-1", messages: [{ role: "user", content: "What are the latest developments in AI?" }], // @ts-expect-error - Venice-specific parameter venice_parameters: { enable_web_search: "auto", },});console.log(completion.choices[0].message.content);
import osfrom openai import OpenAIclient = OpenAI( api_key=os.environ["VENICE_API_KEY"], base_url="https://api.venice.ai/api/v1",)response = client.chat.completions.create( model="zai-org-glm-5-1", messages=[{"role": "user", "content": "What are the latest developments in AI?"}], extra_body={ "venice_parameters": { "enable_web_search": "auto", } },)print(response.choices[0].message.content)
# Alternative: append parameters directly to the model IDcurl https://api.venice.ai/api/v1/chat/completions \ -H "Authorization: Bearer $VENICE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "zai-org-glm-5-1:enable_web_search=on&enable_web_citations=true", "messages": [{"role": "user", "content": "What are the latest developments in AI?"}] }'
Web Scraping Code Samples
Set enable_web_scraping: true and the model will fetch and read any URLs in the user message before answering.
curl https://api.venice.ai/api/v1/chat/completions \ -H "Authorization: Bearer $VENICE_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "openai-gpt-55", "messages": [ {"role": "user", "content": "Summarize this post in five bullets: https://venice.ai/blog/how-to-use-venice-api"} ], "venice_parameters": { "enable_web_scraping": true } }'
import OpenAI from "openai";const client = new OpenAI({ apiKey: process.env.VENICE_API_KEY!, baseURL: "https://api.venice.ai/api/v1",});const response = await client.chat.completions.create({ model: "openai-gpt-55", messages: [ { role: "user", content: "Summarize this post in five bullets: https://venice.ai/blog/how-to-use-venice-api", }, ], // @ts-expect-error - Venice-specific parameter venice_parameters: { enable_web_scraping: true, },});console.log(response.choices[0].message.content);
import osfrom openai import OpenAIclient = OpenAI( api_key=os.environ["VENICE_API_KEY"], base_url="https://api.venice.ai/api/v1",)response = client.chat.completions.create( model="openai-gpt-55", messages=[ { "role": "user", "content": "Summarize this post in five bullets: https://venice.ai/blog/how-to-use-venice-api", } ], extra_body={ "venice_parameters": { "enable_web_scraping": True, } },)print(response.choices[0].message.content)
File Inputs Code Samples
Attach PDFs, Office docs, code, and text files (up to 25MB) directly to a chat request. See the File Inputs guide for the full format list.
# Encode a local file as a base64 data URL, then send it inlineFILE_B64=$(base64 q3-report.pdf | tr -d '\n')curl https://api.venice.ai/api/v1/chat/completions \ -H "Authorization: Bearer $VENICE_API_KEY" \ -H "Content-Type: application/json" \ -d "{ \"model\": \"openai-gpt-55\", \"messages\": [ { \"role\": \"user\", \"content\": [ {\"type\": \"text\", \"text\": \"Summarize this report in five bullets and list the main risks.\"}, {\"type\": \"file\", \"file\": {\"filename\": \"q3-report.pdf\", \"file_data\": \"data:application/pdf;base64,${FILE_B64}\"}} ] } ] }"
import OpenAI from "openai";import { readFile } from "node:fs/promises";const client = new OpenAI({ apiKey: process.env.VENICE_API_KEY!, baseURL: "https://api.venice.ai/api/v1",});const pdf = await readFile("q3-report.pdf");const fileData = `data:application/pdf;base64,${pdf.toString("base64")}`;const response = await client.chat.completions.create({ model: "openai-gpt-55", messages: [ { role: "user", content: [ { type: "text", text: "Summarize this report in five bullets and list the main risks." }, // @ts-expect-error - Venice file input block { type: "file", file: { filename: "q3-report.pdf", file_data: fileData } }, ], }, ],});console.log(response.choices[0].message.content);
import base64import osfrom pathlib import Pathfrom openai import OpenAIclient = OpenAI( api_key=os.environ["VENICE_API_KEY"], base_url="https://api.venice.ai/api/v1",)path = Path("q3-report.pdf")file_data = "data:application/pdf;base64," + base64.b64encode(path.read_bytes()).decode("utf-8")response = client.chat.completions.create( model="openai-gpt-55", messages=[ { "role": "user", "content": [ {"type": "text", "text": "Summarize this report in five bullets and list the main risks."}, {"type": "file", "file": {"filename": "q3-report.pdf", "file_data": file_data}}, ], } ],)print(response.choices[0].message.content)
Crypto RPC Code Samples
Proxy JSON-RPC 2.0 calls across 11 supported chains with your Venice key or an x402 wallet. See the Crypto RPC reference for chains, methods, and credit tiers.