da ▾
Claim trial key
  1. Overview
  2. Quickstart

OpenAI-Compatible API Docs

Connect your existing OpenAI SDK to our uncensored endpoint in minutes. This guide covers the base URL, authentication, and first requests for Python, JavaScript, and streaming.

Base URLhttps://api.consolemistralapi.com/v1
Modeluncensored

Base URL and Authentication

Our API replaces the standard OpenAI base URL with our own endpoint. You authenticate using a single API key passed in the Authorization header. This setup ensures your client code works without modification, just by changing the base URL and key. The base URL is https://api.consolemistralapi.com/v1.

Generate your key via the dashboard. It works immediately with any OpenAI-compatible SDK. You do not need to install extra libraries.

First Request with cURL

Send your first prompt using any HTTP client. The endpoint accepts standard chat completion parameters. This confirms your key and credit balance are active.

curl https://api.consolemistralapi.com/v1/chat/completions \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "uncensored",
    "messages": [{"role": "user", "content": "Return current system uptime stats in JSON format."}]
  }'

The response returns a JSON object with the generated text. Check the usage field to see token consumption. Errors return standard HTTP codes with a JSON error object.

Python SDK Integration

Use the official openai Python package. Configure the client with your key and our base URL. This approach keeps your code compatible with OpenAI’s ecosystem while using our uncensored model.

from openai import OpenAI

client = OpenAI(base_url="https://api.consolemistralapi.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)

The model ID is uncensored. Set parameters like temperature for creativity. The SDK handles JSON serialization automatically. Errors raise standard exceptions you can catch.

Node.js SDK Setup

Initialize the OpenAI Node client with your credentials. Point it to our base URL. This works for both server-side and browser-based applications.

import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://api.consolemistralapi.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);

Request the completion and handle the response. The SDK streams data if enabled. Token usage is reported in the final chunk. Adjust max_tokens to control output length.

Streaming Responses

Enable streaming by setting stream: true. The API returns data chunks as they are generated. This reduces perceived latency for long outputs. The final chunk contains the total token usage.

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)

Buffer the chunks to reconstruct the full text. Use this for chat interfaces or real-time displays. Streaming does not affect token pricing or limits.

Rate Limits and Errors

Respect the limits to avoid service interruptions. The API allows 300 requests per minute per key. You can have 8 concurrent requests. The request body must be under 8 MB. A 429 error indicates you have exceeded these limits. Wait and retry.

Use a 401 error to check your key. A 402 error means your prepaid credit is exhausted. Add more crypto top-up to continue. The context window is 100,000 tokens for prompt and completion combined. Outputs max out at 16,000 tokens. Errors and refusals do not consume credit.

Frequently asked questions

Is console.mistral.api an official Mistral product?

No, this is an independent service hosting an uncensored model. It is compatible with the OpenAI API format but does not serve Mistral’s official models. Check the official Mistral documentation for their specific models and pricing.

How do I know if my API key is valid?

Send a simple request to the chat completions endpoint. A 200 OK response confirms your key and credit balance. A 401 error indicates an invalid key. A 403 error means your account is suspended.

What happens if I exceed the context window?

The API returns an error if the total prompt and completion tokens exceed 100,000. Ensure your input fits within this limit. You can reduce the <code>max_tokens</code> parameter to stay safe. Errors do not charge your credit balance.

Secure your API key

Register, retrieve the token, and update your endpoint. Simple.

Claim trial key