Base URL and Authentication
Connect your application to the voxtral endpoint by setting the base URL to https://api.voxtral.cc/v1. This URL works with the official OpenAI SDKs for Python and Node.js, as well as any HTTP client that supports standard headers. Authentication relies on a single API key generated from your account dashboard. You do not need a phone number to sign up; use the Continue with Google button or create a standard email and password account. Once you click Get API key, the key is displayed immediately. Copy it into your environment variables or configuration file. The key authorizes all requests sent to the base URL. If you lose your key, generate a new one from the dashboard; the previous key is replaced. Keep your key secure, as it draws from your prepaid credit.
Send a Chat Completion Request
Send a standard chat completion request to POST /v1/chat/completions. The endpoint expects a JSON body containing the model name, your messages, and optional parameters. Use the model ID uncensored to access the open-weight model tuned for minimal refusals. You can control the response style with parameters like temperature, top_p, and stop. The API returns the generated text in the choices array. This is the core text generation step for your pipeline. You can use this endpoint for prompt engineering, script writing, or data extraction. The model handles context up to 100,000 tokens. Ensure your input fits within the 8 MB request body limit. If you need structured output, see the JSON mode section.
curl https://api.voxtral.cc/v1/chat/completions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "uncensored",
"messages": [{"role": "user", "content": "Write a blunt product review of a cheap VPN."}]
}'
Python SDK Integration
Use the official OpenAI Python SDK to interact with the voxtral API. Configure the client with your API key and the custom base URL. This approach simplifies request handling and response parsing. The SDK handles serialization and retries automatically. Pass your messages as a list of role-content pairs. The uncensored model responds to standard system and user prompts. You can set the max_tokens to control output length; if unspecified, the response can run to the end of the 100,000-token window. This method is ideal for backend services that need reliable text generation. It works seamlessly with other tools in your stack. Remember that the API key is tied to your prepaid credit. Monitor your usage via the response headers or your account dashboard.
from openai import OpenAI
client = OpenAI(base_url="https://api.voxtral.cc/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)
Node SDK Integration
Integrate the API into your Node.js applications using the OpenAI npm package. Set the base URL and API key in the client configuration. This allows you to send chat completions with familiar syntax. The SDK supports both synchronous and asynchronous calls. Use the uncensored model ID to ensure you are hitting the correct endpoint. You can pass additional parameters like seed for reproducibility or presence_penalty to influence token usage. This integration is suitable for web servers, background workers, or CLI tools. The response object contains the generated text and token usage statistics. Handle errors appropriately, as network issues or invalid keys will raise exceptions. This ensures your pipeline remains robust during text processing tasks.
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "https://api.voxtral.cc/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);
Enable Streaming with SSE
Enable streaming by setting stream: true in your request. The API returns a Server-Sent Events (SSE) stream of partial responses. This reduces perceived latency for end-users by delivering tokens as they are generated. Each chunk contains a fragment of the text. The final chunk includes the total token usage for the request. Streaming is useful for chat interfaces or real-time text displays. It does not affect the model's behavior or accuracy. You must handle the stream properly to collect the full response. If the connection drops, you may lose partial data. Ensure your client library supports SSE parsing. The streaming endpoint respects the same rate limits and token constraints as non-streaming requests.
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)
Limits, Errors, and Context
The API enforces strict limits to ensure stability. You can send 300 requests per minute per key. Only 8 requests can be processed concurrently. The request body must not exceed 8 MB. If your API key is invalid or missing, the server returns a 401 Unauthorized error. If your prepaid credit is exhausted, you receive a 402 Payment Required error. Add funds by crypto (USDT on TRC20, USDC on Base) to resume service. Exceeding the rate limit results in a 429 Too Many Requests error. The context window is 100,000 tokens total. There is no separate output cap. Errors and refusals do not consume credit. Content filters apply only to sexual content involving minors. All other lawful adult content is permitted.