Zum Hauptinhalt springen
In wenigen Minuten mit der Venice API einsatzbereit. Generieren Sie einen API-Schlüssel, stellen Sie Ihre erste Anfrage und starten Sie mit dem Bauen.

Quickstart

1

API-Schlüssel erhalten

Gehen Sie zu Ihren Venice-API-Einstellungen und generieren Sie einen neuen API-Schlüssel.Für eine ausführliche Anleitung siehe den API-Schlüssel-Leitfaden.
2

API-Schlüssel einrichten

Fügen Sie Ihren API-Schlüssel Ihrer Umgebung hinzu. Sie können ihn in Ihrer Shell exportieren:
export VENICE_API_KEY='your-api-key-here'
Oder fügen Sie ihn zu einer .env-Datei in Ihrem Projekt hinzu:
VENICE_API_KEY=your-api-key-here
3

SDK installieren

Venice ist OpenAI-kompatibel, sodass Sie das OpenAI-SDK verwenden können. Wenn Sie lieber cURL oder rohe HTTP-Anfragen verwenden, können Sie diesen Schritt überspringen.
pip install openai
npm install openai
4

Ihre erste Anfrage senden

import os
from openai import OpenAI

client = OpenAI(
    api_key=os.getenv("VENICE_API_KEY"),
    base_url="https://api.venice.ai/api/v1"
)

completion = client.chat.completions.create(
    model="zai-org-glm-5",
    messages=[
        {"role": "system", "content": "You are a helpful AI assistant"},
        {"role": "user", "content": "Why is privacy important?"}
    ]
)

print(completion.choices[0].message.content)
import OpenAI from 'openai';

const client = new OpenAI({
    apiKey: process.env.VENICE_API_KEY,
    baseURL: 'https://api.venice.ai/api/v1'
});

const completion = await client.chat.completions.create({
    model: 'zai-org-glm-5',
    messages: [
        { role: 'system', content: 'You are a helpful AI assistant' },
        { role: 'user', content: 'Why is privacy important?' }
    ]
});

console.log(completion.choices[0].message.content);
curl https://api.venice.ai/api/v1/chat/completions \
  -H "Authorization: Bearer $VENICE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "zai-org-glm-5",
    "messages": [
      {"role": "system", "content": "You are a helpful AI assistant"},
      {"role": "user", "content": "Why is privacy important?"}
    ]
  }'
Nachrichtenrollen:
  • system - Anweisungen für das Verhalten des Modells
  • user - Ihre Prompts oder Fragen
  • assistant - Frühere Modellantworten (für mehrstufige Konversationen)
  • tool - Function-Calling-Ergebnisse (bei Verwendung von Tools)
5

Modelle wechseln durch Ändern der Modell-ID

Jede Anfrage enthält eine model-ID. Um ein anderes Modell zu verwenden, ändern Sie den Wert model in Ihrer Anfrage. Beliebte Optionen:
  • zai-org-glm-5 - Standardmodell für die meisten Use Cases
  • kimi-k2-6 - Starkes Reasoning für komplexere Aufgaben
  • claude-opus-4-8 - High-Intelligence-Modell für komplexe Aufgaben
  • venice-uncensored-1-2 - Venice’s unzensiertes Modell

Alle Modelle ansehen

Durchsuchen Sie die vollständige Liste der Modelle mit Preisen, Capabilities und Kontextlimits
6

Venice-Parameter verwenden

Sie können Venice-spezifische Funktionen wie Web Search über venice_parameters aktivieren:
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ.get("VENICE_API_KEY"),
    base_url="https://api.venice.ai/api/v1"
)

completion = client.chat.completions.create(
    model="zai-org-glm-5",
    messages=[
        {"role": "user", "content": "What are the latest developments in AI?"}
    ],
    extra_body={
        "venice_parameters": {
            "enable_web_search": "auto",
            "include_venice_system_prompt": True
        }
    }
)

print(completion.choices[0].message.content)
import OpenAI from 'openai';

const client = new OpenAI({
    apiKey: process.env.VENICE_API_KEY,
    baseURL: 'https://api.venice.ai/api/v1'
});

const completion = await client.chat.completions.create({
    model: 'zai-org-glm-5',
    messages: [
        { role: 'user', content: 'What are the latest developments in AI?' }
    ],
    venice_parameters: {
        enable_web_search: 'auto',
        include_venice_system_prompt: true
    }
});

console.log(completion.choices[0].message.content);
curl https://api.venice.ai/api/v1/chat/completions \
  -H "Authorization: Bearer $VENICE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "zai-org-glm-5",
    "messages": [
      {"role": "user", "content": "What are the latest developments in AI?"}
    ],
    "venice_parameters": {
      "enable_web_search": "auto",
      "include_venice_system_prompt": true
    }
  }'
Siehe alle verfügbaren Parameter.
7

Streaming aktivieren (optional)

Streamen Sie Antworten in Echtzeit mit stream=True:
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ.get("VENICE_API_KEY"),
    base_url="https://api.venice.ai/api/v1"
)

stream = client.chat.completions.create(
    model="zai-org-glm-5",
    messages=[{"role": "user", "content": "Write a short story about AI"}],
    stream=True
)

for chunk in stream:
    if chunk.choices and chunk.choices[0].delta.content is not None:
        print(chunk.choices[0].delta.content, end="")
import OpenAI from 'openai';

const client = new OpenAI({
    apiKey: process.env.VENICE_API_KEY,
    baseURL: 'https://api.venice.ai/api/v1'
});

const stream = await client.chat.completions.create({
    model: 'zai-org-glm-5',
    messages: [{ role: 'user', content: 'Write a short story about AI' }],
    stream: true
});

for await (const chunk of stream) {
    if (chunk.choices && chunk.choices[0]?.delta?.content) {
        process.stdout.write(chunk.choices[0].delta.content);
    }
}
curl https://api.venice.ai/api/v1/chat/completions \
  -H "Authorization: Bearer $VENICE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "zai-org-glm-5",
    "messages": [
      {"role": "user", "content": "Write a short story about AI"}
    ],
    "stream": true
  }'
8

Antwortverhalten anpassen (optional)

Steuern Sie das Antwortverhalten des Modells mit Parametern wie temperature, max tokens und mehr:
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ.get("VENICE_API_KEY"),
    base_url="https://api.venice.ai/api/v1"
)

completion = client.chat.completions.create(
    model="zai-org-glm-5",
    messages=[
        {"role": "system", "content": "You are a creative storyteller"},
        {"role": "user", "content": "Tell me a creative story"}
    ],
    temperature=0.8,
    max_tokens=500,
    top_p=0.9,
    frequency_penalty=0.5,
    presence_penalty=0.5,
    extra_body={
        "venice_parameters": {
            "include_venice_system_prompt": False
        }
    }
)

print(completion.choices[0].message.content)
import OpenAI from 'openai';

const client = new OpenAI({
    apiKey: process.env.VENICE_API_KEY,
    baseURL: 'https://api.venice.ai/api/v1'
});

const completion = await client.chat.completions.create({
    model: 'zai-org-glm-5',
    messages: [
        { role: 'system', content: 'You are a creative storyteller' },
        { role: 'user', content: 'Tell me a creative story' }
    ],
    temperature: 0.8,
    max_tokens: 500,
    top_p: 0.9,
    frequency_penalty: 0.5,
    presence_penalty: 0.5,
    venice_parameters: {
        include_venice_system_prompt: false
    }
});

console.log(completion.choices[0].message.content);
curl https://api.venice.ai/api/v1/chat/completions \
  -H "Authorization: Bearer $VENICE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "zai-org-glm-5",
    "messages": [
      {"role": "system", "content": "You are a creative storyteller"},
      {"role": "user", "content": "Tell me a creative story"}
    ],
    "temperature": 0.8,
    "max_tokens": 500,
    "top_p": 0.9,
    "frequency_penalty": 0.5,
    "presence_penalty": 0.5,
    "stream": false,
    "venice_parameters": {
      "include_venice_system_prompt": false
    }
  }'
Weitere Informationen zu allen unterstützten Parametern finden Sie in der Chat-Completions-Dokumentation.

Weitere Funktionen

Bildgenerierung

Erstellen Sie Bilder aus Text-Prompts mit Diffusion-Modellen:
import os
import requests

url = "https://api.venice.ai/api/v1/image/generate"

payload = {
    "model": "venice-sd35",
    "prompt": "A cyberpunk city with neon lights and rain",
    "width": 1024,
    "height": 1024,
    "format": "webp"
}

headers = {
    "Authorization": f"Bearer {os.getenv('VENICE_API_KEY')}",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
const url = 'https://api.venice.ai/api/v1/image/generate';

const options = {
    method: 'POST',
    headers: {
        'Authorization': `Bearer ${process.env.VENICE_API_KEY}`,
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({
        model: 'venice-sd35',
        prompt: 'A cyberpunk city with neon lights and rain',
        width: 1024,
        height: 1024,
        format: 'webp'
    })
};

try {
    const response = await fetch(url, options);
    const data = await response.json();
    console.log(data);
} catch (error) {
    console.error(error);
}
curl https://api.venice.ai/api/v1/image/generate \
  -H "Authorization: Bearer $VENICE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "venice-sd35",
    "prompt": "A cyberpunk city with neon lights and rain",
    "width": 1024,
    "height": 1024
  }'
Hinweis: Die Antwort enthält base64-kodierte Bilder im images-Array. Dekodieren Sie den base64-String, um das Bild zu speichern oder anzuzeigen. Beliebte Bildmodelle:
  • qwen-image - Höchste Qualität bei der Bildgenerierung
  • venice-sd35 - Standardwahl, funktioniert mit allen Funktionen
  • hidream - Schnelle Generierung für den Produktiveinsatz

Alle Bildmodelle ansehen

Sehen Sie alle verfügbaren Bildmodelle mit Preisen und Capabilities
Für erweiterte Parameter-Optionen wie cfg_scale, negative_prompt, style_preset, seed, variants und mehr siehe die Images-API-Referenz.

Bildbearbeitung

Modifizieren Sie vorhandene Bilder mit KI-gestütztem Inpainting unter Verwendung des Qwen-Image-Modells:
import os
import requests
import base64

url = "https://api.venice.ai/api/v1/image/edit"

with open("image.jpg", "rb") as f:
    image_base64 = base64.b64encode(f.read()).decode('utf-8')

payload = {
    "prompt": "Colorize",
    "image": image_base64
}

headers = {
    "Authorization": f"Bearer {os.getenv('VENICE_API_KEY')}",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

with open("edited_image.png", "wb") as f:
    f.write(response.content)
import fs from 'fs';

const imageBuffer = fs.readFileSync('image.jpg');
const imageBase64 = imageBuffer.toString('base64');

const options = {
    method: 'POST',
    headers: {
        'Authorization': `Bearer ${process.env.VENICE_API_KEY}`,
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({
        prompt: 'Colorize',
        image: imageBase64
    })
};

const response = await fetch('https://api.venice.ai/api/v1/image/edit', options);
const imageData = await response.arrayBuffer();
fs.writeFileSync('edited_image.png', Buffer.from(imageData));
curl --request POST \
  --url https://api.venice.ai/api/v1/image/edit \
  --header "Authorization: Bearer $VENICE_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
    "prompt": "Colorize",
    "image": "iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAIAAAB7GkOtAAAAIGNIUk0A..."
  }'
Hinweis: Der Image-Editor verwendet das Qwen-Image-Modell und ist ein experimenteller Endpoint. Senden Sie das Eingabebild als base64-kodierten String, und die API gibt das bearbeitete Bild als Binärdaten zurück. Alle Parameter siehe die Image-Edit-API.

Bild-Upscaling

Verbessern und skalieren Sie Bilder auf höhere Auflösungen:
import os
import requests
import base64

url = "https://api.venice.ai/api/v1/image/upscale"

with open("image.jpg", "rb") as f:
    image_base64 = base64.b64encode(f.read()).decode('utf-8')

payload = {
    "image": image_base64,
    "scale": 2
}

headers = {
    "Authorization": f"Bearer {os.getenv('VENICE_API_KEY')}",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

with open("upscaled_image.png", "wb") as f:
    f.write(response.content)
import fs from 'fs';

const imageBuffer = fs.readFileSync('image.jpg');
const imageBase64 = imageBuffer.toString('base64');

const options = {
    method: 'POST',
    headers: {
        'Authorization': `Bearer ${process.env.VENICE_API_KEY}`,
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({
        image: imageBase64,
        scale: 2
    })
};

const response = await fetch('https://api.venice.ai/api/v1/image/upscale', options);
const imageData = await response.arrayBuffer();
fs.writeFileSync('upscaled_image.png', Buffer.from(imageData));
curl --request POST \
  --url https://api.venice.ai/api/v1/image/upscale \
  --header "Authorization: Bearer $VENICE_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
    "image": "iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAIAAAB7GkOtAAAAIGNIUk0A...",
    "scale": 2
  }'
Hinweis: Senden Sie das Eingabebild als base64-kodierten String, und die API gibt das hochskalierte Bild als Binärdaten zurück. Alle Parameter siehe die Image-Upscale-API.

Text-to-Speech

Wandeln Sie Text in Audio mit mehr als 50 mehrsprachigen Stimmen um:
import os
import requests

response = requests.post(
    "https://api.venice.ai/api/v1/audio/speech",
    headers={
        "Authorization": f"Bearer {os.getenv('VENICE_API_KEY')}",
        "Content-Type": "application/json"
    },
    json={
        "input": "Hello, welcome to Venice Voice.",
        "model": "tts-kokoro",
        "voice": "af_sky"
    }
)

with open("speech.mp3", "wb") as f:
    f.write(response.content)
import fs from 'fs';

const response = await fetch('https://api.venice.ai/api/v1/audio/speech', {
    method: 'POST',
    headers: {
        'Authorization': `Bearer ${process.env.VENICE_API_KEY}`,
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({
        input: 'Hello, welcome to Venice Voice.',
        model: 'tts-kokoro',
        voice: 'af_sky'
    })
});

const audioBuffer = await response.arrayBuffer();
fs.writeFileSync('speech.mp3', Buffer.from(audioBuffer));
curl --request POST \
  --url https://api.venice.ai/api/v1/audio/speech \
  --header "Authorization: Bearer $VENICE_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
    "input": "Hello, welcome to Venice Voice.",
    "model": "tts-kokoro",
    "voice": "af_sky"
  }' \
  --output speech.mp3
Das tts-kokoro-Modell unterstützt mehr als 50 mehrsprachige Stimmen, einschließlich af_sky, af_nova, am_liam, bf_emma, zf_xiaobei und jm_kumo. Alle Stimm-Optionen siehe die TTS-API.

Speech-to-Text

Transkribieren Sie Audiodateien zu Text:
import os
import requests

url = "https://api.venice.ai/api/v1/audio/transcriptions"

with open("audio.mp3", "rb") as f:
    response = requests.post(
        url,
        headers={"Authorization": f"Bearer {os.getenv('VENICE_API_KEY')}"},
        files={"file": f},
        data={
            "model": "nvidia/parakeet-tdt-0.6b-v3",
            "response_format": "json"
        }
    )

print(response.json())
import fs from 'fs';
import FormData from 'form-data';

const form = new FormData();
form.append('file', fs.createReadStream('audio.mp3'));
form.append('model', 'nvidia/parakeet-tdt-0.6b-v3');
form.append('response_format', 'json');

const response = await fetch('https://api.venice.ai/api/v1/audio/transcriptions', {
    method: 'POST',
    headers: {
        'Authorization': `Bearer ${process.env.VENICE_API_KEY}`,
        ...form.getHeaders()
    },
    body: form
});

const data = await response.json();
console.log(data);
curl --request POST \
  --url https://api.venice.ai/api/v1/audio/transcriptions \
  --header "Authorization: Bearer $VENICE_API_KEY" \
  --form file=@audio.mp3 \
  --form model=nvidia/parakeet-tdt-0.6b-v3 \
  --form response_format=json
Unterstützte Formate: WAV, FLAC, MP3, M4A, AAC, MP4. Aktivieren Sie timestamps=true, um Timing-Daten auf Wort-Ebene zu erhalten. Alle Optionen siehe die Transcriptions-API.

Embeddings

Generieren Sie Vektor-Embeddings für semantische Suche, RAG und Empfehlungen:
import os
import requests

url = "https://api.venice.ai/api/v1/embeddings"

payload = {
    "model": "text-embedding-bge-m3",
    "input": "Privacy-first AI infrastructure for semantic search",
    "encoding_format": "float"
}

headers = {
    "Authorization": f"Bearer {os.getenv('VENICE_API_KEY')}",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
const url = 'https://api.venice.ai/api/v1/embeddings';

const options = {
    method: 'POST',
    headers: {
        'Authorization': `Bearer ${process.env.VENICE_API_KEY}`,
        'Content-Type': 'application/json'
    },
    body: JSON.stringify({
        model: 'text-embedding-bge-m3',
        input: 'Privacy-first AI infrastructure for semantic search',
        encoding_format: 'float'
    })
};

try {
    const response = await fetch(url, options);
    const data = await response.json();
    console.log(data);
} catch (error) {
    console.error(error);
}
curl --request POST \
  --url https://api.venice.ai/api/v1/embeddings \
  --header "Authorization: Bearer $VENICE_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
    "model": "text-embedding-bge-m3",
    "input": "Privacy-first AI infrastructure for semantic search",
    "encoding_format": "float"
  }'
Batch-Verarbeitung und erweiterte Optionen siehe die Embeddings-API.

Vision (Multimodal)

Analysieren Sie Bilder gemeinsam mit Text mit vision-fähigen Modellen wie qwen3-vl-235b-a22b:
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.getenv("VENICE_API_KEY"),
    base_url="https://api.venice.ai/api/v1"
)

response = client.chat.completions.create(
    model="qwen3-vl-235b-a22b",
    messages=[
        {
            "role": "user",
            "content": [
                {"type": "text", "text": "What is in this image?"},
                {
                    "type": "image_url",
                    "image_url": {"url": "https://www.gstatic.com/webp/gallery/1.jpg"}
                }
            ]
        }
    ]
)

print(response.choices[0].message.content)
import OpenAI from 'openai';

const client = new OpenAI({
    apiKey: process.env.VENICE_API_KEY,
    baseURL: 'https://api.venice.ai/api/v1'
});

const response = await client.chat.completions.create({
    model: 'qwen3-vl-235b-a22b',
    messages: [
        {
            role: 'user',
            content: [
                { type: 'text', text: 'What is in this image?' },
                {
                    type: 'image_url',
                    image_url: { url: 'https://www.gstatic.com/webp/gallery/1.jpg' }
                }
            ]
        }
    ]
});

console.log(response.choices[0].message.content);
curl https://api.venice.ai/api/v1/chat/completions \
  -H "Authorization: Bearer $VENICE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen3-vl-235b-a22b",
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "type": "text",
            "text": "What is in this image?"
          },
          {
            "type": "image_url",
            "image_url": {
              "url": "https://www.gstatic.com/webp/gallery/1.jpg"
            }
          }
        ]
      }
    ]
  }'

Function Calling

Definieren Sie Funktionen, die Modelle aufrufen können, um mit externen Tools und APIs zu interagieren:
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.getenv("VENICE_API_KEY"),
    base_url="https://api.venice.ai/api/v1"
)

tools = [
    {
        "type": "function",
        "function": {
            "name": "get_weather",
            "description": "Get the current weather in a location",
            "parameters": {
                "type": "object",
                "properties": {
                    "location": {
                        "type": "string",
                        "description": "The city and state"
                    }
                },
                "required": ["location"]
            }
        }
    }
]

response = client.chat.completions.create(
    model="zai-org-glm-5",
    messages=[{"role": "user", "content": "What's the weather in San Francisco?"}],
    tools=tools
)

print(response.choices[0].message)
import OpenAI from 'openai';

const client = new OpenAI({
    apiKey: process.env.VENICE_API_KEY,
    baseURL: 'https://api.venice.ai/api/v1'
});

const tools = [
    {
        type: 'function',
        function: {
            name: 'get_weather',
            description: 'Get the current weather in a location',
            parameters: {
                type: 'object',
                properties: {
                    location: {
                        type: 'string',
                        description: 'The city and state'
                    }
                },
                required: ['location']
            }
        }
    }
];

const response = await client.chat.completions.create({
    model: 'zai-org-glm-5',
    messages: [{ role: 'user', content: "What's the weather in San Francisco?" }],
    tools: tools
});

console.log(response.choices[0].message);
curl https://api.venice.ai/api/v1/chat/completions \
  -H "Authorization: Bearer $VENICE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "zai-org-glm-5",
    "messages": [
      {
        "role": "user",
        "content": "What'\''s the weather in San Francisco?"
      }
    ],
    "tools": [
      {
        "type": "function",
        "function": {
          "name": "get_weather",
          "description": "Get the current weather in a location",
          "parameters": {
            "type": "object",
            "properties": {
              "location": {
                "type": "string",
                "description": "The city and state"
              }
            },
            "required": ["location"]
          }
        }
      }
    ]
  }'

Nächste Schritte

Jetzt, da Sie Ihre ersten Anfragen gestellt haben, entdecken Sie mehr von dem, was die Venice API zu bieten hat:

Modelle durchsuchen

Vergleichen Sie alle verfügbaren Modelle mit ihren Capabilities, Preisen und Kontextlimits

API-Referenz

Erkunden Sie die detaillierte API-Dokumentation mit allen Endpoints und Parametern

Strukturierte Antworten

Erfahren Sie, wie Sie JSON-Antworten mit garantierten Schemas erhalten

AI-Agents-Leitfaden

Bauen Sie mit Agent-Apps, Coding-Agenten, MCP-Tools, Skills und Krypto-Workflows

Zusätzliche Ressourcen

Rate Limiting

Verstehen Sie Rate-Limits und Best Practices für den Produktiveinsatz

Fehlercodes

Referenz für den Umgang mit API-Fehlern und Troubleshooting

Postman-Collection

Importieren Sie unsere vollständige Postman-Collection zum einfachen Testen

Datenschutz & Sicherheit

Erfahren Sie mehr über die datenschutzorientierte Architektur und Datenverarbeitung von Venice

Brauchen Sie Hilfe?