API Reference

Complete reference for interacting with the Chat API

Chat CompletionsPOST
Create a chat completion response for the given conversation

Endpoint

POST https://uncensored.chat/api/v1/chat/completions

Headers

AuthorizationBearer YOUR_API_KEY
Content-Typeapplication/json

Request Parameters

modelrequiredstring

The model to use for completion. E.g., "uncensored-v2"

messagesrequiredarray

Array of message objects. Each message has a "role" (user/assistant/system) and "content".

streamoptionalboolean

Whether to stream partial progress. Default: false

temperatureoptionalnumber

Sampling temperature between 0 and 2. Higher values make output more random.

max_tokensoptionalinteger

Maximum number of tokens to generate in the completion.

Request Example

{
    "model": "uncensored-v2",
    "messages": [
        {
            "role": "user",
            "content": "tell me a big story"
        }
    ],
    "stream": true,
    "temperature": 0.7,
    "max_tokens": 1000
}

Response Examples

{
    "id": "chatcmpl-123",
    "object": "chat.completion",
    "created": 1728345600,
    "model": "uncensored-v2",
    "choices": [
        {
            "index": 0,
            "message": {
                "role": "assistant",
                "content": "Here's a big story for you..."
            },
            "finish_reason": "stop"
        }
    ],
    "usage": {
        "prompt_tokens": 10,
        "completion_tokens": 150,
        "total_tokens": 160
    }
}

Code Examples

curl -X POST https://uncensored.chat/api/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "uncensored-v2",
    "messages": [
      {
        "role": "user",
        "content": "tell me a big story"
      }
    ],
    "stream": true
  }'
Response Codes
HTTP status codes returned by the API
200OK
Request successful
400Bad Request
Invalid request parameters
401Unauthorized
Invalid or missing API key
429Rate Limited
Too many requests
500Server Error
Internal server error