Base URL and Authentication
The base URL for all requests is https://api.veniceaiapipricing.com/v1. You authenticate by passing your API key in the Authorization header as a bearer token. This setup works with any standard OpenAI SDK. Replace YOUR_API_KEY with the key generated from your account dashboard.
- Endpoint:
POST /v1/chat/completions - Header:
Authorization: Bearer YOUR_API_KEY
curl https://api.veniceaiapipricing.com/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "Return server status code 200"}]
}'
The /v1/chat/completions Endpoint
Send your conversation history to /v1/chat/completions using the uncensored model ID. The API accepts standard message objects with role and content fields. Input tokens cost $0.15 per million, and output tokens cost $0.50 per million. Errors and refusals do not consume credit.
This endpoint supports text-only generation. It does not handle images, audio, or embeddings. You can stream responses or retrieve the full text in a single JSON object.
from openai import OpenAI
client = OpenAI(base_url="https://api.veniceaiapipricing.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)
Streaming Responses (SSE)
Enable streaming by setting stream: true in your request body. The API returns Server-Sent Events (SSE) for each token generated. The final chunk contains the total token usage statistics. This method reduces perceived latency for long responses.
Stream handling is essential for real-time applications. You can process tokens as they arrive instead of waiting for the full completion.
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)
Function Calling and JSON Mode
The API supports structured outputs and tool definitions. Use response_format: {"type": "json_object"} to force JSON output. You can also pass tools for function calling, allowing the model to return structured data for your application logic.
This feature is useful for extracting data or triggering actions. The model returns tool calls in a standardized format. You can then execute your functions and feed results back into the conversation.
Parameters: Temperature, Top P, and Seeds
Control creativity with temperature and top_p. The seed parameter ensures deterministic outputs for testing. These parameters follow standard OpenAI conventions. Adjusting them affects the randomness of the generated text.
Set temperature to 0.7 for balanced creativity. Use seed for reproducible results. The API ignores unsupported parameters gracefully.
Rate Limits and Constraints
You are limited to 300 requests per minute per key. A maximum of 8 concurrent requests are allowed per key. The request body size is capped at 8 MB. The context window is 100,000 tokens for input and output combined. Maximum output per request is 16,000 tokens.
Exceeding these limits returns a 429 error. Ensure your client handles retries appropriately. The API key is unique per account; generating a new key replaces the old one.
Node.js
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.veniceaiapipricing.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);