OpenAI-compatible

Violations AI API

Unified, OpenAI-style endpoints with credits, pricing, and rate limiting — served from ai.violations.cc.

Base URL

https://ai.violations.cc

Content Type

application/json

Auth Scheme

Bearer sk_…

Authentication

Include your API key in the Authorization header. Keys look like sk-********.

Authorization: Bearer sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Endpoints

GET /v1/models

List available models.

Headers

  • Authorization: Bearer sk-… (required)
  • Content-Type: application/json

Request

No body. This endpoint is authenticated.

Response

{
  "object": "list",
  "data": [
    { "id": "gpt-4.1-mini", "owned_by": "violations", ... }
  ]
}

Status Codes

  • 200 OK
  • 401 Unauthorized
  • 500 Internal Server Error
POST /v1/chat/completions

OpenAI-style chat completions. Vision is auto-bridged when the chosen model lacks vision.

Headers

  • Authorization: Bearer sk-… (required)
  • Content-Type: application/json

Body

{
  "model": "gpt-4.1-mini",            // required
  "messages": [                        // required
    { "role": "system", "content": "You are helpful." },
    { "role": "user",   "content": "Hello" }
  ],
  "stream": false,                     // optional
  "max_tokens": 256                    // optional
  // Other OpenAI-compatible params are pass-through (temperature, top_p, etc.)
}

Notes

  • Charges credits based on model pricing and usage.
  • Respects per-key RPM/RPD rate limits.
  • Streaming uses SSE; the server forwards events and logs usage on completion.
  • Images in messages are summarized via a vision-capable model when necessary.

Status Codes

  • 200 OK
  • 401 Unauthorized
  • 402 Insufficient credits
  • 429 Rate limit exceeded
  • 500 Internal Server Error
POST /v1/completions

Legacy text completions.

Headers

  • Authorization: Bearer sk-… (required)
  • Content-Type: application/json

Body

{
  "model": "gpt-4.1-mini",   // required
  "prompt": "Once upon a time", // required
  "stream": false,             // optional
  "max_tokens": 256            // optional
}

Status Codes

  • 200 OK
  • 401 Unauthorized
  • 402 Insufficient credits
  • 429 Rate limit exceeded
  • 500 Internal Server Error
POST /v1/images/generations

OpenAI-style image generation backed by Gemini (Nano Banana) and Imagen.

Headers

  • Authorization: Bearer sk-… (required)
  • Content-Type: application/json

Body

{
  "model": "gemini-2.5-flash-image",   // defaults to Nano Banana
  "prompt": "An art deco poster of a cyberpunk city",
  "n": 1,
  "size": "1024x1024",
  "response_format": "b64_json"
}

Notes

  • Gemini image models: gemini-2.5-flash-image, gemini-3-pro-image-preview.
  • Imagen models (e.g. imagen-3.0-generate-002) also supported.
  • Remote image_url references are fetched and inlined automatically when used via chat.
  • response_format can be b64_json or url (data URL).

Status Codes

  • 200 OK
  • 400 Validation errors
  • 401 Unauthorized
  • 402 Insufficient credits
  • 500 Internal Server Error
POST /v1/audio/music

Generate PCM audio by proxying to Gemini’s Lyria RealTime (music) API.

Headers

  • Authorization: Bearer sk-… (required)
  • Content-Type: application/json

Body

{
  "model": "lyria-realtime-exp",
  "prompt": "Ambient synthwave with gentle percussion",
  "duration_seconds": 8,
  "music_generation_config": {
    "bpm": 95,
    "temperature": 1.0
  }
}

Notes

  • Returns b64_audio PCM chunks along with MIME type metadata.
  • prompt can be a string or weighted_prompts array to steer Lyria.
  • duration_seconds is clamped to 4–30 seconds per call.
  • Credits are charged based on the requested duration.

Status Codes

  • 200 OK
  • 400 Validation errors
  • 401 Unauthorized
  • 402 Insufficient credits
  • 500 Internal Server Error
GET /health

Service health check.

Headers

No authentication required.

Response

{
  "status": "OK",
  "timestamp": "2025-01-01T00:00:00.000Z"
}

Status Codes

  • 200 OK

Examples

curl -s -X POST "https://ai.violations.cc/v1/chat/completions" \
  -H "Authorization: Bearer sk-your-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4.1-mini",
    "messages": [
      {"role":"system","content":"You are helpful."},
      {"role":"user","content":"Say hello in 5 words."}
    ]
  }'
import OpenAI from 'openai';

const client = new OpenAI({
  baseURL: `https://ai.violations.cc/v1`,
  apiKey: 'sk-your-key'
});

const completion = await client.chat.completions.create({
  model: 'gpt-4.1-mini',
  messages: [
    { role: 'system', content: 'You are helpful.' },
    { role: 'user', content: 'Say hello in 5 words.' }
  ]
});

console.log(completion.choices[0].message.content);
from openai import OpenAI

client = OpenAI(
    base_url=f"https://ai.violations.cc/v1",
    api_key="sk-your-key",
)

resp = client.chat.completions.create(
    model="gpt-4.1-mini",
    messages=[
        {"role": "system", "content": "You are helpful."},
        {"role": "user", "content": "Say hello in 5 words."},
    ],
)

print(resp.choices[0].message.content)
curl -N -X POST "https://ai.violations.cc/v1/chat/completions" \
  -H "Authorization: Bearer sk-your-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4.1-mini",
    "stream": true,
    "messages": [
      {"role":"user","content":"Stream a short greeting."}
    ]
  }'
import OpenAI from 'openai';

const client = new OpenAI({ baseURL: `https://ai.violations.cc/v1`, apiKey: 'sk-your-key' });

const stream = await client.chat.completions.create({
  model: 'gpt-4.1-mini',
  stream: true,
  messages: [{ role: 'user', content: 'Stream a short greeting.' }]
});

for await (const chunk of stream) {
  const content = chunk.choices?.[0]?.delta?.content || '';
  process.stdout.write(content);
}
from openai import OpenAI

client = OpenAI(base_url="https://ai.violations.cc/v1", api_key="sk-your-key")

stream = client.chat.completions.create(
    model="gpt-4.1-mini",
    stream=True,
    messages=[{"role": "user", "content": "Stream a short greeting."}],
)

for chunk in stream:
    content = getattr(chunk.choices[0].delta, "content", None)
    if content:
        print(content, end="")
curl -s -X POST "https://ai.violations.cc/v1/chat/completions" \
  -H "Authorization: Bearer sk-your-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4.1", 
    "messages": [
      {"role":"user","content":[
        {"type":"text","text":"Describe this image succinctly."},
        {"type":"image_url","image_url":{"url":"https://example.com/cat.jpg"}}
      ]}
    ]
  }'
import OpenAI from 'openai';

const client = new OpenAI({ baseURL: `https://ai.violations.cc/v1`, apiKey: 'sk-your-key' });

const completion = await client.chat.completions.create({
  model: 'gpt-4.1',
  messages: [{
    role: 'user',
    content: [
      { type: 'text', text: 'Describe this image succinctly.' },
      { type: 'image_url', image_url: { url: 'https://example.com/cat.jpg' } }
    ]
  }]
});

console.log(completion.choices[0].message.content);
from openai import OpenAI

client = OpenAI(base_url=f"https://ai.violations.cc/v1", api_key="sk-your-key")

resp = client.chat.completions.create(
    model="gpt-4.1",
    messages=[{
        "role": "user",
        "content": [
            {"type": "text", "text": "Describe this image succinctly."},
            {"type": "image_url", "image_url": {"url": "https://example.com/cat.jpg"}}
        ]
    }]
)

print(resp.choices[0].message.content)
curl -s -X POST "https://ai.violations.cc/v1/images/generations" \
  -H "Authorization: Bearer sk-your-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-2.5-flash-image",
    "prompt": "Neon synthwave skyline over an endless ocean",
    "size": "1024x1024",
    "n": 1
  }'
import OpenAI from 'openai';

const client = new OpenAI({
  baseURL: 'https://ai.violations.cc/v1',
  apiKey: 'sk-your-key'
});

const result = await client.images.generate({
  model: 'gemini-3-pro-image-preview',
  prompt: 'Ultra wide shot of a rainy cyberpunk market, cinematic lighting',
  size: '1024x1024',
  n: 1
});

const imageBase64 = result.data[0].b64_json;
from openai import OpenAI
import base64, pathlib, datetime

client = OpenAI(base_url="https://ai.violations.cc/v1", api_key="sk-your-key")

resp = client.images.generate(
    model="gemini-2.5-flash-image",
    prompt="A stylized illustration of a nano banana spaceship over Earth",
    size="1024x1024",
    n=1,
)

image_bytes = base64.b64decode(resp.data[0].b64_json)
path = pathlib.Path("image_outputs")
path.mkdir(exist_ok=True)
filename = path / f"{datetime.datetime.utcnow():%Y%m%d-%H%M%S}.png"
filename.write_bytes(image_bytes)
curl -s -X POST "https://ai.violations.cc/v1/audio/music" \
  -H "Authorization: Bearer sk-your-key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "lyria-realtime-exp",
    "prompt": "Lo-fi beat with vinyl crackle and warm pads",
    "duration_seconds": 10
  }'
import fs from 'node:fs';

const resp = await fetch('https://ai.violations.cc/v1/audio/music', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer sk-your-key',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    model: 'lyria-realtime-exp',
    prompt: 'Slow cinematic strings with subtle percussion',
    duration_seconds: 6
  })
});

const payload = await resp.json();
const audio = Buffer.from(payload.data[0].b64_audio, 'base64');
fs.writeFileSync('lyria-demo.pcm', audio);
import base64
import requests

resp = requests.post(
    "https://ai.violations.cc/v1/audio/music",
    headers={
        "Authorization": "Bearer sk-your-key",
        "Content-Type": "application/json",
    },
    json={
        "model": "lyria-realtime-exp",
        "prompt": "Minimal techno with evolving pads",
        "duration_seconds": 8,
    },
)
resp.raise_for_status()
payload = resp.json()

audio_bytes = base64.b64decode(payload["data"][0]["b64_audio"])
with open("lyria-demo.pcm", "wb") as f:
    f.write(audio_bytes)