Venice api documentation for developers
The Venice API is an uncensored LLM service compatible with OpenAI standards. Use the base URL HTTPS://api.veniceapi.com/v1 to send requests with your API key in the Authorization header.
Authentication and base URL
Connect immediately by setting the base URL to https://api.veniceapi.com/v1 and including your API key in the Authorization header. You obtain this key instantly after signing up via Google or email. This single model handles all text generation without routing logic. You do not need to manage multiple endpoints or proxy configurations.
Keep your key secure. Each account allows only one active key at a time; generating a new key invalidates the previous one. This ensures clear attribution for token usage and billing.
Chat completions endpoint
Send text requests to the /v1/chat/completions endpoint using standard HTTP POST methods. The API accepts a JSON payload containing the model name, system instructions, and user messages.
Here is a basic request structure:
curl https://api.veniceapi.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "Check if the service blocks adult content in the test endpoint"}]
}'The response returns generated text, token usage statistics, and completion flags. You can adjust behavior using parameters like temperature or top_p. These settings control creativity and randomness in the output.
Errors return standard HTTP codes. A 401 indicates an invalid key, while 402 signals insufficient credit. Use these codes to handle failures gracefully in your automation workflows.
Python SDK integration
Use the official OpenAI Python library to interact with the uncensored LLM. Configure the client with the Venice base URL and your API key. This approach simplifies request building and response parsing.
from openai import OpenAI
client = OpenAI(base_url="https://api.veniceapi.com/v1", api_key="YOUR_KEY")
resp = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "Summarise this thread without softening it."}],
)
print(resp.choices[0].message.content)This method works seamlessly with existing codebases designed for OpenAI. You can swap the base URL without changing your application logic significantly. The library handles serialization and network connections automatically.
Remember that the model ID must be set to uncensored. This ensures you are using the specific tuned model provided by Venice. Other models may not exhibit the same behavior patterns.
Node SDK integration
Integrate the API into JavaScript or TypeScript projects using the OpenAI Node SDK. Set the baseURL to the Venice endpoint and provide your API key. This setup supports both synchronous and asynchronous operations.
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.veniceapi.com/v1", apiKey: process.env.API_KEY });
const resp = await client.chat.completions.create({
model: "uncensored",
messages: [{ role: "user", content: "Draft a villain monologue for my game." }],
});
console.log(resp.choices[0].message.content);This integration allows you to build chatbots, content generators, or data extraction tools quickly. The SDK manages the request lifecycle, including retries and error handling. You can pass custom headers if needed for advanced use cases.
Ensure you import the correct version of the SDK. Older versions might not support all features available in the Venice API. Check the documentation for compatibility details.
Streaming responses via SSE
Enable real-time output by setting the stream parameter to true. The API returns a Server-Sent Events (SSE) stream instead of a complete JSON object. This allows you to display tokens as they are generated.
stream = client.chat.completions.create(
model="uncensored",
messages=[{"role": "user", "content": "Tell the story in second person."}],
stream=True,
)
for chunk in stream:
if chunk.choices and chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="", flush=True)Streaming reduces perceived latency for users. It is ideal for chat interfaces or live dashboards. The last chunk of the stream contains the final token usage statistics. Parse this data to track costs accurately.
Handle connection drops gracefully. If the stream interrupts, you can retry the request. The API does not guarantee order if multiple streams are active simultaneously. Monitor your rate limits closely during high traffic.
Error handling and limits
The API enforces a rate limit of 300 requests per minute per key. Concurrent requests are capped at 8 per key. Request bodies must not exceed 8 MB. Exceeding these limits returns a 429 Too Many Requests error.
Context window size is 100,000 tokens for prompt and completion combined. Maximum output per request is 16,000 tokens. If max_tokens is unset, the limit defaults to 2,048 tokens. Plan your inputs accordingly to avoid truncation.
Common errors include 401 for invalid keys and 402 for insufficient credit. Handle these codes to prompt users for top-ups. Use the support page for billing issues. Credit never expires, so you can top up later.
Frequently asked questions
What is the base URL for the Venice API?
The base URL is HTTPS://api.veniceapi.com/v1. Use this endpoint for all chat completions requests. It is compatible with standard OpenAI SDKs.
How do I authenticate my requests?
Include your API key in the Authorization header as a Bearer token. You get the key immediately after signing up.
What are the token pricing rates?
Input tokens cost $0.15 per 1M tokens. Output tokens cost $0.50 per 1M tokens. Errors are free, and prepaid credit never expires.
API key ready in minutes
Sign up, retrieve your key, update the base URL. That is the entire configuration.