diff --git a/ar/overview/getting-started.mdx b/ar/overview/getting-started.mdx index af44191..5a6cfcc 100644 --- a/ar/overview/getting-started.mdx +++ b/ar/overview/getting-started.mdx @@ -1,335 +1,340 @@ --- -title: البدء -description: "بدء سريع لـ Venice API — أنشئ مفتاح API، أرسل أول chat completion، واستكشف endpoints الصور والفيديو والصوت في دقائق." -"og:title": "البدء السريع | وثائق Venice API" +title: "البدء السريع" +description: "دليل البدء السريع لواجهة Venice API — أنشئ مفتاح API، وأرسل أول طلب إكمال محادثة، واستكشف نقاط النهاية الخاصة بالصور والفيديو والصوت في دقائق." +og:title: "البدء السريع | وثائق Venice API" --- -ابدأ مع Venice API في دقائق. ولِّد مفتاح API، ونفّذ طلبك الأول، وابدأ البناء. +ابدأ باستخدام Venice API في دقائق. أنشئ مفتاح API، وقم بإجراء أول طلب لك، وابدأ في البناء. ## البدء السريع - اذهب إلى [إعدادات Venice API](https://venice.ai/settings/api) وأنشئ مفتاح API جديدًا. + توجه إلى [إعدادات Venice API](https://venice.ai/settings/api) وقم بإنشاء مفتاح API جديد. - للحصول على إرشادات تفصيلية، راجع [دليل مفتاح API](/guides/getting-started/generating-api-key). + للحصول على شرح تفصيلي، راجع [دليل مفتاح API](/guides/getting-started/generating-api-key). - - - أضف مفتاح API إلى بيئتك. يمكنك تصديره في الصدفة: + + أضف مفتاح API إلى بيئتك. يمكنك تصديره في الطرفية (shell): ```bash export VENICE_API_KEY='your-api-key-here' ``` - أو إضافته إلى ملف `.env` في مشروعك: + أو أضفه إلى ملف `.env` في مشروعك: ```bash VENICE_API_KEY=your-api-key-here ``` - - - Venice متوافق مع OpenAI، لذا يمكنك استخدام OpenAI SDK. إن فضّلت استخدام cURL أو طلبات HTTP خام، يمكنك تخطّي هذه الخطوة. + + Venice متوافقة مع OpenAI، لذا يمكنك استخدام OpenAI SDK. إذا كنت تفضل استخدام cURL أو طلبات HTTP الأولية، فيمكنك تخطي هذه الخطوة. - ```bash Python - pip install openai - ``` - ```bash Node.js - npm install openai - ``` + ```bash Python + pip install openai + ``` + + ```bash Node.js + npm install openai + ``` + - - + - ```python Python - 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) - ``` - - ```javascript Node.js - 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); - ``` - - ```bash cURL - 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": [ + + ```python Python + 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) + ``` + + ```javascript Node.js + 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); + ``` + + ```bash cURL + 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?"} + ] + }' + ``` + **أدوار الرسائل:** - - `system` - تعليمات لكيفية تصرّف النموذج - - `user` - تعليماتك أو أسئلتك - - `assistant` - استجابات النموذج السابقة (لمحادثات متعددة الأدوار) + + - `system` - تعليمات حول كيفية تصرف النموذج + - `user` - مطالباتك أو أسئلتك + - `assistant` - ردود النموذج السابقة (للمحادثات متعددة الأدوار) - `tool` - نتائج استدعاء الدوال (عند استخدام الأدوات) + + يتضمن كل طلب معرّف `model`. لاستخدام نموذج مختلف، غيّر قيمة `model` في طلبك. الخيارات الشائعة: - - يتضمن كل طلب معرّف `model`. لاستخدام نموذج مختلف، غيّر قيمة `model` في طلبك. خيارات شائعة: - `zai-org-glm-5` - النموذج الافتراضي لمعظم حالات الاستخدام - - `kimi-k2-6` - تفكير قوي للمهام الأكثر تعقيدًا + - `kimi-k2-6` - استدلال قوي للمهام الأكثر تعقيدًا - `claude-opus-4-8` - نموذج عالي الذكاء للمهام المعقدة - - `venice-uncensored-1-2` - النموذج غير المُقيَّد من Venice + - `venice-uncensored-1-2` - نموذج Venice غير الخاضع للرقابة - - تصفّح القائمة الكاملة للنماذج مع التسعير والقدرات وحدود السياق + + تصفح القائمة الكاملة للنماذج مع الأسعار والقدرات وحدود السياق - - - يمكنك تفعيل ميزات خاصة بـ Venice مثل البحث في الويب باستخدام `venice_parameters`: + + يمكنك اختيار تمكين الميزات الخاصة بـ Venice مثل البحث على الويب باستخدام `venice_parameters`: - ```python Python - 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) - ``` - - ```javascript Node.js - 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); - ``` - - ```bash cURL - 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": [ + + ```python Python + 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?"} - ], - "venice_parameters": { - "enable_web_search": "auto", - "include_venice_system_prompt": true - } - }' - ``` + ], + extra_body={ + "venice_parameters": { + "enable_web_search": "auto", + "include_venice_system_prompt": True + } + } + ) + + print(completion.choices[0].message.content) + ``` + + ```javascript Node.js + 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); + ``` + + ```bash cURL + 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 + } + }' + ``` + - راجع كل [المعاملات المتاحة](https://docs.venice.ai/api-reference/api-spec#venice-parameters). + راجع جميع [المعاملات المتاحة](https://docs.venice.ai/api-reference/api-spec#venice-parameters). - - - بثّ الاستجابات في الوقت الفعلي باستخدام `stream=True`: + + قم ببث الردود في الوقت الفعلي باستخدام `stream=True`: - ```python Python - 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="") - ``` - - ```javascript Node.js - 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); - } - } - ``` - - ```bash cURL - 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 - }' - ``` + + ```python Python + 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="") + ``` + + ```javascript Node.js + 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); + } + } + ``` + + ```bash cURL + 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 + }' + ``` + - - - تحكّم بكيفية استجابة النموذج بمعاملات مثل temperature و max tokens والمزيد: + + تحكم في كيفية استجابة النموذج باستخدام معاملات مثل temperature و max tokens وغيرها: - ```python Python - 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) - ``` - - ```javascript Node.js - 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); - ``` - - ```bash cURL - 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": [ + + ```python Python + 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, - "stream": false, - "venice_parameters": { - "include_venice_system_prompt": false - } - }' - ``` + ], + 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) + ``` + + ```javascript Node.js + 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); + ``` + + ```bash cURL + 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 + } + }' + ``` + راجع [وثائق Chat Completions](/api-reference/endpoint/chat/completions) لمزيد من المعلومات حول جميع المعاملات المدعومة. @@ -338,669 +343,55 @@ description: "بدء سريع لـ Venice API — أنشئ مفتاح API، أر --- -## قدرات إضافية - -### توليد الصور - -أنشئ صورًا من تعليمات نصية باستخدام نماذج الانتشار: - - - ```python Python - 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()) - ``` - - ```javascript Node.js - 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); - } - ``` - - ```bash cURL - 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 - }' - ``` - - -**ملاحظة:** تُرجع الاستجابة صورًا مُرمَّزة بـ base64 في مصفوفة `images`. فكّ ترميز سلسلة base64 لحفظ الصورة أو عرضها. - -**نماذج صور شائعة:** -- `qwen-image` - أعلى جودة لتوليد الصور -- `venice-sd35` - الخيار الافتراضي، يعمل مع جميع الميزات -- `hidream` - توليد سريع للاستخدام الإنتاجي - - - راجع كل نماذج الصور المتاحة مع التسعير والقدرات - - -لخيارات معاملات أكثر تقدمًا مثل `cfg_scale` و `negative_prompt` و `style_preset` و `seed` و `variants` وغيرها، راجع [مرجع Images API](/api-reference/endpoint/image/generate). - -### تحرير الصور - -عدّل الصور الموجودة بـ inpainting مدفوع بالذكاء الاصطناعي باستخدام نموذج Qwen-Image: - - - ```python Python - 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) - ``` - - ```javascript Node.js - 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)); - ``` - - ```bash cURL - 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..." - }' - ``` - - -**ملاحظة:** يستخدم محرّر الصور نموذج Qwen-Image وهو نقطة نهاية تجريبية. أرسل صورة الإدخال كسلسلة مُرمَّزة بـ base64، وتُرجع الواجهة الصورة المعدّلة كبيانات ثنائية. - -راجع [Image Edit API](/api-reference/endpoint/image/edit) لجميع المعاملات. - -### ترقية دقّة الصور - -حسّن الصور إلى دقّات أعلى: - - - ```python Python - 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) - ``` - - ```javascript Node.js - 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)); - ``` - - ```bash cURL - 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 - }' - ``` - - -**ملاحظة:** أرسل صورة الإدخال كسلسلة مُرمَّزة بـ base64، وتُرجع الواجهة الصورة المُرقّاة كبيانات ثنائية. - -راجع [Image Upscale API](/api-reference/endpoint/image/upscale) لجميع المعاملات. - -### من نص إلى كلام - -حوّل النص إلى صوت مع أكثر من 50 صوتًا متعدد اللغات: - - - ```python Python - 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) - ``` - - ```javascript Node.js - 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)); - ``` - - ```bash cURL - 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 - ``` - - -يدعم نموذج `tts-kokoro` أكثر من 50 صوتًا متعدد اللغات بما في ذلك `af_sky` و`af_nova` و`am_liam` و`bf_emma` و`zf_xiaobei` و`jm_kumo`. - -راجع [TTS API](/api-reference/endpoint/audio/speech) لجميع خيارات الأصوات. - -### من كلام إلى نص - -فرّغ ملفات الصوت إلى نص: - - - ```python Python - 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()) - ``` - - ```javascript Node.js - 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); - ``` - - ```bash cURL - 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 - ``` - - -الصيغ المدعومة: WAV، FLAC، MP3، M4A، AAC، MP4. فعّل `timestamps=true` للحصول على بيانات توقيت على مستوى الكلمة. - -راجع [Transcriptions API](/api-reference/endpoint/audio/transcriptions) لجميع الخيارات. - -### التضمينات (Embeddings) - -ولّد تضمينات متجهية للبحث الدلالي و RAG والتوصيات: - - - ```python Python - 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()) - ``` - - ```javascript Node.js - 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); - } - ``` - - ```bash cURL - 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" - }' - ``` - - -راجع [Embeddings API](/api-reference/endpoint/embeddings/generate) للمعالجة على دفعات والخيارات المتقدمة. - -### الرؤية (متعدد الوسائط) - -حلّل الصور بجانب النص باستخدام نماذج قادرة على الرؤية مثل `qwen3-vl-235b-a22b`: - - - ```python Python - 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) - ``` - - ```javascript Node.js - 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); - ``` - - ```bash cURL - 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) - -عرّف دوالًا يمكن للنماذج استدعاؤها للتفاعل مع أدوات وواجهات خارجية: - - - ```python Python - 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) - ``` - - ```javascript Node.js - 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); - ``` - - ```bash cURL - 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"] - } - } - } - ] - }' - ``` - - ---- - ## الخطوات التالية -بعد أن قمت بطلباتك الأولى، استكشف المزيد مما يقدّمه Venice API: +الآن بعد أن أجريت طلباتك الأولى، استكشف المزيد مما تقدمه Venice API: - - قارن جميع النماذج المتاحة مع قدراتها وتسعيرها وحدود السياق + + قارن بين جميع النماذج المتاحة مع قدراتها وأسعارها وحدود السياق - - استكشف وثائق API التفصيلية مع كل نقاط النهاية والمعاملات + + + استكشف وثائق API التفصيلية مع جميع نقاط النهاية والمعاملات - - تعلّم كيف تحصل على استجابات JSON بمخططات مضمونة + + + تعلم كيفية الحصول على استجابات JSON بمخططات مضمونة + - ابنِ تطبيقات وكلاء، ووكلاء برمجة، وأدوات MCP، ومهارات، وتدفقات عمل تشفيرية + قم بالبناء باستخدام تطبيقات الوكلاء ووكلاء البرمجة وأدوات MCP والمهارات وسير عمل العملات المشفرة ### موارد إضافية - - افهم حدود المعدّل وأفضل الممارسات للاستخدام الإنتاجي + + افهم حدود المعدل وأفضل الممارسات للاستخدام في بيئة الإنتاج + - مرجع للتعامل مع أخطاء API واستكشاف المشكلات + مرجع للتعامل مع أخطاء الـ API واستكشاف المشكلات وإصلاحها + - استورد مجموعة Postman الكاملة لاختبار سهل + استورد مجموعة Postman الكاملة الخاصة بنا للاختبار السهل + - تعرّف على بنية Venice التي تضع الخصوصية أولًا وتعامل البيانات + تعرف على بنية Venice التي تعطي الأولوية للخصوصية وطريقة التعامل مع البيانات --- -## بحاجة إلى مساعدة؟ +## هل تحتاج إلى مساعدة؟ -- **مجتمع Discord**: انضم إلى [خادم Discord الخاص بنا](https://discord.gg/askvenice) للدعم والنقاشات -- **الوثائق**: تصفّح [مرجع API الكامل](/api-reference/api-spec) -- **صفحة الحالة**: تحقّق من حالة الخدمة على [veniceai-status.com](https://veniceai-status.com) -- **Twitter**: تابع [@AskVenice](https://x.com/AskVenice) للتحديثات +- **مجتمع Discord**: انضم إلى [خادم Discord](https://discord.gg/askvenice) الخاص بنا للحصول على الدعم والمناقشات +- **الوثائق**: تصفح [مرجع الـ API الكامل](/api-reference/api-spec) +- **صفحة الحالة**: تحقق من حالة الخدمة في [veniceai-status.com](https://veniceai-status.com) +- **تويتر**: تابع [@AskVenice](https://x.com/AskVenice) للحصول على التحديثات diff --git a/de/overview/getting-started.mdx b/de/overview/getting-started.mdx index 9fe202b..1819844 100644 --- a/de/overview/getting-started.mdx +++ b/de/overview/getting-started.mdx @@ -1,1006 +1,397 @@ --- -title: Erste Schritte -description: "Schnellstart für die Venice API — API-Schlüssel generieren, erste Chat-Completion senden und Bild-, Video- und Audio-Endpunkte in Minuten erkunden." -"og:title": "Quickstart | Venice API Docs" +title: "Schnellstart" +description: "Schnellstart für die Venice-API — erstelle einen API-Key, sende deine erste Chat-Completion und erkunde Bild-, Video- und Audio-Endpunkte in wenigen Minuten." +og:title: "Schnellstart | Venice-API-Dokumentation" --- -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. +Werde mit der Venice-API in wenigen Minuten startklar. Erstelle einen API-Key, sende deine erste Anfrage und beginne zu entwickeln. -## Quickstart +## Schnellstart - - Gehen Sie zu Ihren [Venice-API-Einstellungen](https://venice.ai/settings/api) und generieren Sie einen neuen API-Schlüssel. + + Gehe zu deinen [Venice-API-Einstellungen](https://venice.ai/settings/api) und erstelle einen neuen API-Key. - Für eine ausführliche Anleitung siehe den [API-Schlüssel-Leitfaden](/guides/getting-started/generating-api-key). + Eine ausführliche Anleitung findest du im [API-Key-Leitfaden](/guides/getting-started/generating-api-key). - - - Fügen Sie Ihren API-Schlüssel Ihrer Umgebung hinzu. Sie können ihn in Ihrer Shell exportieren: + + Füge deinen API-Key zu deiner Umgebung hinzu. Du kannst ihn in deiner Shell exportieren: ```bash export VENICE_API_KEY='your-api-key-here' ``` - Oder fügen Sie ihn zu einer `.env`-Datei in Ihrem Projekt hinzu: + Oder füge ihn zu einer `.env`-Datei in deinem Projekt hinzu: ```bash VENICE_API_KEY=your-api-key-here ``` - - - 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. + + Venice ist OpenAI-kompatibel, sodass du das OpenAI-SDK verwenden kannst. Wenn du lieber cURL oder rohe HTTP-Anfragen verwendest, kannst du diesen Schritt überspringen. - ```bash Python - pip install openai - ``` - ```bash Node.js - npm install openai - ``` + ```bash Python + pip install openai + ``` + + ```bash Node.js + npm install openai + ``` + - - + - ```python Python - 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) - ``` - - ```javascript Node.js - 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); - ``` - - ```bash cURL - 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": [ + + ```python Python + 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) + ``` + + ```javascript Node.js + 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); + ``` + + ```bash cURL + 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) + + - `system` - Anweisungen dazu, wie sich das Modell verhalten soll + - `user` - Deine Prompts oder Fragen + - `assistant` - Vorherige Modellantworten (für mehrstufige Konversationen) + - `tool` - Ergebnisse von Function Calls (bei Verwendung von Tools) + + Jede Anfrage enthält eine `model`-ID. Um ein anderes Modell zu verwenden, ändere den `model`-Wert in deiner Anfrage. Beliebte Auswahlmöglichkeiten: - - 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 + - `zai-org-glm-5` - Standardmodell für die meisten Anwendungsfälle - `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 + - `claude-opus-4-8` - Hochintelligentes Modell für komplexe Aufgaben + - `venice-uncensored-1-2` - Venices unzensiertes Modell - Durchsuchen Sie die vollständige Liste der Modelle mit Preisen, Capabilities und Kontextlimits + Durchsuche die vollständige Liste der Modelle mit Preisen, Fähigkeiten und Kontextgrenzen - - - Sie können Venice-spezifische Funktionen wie Web Search über `venice_parameters` aktivieren: + + Du kannst Venice-spezifische Funktionen wie die Websuche über `venice_parameters` aktivieren: - ```python Python - 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) - ``` - - ```javascript Node.js - 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); - ``` - - ```bash cURL - 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": [ + + ```python Python + 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?"} - ], - "venice_parameters": { - "enable_web_search": "auto", - "include_venice_system_prompt": true - } - }' - ``` + ], + extra_body={ + "venice_parameters": { + "enable_web_search": "auto", + "include_venice_system_prompt": True + } + } + ) + + print(completion.choices[0].message.content) + ``` + + ```javascript Node.js + 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); + ``` + + ```bash cURL + 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](https://docs.venice.ai/api-reference/api-spec#venice-parameters). - - Streamen Sie Antworten in Echtzeit mit `stream=True`: + Streame Antworten in Echtzeit mit `stream=True`: - ```python Python - 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="") - ``` - - ```javascript Node.js - 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); - } - } - ``` - - ```bash cURL - 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 - }' - ``` + + ```python Python + 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="") + ``` + + ```javascript Node.js + 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); + } + } + ``` + + ```bash cURL + 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 + }' + ``` + - - Steuern Sie das Antwortverhalten des Modells mit Parametern wie temperature, max tokens und mehr: + Steuere, wie das Modell antwortet, mit Parametern wie Temperature, Max Tokens und mehr: - ```python Python - 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) - ``` - - ```javascript Node.js - 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); - ``` - - ```bash cURL - 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": [ + + ```python Python + 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, - "stream": false, - "venice_parameters": { - "include_venice_system_prompt": false - } - }' - ``` - - - Weitere Informationen zu allen unterstützten Parametern finden Sie in der [Chat-Completions-Dokumentation](/api-reference/endpoint/chat/completions). - - - ---- - -## Weitere Funktionen - -### Bildgenerierung - -Erstellen Sie Bilder aus Text-Prompts mit Diffusion-Modellen: - - - ```python Python - 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()) - ``` - - ```javascript Node.js - 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); - } - ``` - - ```bash cURL - 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 - - - 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](/api-reference/endpoint/image/generate). - -### Bildbearbeitung - -Modifizieren Sie vorhandene Bilder mit KI-gestütztem Inpainting unter Verwendung des Qwen-Image-Modells: - - - ```python Python - 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) - ``` - - ```javascript Node.js - 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)); - ``` - - ```bash cURL - 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](/api-reference/endpoint/image/edit). - -### Bild-Upscaling - -Verbessern und skalieren Sie Bilder auf höhere Auflösungen: - - - ```python Python - 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) - ``` - - ```javascript Node.js - 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)); - ``` - - ```bash cURL - 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](/api-reference/endpoint/image/upscale). - -### Text-to-Speech - -Wandeln Sie Text in Audio mit mehr als 50 mehrsprachigen Stimmen um: - - - ```python Python - 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) - ``` - - ```javascript Node.js - 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)); - ``` - - ```bash cURL - 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](/api-reference/endpoint/audio/speech). - -### Speech-to-Text - -Transkribieren Sie Audiodateien zu Text: - - - ```python Python - 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()) - ``` - - ```javascript Node.js - 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); - ``` - - ```bash cURL - 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](/api-reference/endpoint/audio/transcriptions). - -### Embeddings - -Generieren Sie Vektor-Embeddings für semantische Suche, RAG und Empfehlungen: - - - ```python Python - 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()) - ``` - - ```javascript Node.js - 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); - } - ``` - - ```bash cURL - 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](/api-reference/endpoint/embeddings/generate). - -### Vision (Multimodal) - -Analysieren Sie Bilder gemeinsam mit Text mit vision-fähigen Modellen wie `qwen3-vl-235b-a22b`: - - - ```python Python - 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) - ``` - - ```javascript Node.js - 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); - ``` - - ```bash cURL - 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" - } + ], + 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 } - ] } - ] - }' - ``` - - -### Function Calling - -Definieren Sie Funktionen, die Modelle aufrufen können, um mit externen Tools und APIs zu interagieren: - - - ```python Python - 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) - ``` - - ```javascript Node.js - 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); - ``` - - ```bash cURL - 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?" + ) + + print(completion.choices[0].message.content) + ``` + + ```javascript Node.js + 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 } - ], - "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"] - } - } + }); + + console.log(completion.choices[0].message.content); + ``` + + ```bash cURL + 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 findest du in der [Chat-Completions-Dokumentation](/api-reference/endpoint/chat/completions). + + --- ## Nächste Schritte -Jetzt, da Sie Ihre ersten Anfragen gestellt haben, entdecken Sie mehr von dem, was die Venice API zu bieten hat: +Jetzt, wo du deine ersten Anfragen gesendet hast, erkunde mehr von dem, was die Venice-API zu bieten hat: - Vergleichen Sie alle verfügbaren Modelle mit ihren Capabilities, Preisen und Kontextlimits + Vergleiche alle verfügbaren Modelle mit ihren Fähigkeiten, Preisen und Kontextgrenzen + - Erkunden Sie die detaillierte API-Dokumentation mit allen Endpoints und Parametern + Erkunde die detaillierte API-Dokumentation mit allen Endpunkten und Parametern + - Erfahren Sie, wie Sie JSON-Antworten mit garantierten Schemas erhalten + Erfahre, wie du JSON-Antworten mit garantierten Schemata erhältst - - Bauen Sie mit Agent-Apps, Coding-Agenten, MCP-Tools, Skills und Krypto-Workflows + + + Entwickle mit Agent-Apps, Coding-Agenten, MCP-Tools, Skills und Krypto-Workflows -### Zusätzliche Ressourcen +### Weitere Ressourcen - Verstehen Sie Rate-Limits und Best Practices für den Produktiveinsatz + Verstehe Rate Limits und Best Practices für den produktiven Einsatz + - Referenz für den Umgang mit API-Fehlern und Troubleshooting + Referenz zum Umgang mit API-Fehlern und zur Fehlerbehebung - - Importieren Sie unsere vollständige Postman-Collection zum einfachen Testen + + + Importiere unsere vollständige Postman-Sammlung für einfaches Testen + - Erfahren Sie mehr über die datenschutzorientierte Architektur und Datenverarbeitung von Venice + Erfahre mehr über Venices datenschutzorientierte Architektur und den Umgang mit Daten --- -## Brauchen Sie Hilfe? +## Brauchst du Hilfe? -- **Discord-Community**: Treten Sie unserem [Discord-Server](https://discord.gg/askvenice) für Support und Diskussionen bei -- **Dokumentation**: Durchsuchen Sie unsere [vollständige API-Referenz](/api-reference/api-spec) -- **Status-Seite**: Prüfen Sie den Dienststatus auf [veniceai-status.com](https://veniceai-status.com) -- **Twitter**: Folgen Sie [@AskVenice](https://x.com/AskVenice) für Updates +- **Discord-Community**: Tritt unserem [Discord-Server](https://discord.gg/askvenice) für Support und Diskussionen bei +- **Dokumentation**: Durchsuche unsere [vollständige API-Referenz](/api-reference/api-spec) +- **Statusseite**: Prüfe den Servicestatus unter [veniceai-status.com](https://veniceai-status.com) +- **Twitter**: Folge [@AskVenice](https://x.com/AskVenice) für Updates diff --git a/es/overview/getting-started.mdx b/es/overview/getting-started.mdx index 43f3874..5922687 100644 --- a/es/overview/getting-started.mdx +++ b/es/overview/getting-started.mdx @@ -1,113 +1,115 @@ --- -title: Empezar -description: "Quickstart de la API de Venice — genera una clave de API, envía tu primera chat completion y explora los endpoints de imagen, vídeo y audio en minutos." -"og:title": "Quickstart | Venice API Docs" +title: "Inicio rápido" +description: "Inicio rápido para la API de Venice: genera una clave de API, envía tu primera completación de chat y explora los endpoints de imagen, video y audio en minutos." +og:title: "Inicio rápido | Documentación de la API de Venice" --- -Empieza a usar la API de Venice en minutos. Genera una API key, haz tu primera solicitud y empieza a construir. +Empieza a usar la API de Venice en minutos. Genera una clave de API, realiza tu primera solicitud y comienza a construir. ## Inicio rápido - - Ve a tu [configuración de la API de Venice](https://venice.ai/settings/api) y genera una nueva API key. + + Ve a la [configuración de la API de Venice](https://venice.ai/settings/api) y genera una nueva clave de API. - Para un recorrido detallado, consulta la [guía de API Key](/guides/getting-started/generating-api-key). + Para un recorrido detallado, consulta la [guía de claves de API](/guides/getting-started/generating-api-key). - - - Añade tu API key a tu entorno. Puedes exportarla en tu shell: + + Añade tu clave de API a tu entorno. Puedes exportarla en tu shell: ```bash export VENICE_API_KEY='your-api-key-here' ``` - O añadirla a un archivo `.env` en tu proyecto: + O añádela a un archivo `.env` en tu proyecto: ```bash VENICE_API_KEY=your-api-key-here ``` - - Venice es compatible con OpenAI, por lo que puedes usar el SDK de OpenAI. Si prefieres usar cURL o solicitudes HTTP en bruto, puedes saltarte este paso. + Venice es compatible con OpenAI, así que puedes usar el SDK de OpenAI. Si prefieres usar cURL o solicitudes HTTP directas, puedes omitir este paso. - ```bash Python - pip install openai - ``` - ```bash Node.js - npm install openai - ``` + ```bash Python + pip install openai + ``` + + ```bash Node.js + npm install openai + ``` + - - ```python Python - 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) - ``` - - ```javascript Node.js - 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); - ``` - - ```bash cURL - 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": [ + + ```python Python + 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) + ``` + + ```javascript Node.js + 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); + ``` + + ```bash cURL + 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?"} + ] + }' + ``` + - **Roles de mensaje:** - - `system` - Instrucciones para el comportamiento del modelo + **Roles de los mensajes:** + + - `system` - Instrucciones sobre cómo debe comportarse el modelo - `user` - Tus prompts o preguntas - - `assistant` - Respuestas previas del modelo (para conversaciones multi-turno) - - `tool` - Resultados de llamadas a funciones (al usar tools) + - `assistant` - Respuestas previas del modelo (para conversaciones multiturno) + - `tool` - Resultados de llamadas a funciones (al usar herramientas) - - + Cada solicitud incluye un ID de `model`. Para usar un modelo diferente, cambia el valor de `model` en tu solicitud. Opciones populares: - - `zai-org-glm-5` - Modelo predeterminado para la mayoría de casos de uso + + - `zai-org-glm-5` - Modelo predeterminado para la mayoría de los casos de uso - `kimi-k2-6` - Razonamiento sólido para tareas más complejas - `claude-opus-4-8` - Modelo de alta inteligencia para tareas complejas - `venice-uncensored-1-2` - Modelo sin censura de Venice @@ -116,881 +118,270 @@ Empieza a usar la API de Venice en minutos. Genera una API key, haz tu primera s Explora la lista completa de modelos con precios, capacidades y límites de contexto - - - Puedes optar por activar funciones específicas de Venice como la búsqueda web mediante `venice_parameters`: + + Puedes optar por habilitar funciones específicas de Venice, como la búsqueda web, mediante `venice_parameters`: - ```python Python - 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) - ``` - - ```javascript Node.js - 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); - ``` - - ```bash cURL - 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": [ + + ```python Python + 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?"} - ], - "venice_parameters": { - "enable_web_search": "auto", - "include_venice_system_prompt": true - } - }' - ``` + ], + extra_body={ + "venice_parameters": { + "enable_web_search": "auto", + "include_venice_system_prompt": True + } + } + ) + + print(completion.choices[0].message.content) + ``` + + ```javascript Node.js + 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); + ``` + + ```bash cURL + 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 + } + }' + ``` + Consulta todos los [parámetros disponibles](https://docs.venice.ai/api-reference/api-spec#venice-parameters). - - + Transmite respuestas en tiempo real usando `stream=True`: - ```python Python - 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="") - ``` - - ```javascript Node.js - 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); - } - } - ``` - - ```bash cURL - 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 - }' - ``` + + ```python Python + 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="") + ``` + + ```javascript Node.js + 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); + } + } + ``` + + ```bash cURL + 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 + }' + ``` + - - + Controla cómo responde el modelo con parámetros como temperature, max tokens y más: - ```python Python - 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) - ``` - - ```javascript Node.js - 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); - ``` - - ```bash cURL - 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": [ + + ```python Python + 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, - "stream": false, - "venice_parameters": { - "include_venice_system_prompt": false - } - }' - ``` - - - Consulta la [documentación de Chat Completions](/api-reference/endpoint/chat/completions) para más información sobre todos los parámetros admitidos. - - - ---- - -## Más capacidades - -### Generación de imágenes - -Crea imágenes a partir de prompts de texto usando modelos de difusión: - - - ```python Python - 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()) - ``` - - ```javascript Node.js - 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); - } - ``` - - ```bash cURL - 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 - }' - ``` - - -**Nota:** la respuesta devuelve imágenes codificadas en base64 en el array `images`. Decodifica la cadena base64 para guardar o mostrar la imagen. - -**Modelos de imagen populares:** -- `qwen-image` - Generación de imágenes de la máxima calidad -- `venice-sd35` - Opción por defecto, funciona con todas las funciones -- `hidream` - Generación rápida para uso en producción - - - Mira todos los modelos de imagen disponibles con precios y capacidades - - -Para opciones de parámetros más avanzadas como `cfg_scale`, `negative_prompt`, `style_preset`, `seed`, `variants` y más, consulta la [referencia de la API de imágenes](/api-reference/endpoint/image/generate). - -### Edición de imágenes - -Modifica imágenes existentes con inpainting impulsado por IA usando el modelo Qwen-Image: - - - ```python Python - 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) - ``` - - ```javascript Node.js - 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)); - ``` - - ```bash cURL - 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..." - }' - ``` - - -**Nota:** el editor de imágenes utiliza el modelo Qwen-Image y es un endpoint experimental. Envía la imagen de entrada como cadena codificada en base64 y la API devuelve la imagen editada como datos binarios. - -Consulta la [API de edición de imágenes](/api-reference/endpoint/image/edit) para todos los parámetros. - -### Escalado de imágenes - -Mejora y escala imágenes a resoluciones más altas: - - - ```python Python - 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) - ``` - - ```javascript Node.js - 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)); - ``` - - ```bash cURL - 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 - }' - ``` - - -**Nota:** envía la imagen de entrada como cadena codificada en base64 y la API devuelve la imagen escalada como datos binarios. - -Consulta la [API de escalado de imágenes](/api-reference/endpoint/image/upscale) para todos los parámetros. - -### Texto a voz - -Convierte texto en audio con más de 50 voces multilingües: - - - ```python Python - 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) - ``` - - ```javascript Node.js - 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)); - ``` - - ```bash cURL - 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 - ``` - - -El modelo `tts-kokoro` admite más de 50 voces multilingües, incluyendo `af_sky`, `af_nova`, `am_liam`, `bf_emma`, `zf_xiaobei` y `jm_kumo`. - -Consulta la [API de TTS](/api-reference/endpoint/audio/speech) para todas las opciones de voz. - -### Voz a texto - -Transcribe archivos de audio a texto: - - - ```python Python - 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()) - ``` - - ```javascript Node.js - 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); - ``` - - ```bash cURL - 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 - ``` - - -Formatos admitidos: WAV, FLAC, MP3, M4A, AAC, MP4. Activa `timestamps=true` para obtener datos de tiempo a nivel de palabra. - -Consulta la [API de transcripciones](/api-reference/endpoint/audio/transcriptions) para todas las opciones. - -### Embeddings - -Genera vectores de embeddings para búsqueda semántica, RAG y recomendaciones: - - - ```python Python - 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()) - ``` - - ```javascript Node.js - 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); - } - ``` - - ```bash cURL - 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" - }' - ``` - - -Consulta la [API de embeddings](/api-reference/endpoint/embeddings/generate) para procesamiento por lotes y opciones avanzadas. - -### Vision (multimodal) - -Analiza imágenes junto con texto usando modelos con capacidad de visión como `qwen3-vl-235b-a22b`: - - - ```python Python - 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) - ``` - - ```javascript Node.js - 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); - ``` - - ```bash cURL - 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" - } + ], + 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 } - ] } - ] - }' - ``` - - -### Function calling - -Define funciones que los modelos pueden invocar para interactuar con herramientas y APIs externas: - - - ```python Python - 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) - ``` - - ```javascript Node.js - 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); - ``` - - ```bash cURL - 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?" + ) + + print(completion.choices[0].message.content) + ``` + + ```javascript Node.js + 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 } - ], - "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"] - } - } + }); + + console.log(completion.choices[0].message.content); + ``` + + ```bash cURL + 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 } - ] - }' - ``` - + }' + ``` + + + + Consulta la [documentación de completaciones de chat](/api-reference/endpoint/chat/completions) para obtener más información sobre todos los parámetros admitidos. + + --- ## Próximos pasos -Ahora que ya has hecho tus primeras solicitudes, explora más de lo que ofrece la API de Venice: +Ahora que has realizado tus primeras solicitudes, explora más de lo que ofrece la API de Venice: Compara todos los modelos disponibles con sus capacidades, precios y límites de contexto + - Explora la documentación detallada de la API con todos los endpoints y parámetros + Explora documentación detallada de la API con todos los endpoints y parámetros + Aprende a obtener respuestas JSON con esquemas garantizados + - Construye con apps de agentes, agentes de programación, herramientas MCP, skills y flujos de trabajo cripto + Construye con aplicaciones de agentes, agentes de codificación, herramientas MCP, skills y flujos de trabajo cripto ### Recursos adicionales - - Comprende los límites de velocidad y las mejores prácticas para uso en producción + + Comprende los límites de tasa y las mejores prácticas para uso en producción + - Referencia para gestionar errores de la API y resolver problemas + Referencia para manejar errores de la API y solucionar problemas + - Importa nuestra colección completa de Postman para pruebas fáciles + Importa nuestra colección completa de Postman para pruebas sencillas + - Aprende sobre la arquitectura privacy-first de Venice y el tratamiento de datos + Conoce la arquitectura centrada en la privacidad de Venice y el manejo de datos @@ -998,9 +389,9 @@ Ahora que ya has hecho tus primeras solicitudes, explora más de lo que ofrece l ## ¿Necesitas ayuda? -- **Comunidad de Discord**: únete a nuestro [servidor de Discord](https://discord.gg/askvenice) para soporte y debates -- **Documentación**: explora nuestra [referencia completa de la API](/api-reference/api-spec) -- **Página de estado**: comprueba el estado del servicio en [veniceai-status.com](https://veniceai-status.com) -- **Twitter**: sigue a [@AskVenice](https://x.com/AskVenice) para actualizaciones +- **Comunidad de Discord**: Únete a nuestro [servidor de Discord](https://discord.gg/askvenice) para soporte y debates +- **Documentación**: Explora nuestra [referencia completa de la API](/api-reference/api-spec) +- **Página de estado**: Consulta el estado del servicio en [veniceai-status.com](https://veniceai-status.com) +- **Twitter**: Sigue a [@AskVenice](https://x.com/AskVenice) para novedades diff --git a/fr/overview/getting-started.mdx b/fr/overview/getting-started.mdx index c5ea1de..2b453e8 100644 --- a/fr/overview/getting-started.mdx +++ b/fr/overview/getting-started.mdx @@ -1,21 +1,20 @@ --- -title: Démarrage -description: "Démarrage rapide pour l'API Venice : générez une clé d'API, envoyez votre première chat completion et explorez les endpoints image, vidéo et audio." -"og:title": "Démarrage rapide | Venice API Docs" +title: "Démarrage rapide" +description: "Démarrage rapide pour l'API Venice — générez une clé API, envoyez votre première complétion de chat et explorez les endpoints d'image, de vidéo et d'audio en quelques minutes." +og:title: "Démarrage rapide | Documentation de l'API Venice" --- -Lancez-vous avec l'API Venice en quelques minutes. Générez une clé API, effectuez votre première requête et commencez à construire. +Prenez en main l'API Venice en quelques minutes. Générez une clé API, effectuez votre première requête et commencez à créer. ## Démarrage rapide - - Rendez-vous dans vos [Paramètres API Venice](https://venice.ai/settings/api) et générez une nouvelle clé API. + + Rendez-vous dans vos [paramètres de l'API Venice](https://venice.ai/settings/api) et générez une nouvelle clé API. - Pour un guide détaillé, consultez le [guide de la clé API](/guides/getting-started/generating-api-key). + Pour un guide détaillé, consultez le [guide sur les clés API](/guides/getting-started/generating-api-key). - - + Ajoutez votre clé API à votre environnement. Vous pouvez l'exporter dans votre shell : ```bash @@ -28,933 +27,319 @@ Lancez-vous avec l'API Venice en quelques minutes. Générez une clé API, effec VENICE_API_KEY=your-api-key-here ``` - - - Venice est compatible OpenAI, vous pouvez donc utiliser le SDK OpenAI. Si vous préférez utiliser cURL ou des requêtes HTTP brutes, vous pouvez ignorer cette étape. + + Venice est compatible avec OpenAI, vous pouvez donc utiliser le SDK OpenAI. Si vous préférez utiliser cURL ou des requêtes HTTP brutes, vous pouvez ignorer cette étape. - ```bash Python - pip install openai - ``` - ```bash Node.js - npm install openai - ``` + ```bash Python + pip install openai + ``` + + ```bash Node.js + npm install openai + ``` + - - + - ```python Python - 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) - ``` - - ```javascript Node.js - 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); - ``` - - ```bash cURL - 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": [ + + ```python Python + 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) + ``` + + ```javascript Node.js + 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); + ``` + + ```bash cURL + 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?"} + ] + }' + ``` + - **Rôles de message :** - - `system` - Instructions sur le comportement attendu du modèle + **Rôles des messages :** + + - `system` - Instructions sur la manière dont le modèle doit se comporter - `user` - Vos prompts ou questions - - `assistant` - Réponses précédentes du modèle (pour les conversations multi-tours) - - `tool` - Résultats d'appel de fonction (lors de l'utilisation d'outils) + - `assistant` - Réponses précédentes du modèle (pour les conversations à plusieurs tours) + - `tool` - Résultats d'appels de fonctions (lors de l'utilisation d'outils) + + Chaque requête inclut un ID de `model`. Pour utiliser un modèle différent, modifiez la valeur de `model` dans votre requête. Choix populaires : - - Chaque requête inclut un ID `model`. Pour utiliser un modèle différent, modifiez la valeur de `model` dans votre requête. Choix populaires : - `zai-org-glm-5` - Modèle par défaut pour la plupart des cas d'usage - - `kimi-k2-6` - Raisonnement solide pour les tâches plus complexes - - `claude-opus-4-8` - Modèle de haute intelligence pour les tâches complexes - - `venice-uncensored-1-2` - Le modèle non censuré de Venice + - `kimi-k2-6` - Raisonnement solide pour des tâches plus complexes + - `claude-opus-4-8` - Modèle à haute intelligence pour les tâches complexes + - `venice-uncensored-1-2` - Modèle non censuré de Venice - Parcourez la liste complète des modèles avec leur tarification, leurs capacités et leurs limites de contexte + Parcourez la liste complète des modèles avec leurs tarifs, capacités et limites de contexte - - - Vous pouvez choisir d'activer des fonctionnalités spécifiques à Venice comme la recherche web en utilisant `venice_parameters` : + + Vous pouvez choisir d'activer des fonctionnalités spécifiques à Venice comme la recherche web à l'aide de `venice_parameters` : - ```python Python - 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) - ``` - - ```javascript Node.js - 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); - ``` - - ```bash cURL - 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": [ + + ```python Python + 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?"} - ], - "venice_parameters": { - "enable_web_search": "auto", - "include_venice_system_prompt": true - } - }' - ``` - + ], + extra_body={ + "venice_parameters": { + "enable_web_search": "auto", + "include_venice_system_prompt": True + } + } + ) + + print(completion.choices[0].message.content) + ``` - Voir tous les [paramètres disponibles](https://docs.venice.ai/api-reference/api-spec#venice-parameters). - + ```javascript Node.js + 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); + ``` - - Diffusez les réponses en temps réel en utilisant `stream=True` : + ```bash cURL + 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 + } + }' + ``` - - ```python Python - 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="") - ``` - - ```javascript Node.js - 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); - } - } - ``` - - ```bash cURL - 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 - }' - ``` - - - Contrôlez la façon dont le modèle répond avec des paramètres comme temperature, max tokens et plus : + Consultez tous les [paramètres disponibles](https://docs.venice.ai/api-reference/api-spec#venice-parameters). + + + Diffusez les réponses en temps réel à l'aide de `stream=True` : - ```python Python - 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) - ``` - - ```javascript Node.js - 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); - ``` - - ```bash cURL - 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 - } - }' - ``` - - Consultez la [doc Chat Completions](/api-reference/endpoint/chat/completions) pour plus d'informations sur tous les paramètres pris en charge. + ```python Python + 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="") + ``` + + ```javascript Node.js + 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); + } + } + ``` + + ```bash cURL + 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 + }' + ``` + + - + + Contrôlez la manière dont le modèle répond grâce à des paramètres comme la température, le nombre maximal de tokens, et plus encore : ---- + -## Autres capacités - -### Génération d'image - -Créez des images à partir de prompts texte en utilisant des modèles de diffusion : - - - ```python Python - 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()) - ``` - - ```javascript Node.js - 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); - } - ``` - - ```bash cURL - 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 - }' - ``` - - -**Note :** La réponse renvoie les images encodées en base64 dans le tableau `images`. Décodez la chaîne base64 pour enregistrer ou afficher l'image. - -**Modèles d'image populaires :** -- `qwen-image` - Génération d'image de la plus haute qualité -- `venice-sd35` - Choix par défaut, fonctionne avec toutes les fonctionnalités -- `hidream` - Génération rapide pour une utilisation en production - - - Voir tous les modèles d'image disponibles avec leur tarification et leurs capacités - - -Pour des options de paramètres plus avancées comme `cfg_scale`, `negative_prompt`, `style_preset`, `seed`, `variants` et plus, consultez la [référence API Images](/api-reference/endpoint/image/generate). - -### Édition d'image - -Modifiez des images existantes avec de l'inpainting alimenté par IA en utilisant le modèle Qwen-Image : - - - ```python Python - 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) - ``` - - ```javascript Node.js - 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)); - ``` - - ```bash cURL - 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..." - }' - ``` - - -**Note :** L'éditeur d'image utilise le modèle Qwen-Image et est un endpoint expérimental. Envoyez l'image d'entrée sous forme de chaîne encodée en base64, et l'API renvoie l'image éditée sous forme de données binaires. - -Voir l'[API Image Edit](/api-reference/endpoint/image/edit) pour tous les paramètres. - -### Agrandissement d'image - -Améliorez et agrandissez des images vers des résolutions plus élevées : - - - ```python Python - 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) - ``` - - ```javascript Node.js - 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)); - ``` - - ```bash cURL - 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 - }' - ``` - - -**Note :** Envoyez l'image d'entrée sous forme de chaîne encodée en base64, et l'API renvoie l'image agrandie sous forme de données binaires. - -Voir l'[API Image Upscale](/api-reference/endpoint/image/upscale) pour tous les paramètres. - -### Synthèse vocale (Text-to-Speech) - -Convertissez du texte en audio avec plus de 50 voix multilingues : - - - ```python Python - 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) - ``` - - ```javascript Node.js - 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)); - ``` - - ```bash cURL - 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 - ``` - - -Le modèle `tts-kokoro` prend en charge plus de 50 voix multilingues, dont `af_sky`, `af_nova`, `am_liam`, `bf_emma`, `zf_xiaobei` et `jm_kumo`. - -Voir l'[API TTS](/api-reference/endpoint/audio/speech) pour toutes les options de voix. - -### Transcription (Speech-to-Text) - -Transcrivez des fichiers audio en texte : - - - ```python Python - 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()) - ``` - - ```javascript Node.js - 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); - ``` - - ```bash cURL - 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 - ``` - - -Formats pris en charge : WAV, FLAC, MP3, M4A, AAC, MP4. Activez `timestamps=true` pour obtenir des données de chronométrage au niveau du mot. - -Voir l'[API Transcriptions](/api-reference/endpoint/audio/transcriptions) pour toutes les options. - -### Embeddings - -Générez des embeddings vectoriels pour la recherche sémantique, le RAG et les recommandations : - - - ```python Python - 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()) - ``` - - ```javascript Node.js - 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); - } - ``` - - ```bash cURL - 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" - }' - ``` - - -Voir l'[API Embeddings](/api-reference/endpoint/embeddings/generate) pour le traitement par lots et les options avancées. - -### Vision (multimodal) - -Analysez des images avec du texte en utilisant des modèles capables de vision comme `qwen3-vl-235b-a22b` : - - - ```python Python - 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) - ``` - - ```javascript Node.js - 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); - ``` - - ```bash cURL - 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" - } + ```python Python + 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 } - ] } - ] - }' - ``` - - -### Appels de fonctions - -Définissez des fonctions que les modèles peuvent appeler pour interagir avec des outils et API externes : - - - ```python Python - 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) - ``` - - ```javascript Node.js - 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); - ``` - - ```bash cURL - 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?" + ) + + print(completion.choices[0].message.content) + ``` + + ```javascript Node.js + 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 } - ], - "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"] - } - } + }); + + console.log(completion.choices[0].message.content); + ``` + + ```bash cURL + 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 } - ] - }' - ``` - + }' + ``` + + + + Consultez la [documentation Chat Completions](/api-reference/endpoint/chat/completions) pour plus d'informations sur tous les paramètres pris en charge. + + --- @@ -964,33 +349,39 @@ Maintenant que vous avez effectué vos premières requêtes, explorez davantage - Comparez tous les modèles disponibles avec leurs capacités, leur tarification et leurs limites de contexte + Comparez tous les modèles disponibles avec leurs capacités, tarifs et limites de contexte - - Explorez la documentation API détaillée avec tous les endpoints et paramètres + + + Explorez la documentation détaillée de l'API avec tous les endpoints et paramètres + Apprenez à obtenir des réponses JSON avec des schémas garantis - - Construisez avec des applications d'agent, des agents de codage, des outils MCP, des skills et des workflows crypto + + + Créez avec des applications d'agent, des agents de code, des outils MCP, des compétences et des workflows crypto ### Ressources supplémentaires - + Comprenez les limites de débit et les bonnes pratiques pour une utilisation en production + - Référence pour gérer les erreurs API et résoudre les problèmes + Référence pour la gestion des erreurs de l'API et le dépannage + - Importez notre collection Postman complète pour tester facilement + Importez notre collection Postman complète pour des tests faciles + - Découvrez l'architecture privacy-first de Venice et la gestion des données + Découvrez l'architecture axée sur la confidentialité de Venice et la gestion des données @@ -998,8 +389,8 @@ Maintenant que vous avez effectué vos premières requêtes, explorez davantage ## Besoin d'aide ? -- **Communauté Discord** : Rejoignez notre [serveur Discord](https://discord.gg/askvenice) pour le support et les discussions -- **Documentation** : Parcourez notre [référence API complète](/api-reference/api-spec) +- **Communauté Discord** : Rejoignez notre [serveur Discord](https://discord.gg/askvenice) pour obtenir de l'aide et participer aux discussions +- **Documentation** : Parcourez notre [référence complète de l'API](/api-reference/api-spec) - **Page de statut** : Vérifiez l'état du service sur [veniceai-status.com](https://veniceai-status.com) - **Twitter** : Suivez [@AskVenice](https://x.com/AskVenice) pour les mises à jour diff --git a/it/overview/getting-started.mdx b/it/overview/getting-started.mdx index f03e10a..8a1f80c 100644 --- a/it/overview/getting-started.mdx +++ b/it/overview/getting-started.mdx @@ -1,335 +1,340 @@ --- -title: Per iniziare -description: "Quickstart per l'API Venice — genera una chiave API, invia la tua prima chat completion ed esplora gli endpoint immagini, video e audio in pochi minuti." -"og:title": "Quickstart | Venice API Docs" +title: "Guida rapida" +description: "Guida rapida per la Venice API — genera una chiave API, invia il tuo primo chat completion ed esplora gli endpoint per immagini, video e audio in pochi minuti." +og:title: "Guida rapida | Documentazione Venice API" --- -Inizia a usare l'API Venice in pochi minuti. Genera una API key, esegui la tua prima richiesta e comincia a sviluppare. +Inizia a usare la Venice API in pochi minuti. Genera una chiave API, effettua la tua prima richiesta e comincia a costruire. -## Quickstart +## Guida rapida - - Vai nelle tue [impostazioni API di Venice](https://venice.ai/settings/api) e genera una nuova API key. + + Vai alle [Impostazioni API di Venice](https://venice.ai/settings/api) e genera una nuova chiave API. - Per una guida dettagliata, consulta la [guida alle API key](/guides/getting-started/generating-api-key). + Per una guida dettagliata, consulta la [guida alla chiave API](/guides/getting-started/generating-api-key). - - - Aggiungi la tua API key all'ambiente. Puoi esportarla nella shell: + + Aggiungi la tua chiave API al tuo ambiente. Puoi esportarla nella tua shell: ```bash export VENICE_API_KEY='your-api-key-here' ``` - Oppure aggiungerla a un file `.env` nel tuo progetto: + Oppure aggiungila a un file `.env` nel tuo progetto: ```bash VENICE_API_KEY=your-api-key-here ``` - - Venice è compatibile con OpenAI, quindi puoi usare l'SDK OpenAI. Se preferisci usare cURL o richieste HTTP raw, puoi saltare questo passaggio. + Venice è compatibile con OpenAI, quindi puoi usare l'SDK OpenAI. Se preferisci usare cURL o richieste HTTP grezze, puoi saltare questo passaggio. - ```bash Python - pip install openai - ``` - ```bash Node.js - npm install openai - ``` + ```bash Python + pip install openai + ``` + + ```bash Node.js + npm install openai + ``` + - - ```python Python - 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) - ``` - - ```javascript Node.js - 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); - ``` - - ```bash cURL - 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": [ + + ```python Python + 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) + ``` + + ```javascript Node.js + 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); + ``` + + ```bash cURL + 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?"} + ] + }' + ``` + **Ruoli dei messaggi:** - - `system` - Istruzioni su come il modello deve comportarsi + + - `system` - Istruzioni su come il modello dovrebbe comportarsi - `user` - I tuoi prompt o domande - - `assistant` - Risposte precedenti del modello (per conversazioni multi-turno) - - `tool` - Risultati delle chiamate a funzione (quando usi i tool) + - `assistant` - Risposte precedenti del modello (per conversazioni a più turni) + - `tool` - Risultati delle chiamate di funzione (quando si usano gli strumenti) + + Ogni richiesta include un ID `model`. Per usare un modello diverso, cambia il valore `model` nella tua richiesta. Scelte popolari: - - Ogni richiesta include un `model` ID. Per usare un modello diverso, cambia il valore di `model` nella richiesta. Scelte comuni: - `zai-org-glm-5` - Modello predefinito per la maggior parte dei casi d'uso - - `kimi-k2-6` - Reasoning solido per attività più complesse - - `claude-opus-4-8` - Modello ad alta intelligenza per task complessi - - `venice-uncensored-1-2` - Modello uncensored di Venice + - `kimi-k2-6` - Forte capacità di ragionamento per compiti più complessi + - `claude-opus-4-8` - Modello ad alta intelligenza per compiti complessi + - `venice-uncensored-1-2` - Il modello senza censura di Venice Sfoglia l'elenco completo dei modelli con prezzi, capacità e limiti di contesto - - - Puoi scegliere di abilitare funzionalità specifiche di Venice come la web search tramite `venice_parameters`: + + Puoi scegliere di abilitare funzionalità specifiche di Venice come la ricerca web usando `venice_parameters`: - ```python Python - 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) - ``` - - ```javascript Node.js - 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); - ``` - - ```bash cURL - 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": [ + + ```python Python + 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?"} - ], - "venice_parameters": { - "enable_web_search": "auto", - "include_venice_system_prompt": true - } - }' - ``` + ], + extra_body={ + "venice_parameters": { + "enable_web_search": "auto", + "include_venice_system_prompt": True + } + } + ) + + print(completion.choices[0].message.content) + ``` + + ```javascript Node.js + 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); + ``` + + ```bash cURL + 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 + } + }' + ``` + - Consulta tutti i [parametri disponibili](https://docs.venice.ai/api-reference/api-spec#venice-parameters). + Vedi tutti i [parametri disponibili](https://docs.venice.ai/api-reference/api-spec#venice-parameters). - Trasmetti le risposte in tempo reale usando `stream=True`: - ```python Python - 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="") - ``` - - ```javascript Node.js - 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); - } - } - ``` - - ```bash cURL - 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 - }' - ``` + + ```python Python + 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="") + ``` + + ```javascript Node.js + 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); + } + } + ``` + + ```bash cURL + 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 + }' + ``` + - Controlla come il modello risponde con parametri come temperature, max tokens e altri: - ```python Python - 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) - ``` - - ```javascript Node.js - 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); - ``` - - ```bash cURL - 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": [ + + ```python Python + 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, - "stream": false, - "venice_parameters": { - "include_venice_system_prompt": false - } - }' - ``` + ], + 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) + ``` + + ```javascript Node.js + 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); + ``` + + ```bash cURL + 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 + } + }' + ``` + Consulta la [documentazione di Chat Completions](/api-reference/endpoint/chat/completions) per maggiori informazioni su tutti i parametri supportati. @@ -338,657 +343,43 @@ Inizia a usare l'API Venice in pochi minuti. Genera una API key, esegui la tua p --- -## Altre capacità - -### Generazione di immagini - -Crea immagini da prompt testuali usando modelli di diffusione: - - - ```python Python - 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()) - ``` - - ```javascript Node.js - 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); - } - ``` - - ```bash cURL - 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 - }' - ``` - - -**Nota:** la risposta restituisce immagini codificate in base64 nell'array `images`. Decodifica la stringa base64 per salvare o visualizzare l'immagine. - -**Modelli di immagini popolari:** -- `qwen-image` - Generazione di immagini di altissima qualità -- `venice-sd35` - Scelta predefinita, funziona con tutte le funzionalità -- `hidream` - Generazione veloce per uso in produzione - - - Vedi tutti i modelli di immagini disponibili con prezzi e capacità - - -Per opzioni di parametri più avanzate come `cfg_scale`, `negative_prompt`, `style_preset`, `seed`, `variants` e altre, consulta la [Images API Reference](/api-reference/endpoint/image/generate). - -### Editing di immagini - -Modifica immagini esistenti con inpainting basato su AI tramite il modello Qwen-Image: - - - ```python Python - 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) - ``` - - ```javascript Node.js - 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)); - ``` - - ```bash cURL - 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..." - }' - ``` - - -**Nota:** l'editor di immagini usa il modello Qwen-Image ed è un endpoint sperimentale. Invia l'immagine di input come stringa codificata in base64; l'API restituisce l'immagine modificata come dati binari. - -Consulta la [Image Edit API](/api-reference/endpoint/image/edit) per tutti i parametri. - -### Upscaling di immagini - -Migliora le immagini portandole a risoluzioni più alte: - - - ```python Python - 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) - ``` - - ```javascript Node.js - 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)); - ``` - - ```bash cURL - 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 - }' - ``` - - -**Nota:** invia l'immagine di input come stringa codificata in base64; l'API restituisce l'immagine con upscaling come dati binari. - -Consulta la [Image Upscale API](/api-reference/endpoint/image/upscale) per tutti i parametri. - -### Text-to-Speech - -Converti testo in audio con oltre 50 voci multilingue: - - - ```python Python - 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) - ``` - - ```javascript Node.js - 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)); - ``` - - ```bash cURL - 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 - ``` - - -Il modello `tts-kokoro` supporta oltre 50 voci multilingue, tra cui `af_sky`, `af_nova`, `am_liam`, `bf_emma`, `zf_xiaobei` e `jm_kumo`. - -Consulta la [TTS API](/api-reference/endpoint/audio/speech) per tutte le opzioni di voce. - -### Speech-to-Text - -Trascrivi file audio in testo: - - - ```python Python - 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()) - ``` - - ```javascript Node.js - 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); - ``` - - ```bash cURL - 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 - ``` - - -Formati supportati: WAV, FLAC, MP3, M4A, AAC, MP4. Abilita `timestamps=true` per ottenere dati di timing a livello di parola. - -Consulta la [Transcriptions API](/api-reference/endpoint/audio/transcriptions) per tutte le opzioni. - -### Embeddings - -Genera vector embedding per ricerca semantica, RAG e raccomandazioni: - - - ```python Python - 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()) - ``` - - ```javascript Node.js - 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); - } - ``` - - ```bash cURL - 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" - }' - ``` - - -Consulta la [Embeddings API](/api-reference/endpoint/embeddings/generate) per l'elaborazione batch e le opzioni avanzate. - -### Vision (multimodale) - -Analizza immagini insieme al testo usando modelli vision-capable come `qwen3-vl-235b-a22b`: - - - ```python Python - 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) - ``` - - ```javascript Node.js - 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); - ``` - - ```bash cURL - 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 - -Definisci funzioni che i modelli possono chiamare per interagire con tool e API esterni: - - - ```python Python - 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) - ``` - - ```javascript Node.js - 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); - ``` - - ```bash cURL - 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"] - } - } - } - ] - }' - ``` - - ---- +## Passi successivi -## Prossimi passi - -Ora che hai eseguito le prime richieste, esplora tutto ciò che l'API Venice ha da offrire: +Ora che hai effettuato le tue prime richieste, esplora tutto ciò che la Venice API ha da offrire: - Confronta tutti i modelli disponibili con capacità, prezzi e limiti di contesto + Confronta tutti i modelli disponibili con le loro capacità, prezzi e limiti di contesto - + + Esplora la documentazione dettagliata dell'API con tutti gli endpoint e i parametri + Scopri come ottenere risposte JSON con schemi garantiti - - Sviluppa con app per agent, coding agent, tool MCP, skill e workflow crypto + + + Costruisci con app di agenti, agenti di codifica, strumenti MCP, skill e workflow crypto ### Risorse aggiuntive - - Comprendi i rate limit e le best practice per l'uso in produzione + + Comprendi i limiti di frequenza e le best practice per l'uso in produzione + Riferimento per gestire gli errori dell'API e risolvere i problemi - - Importa la nostra collection Postman completa per testare facilmente + + + Importa la nostra collezione Postman completa per test facili + Scopri l'architettura privacy-first di Venice e la gestione dei dati @@ -998,9 +389,9 @@ Ora che hai eseguito le prime richieste, esplora tutto ciò che l'API Venice ha ## Hai bisogno di aiuto? -- **Community Discord**: unisciti al nostro [server Discord](https://discord.gg/askvenice) per supporto e discussioni -- **Documentazione**: sfoglia la nostra [API reference completa](/api-reference/api-spec) -- **Status page**: controlla lo stato del servizio su [veniceai-status.com](https://veniceai-status.com) -- **Twitter**: segui [@AskVenice](https://x.com/AskVenice) per gli aggiornamenti +- **Comunità Discord**: Unisciti al nostro [server Discord](https://discord.gg/askvenice) per supporto e discussioni +- **Documentazione**: Sfoglia il nostro [riferimento API completo](/api-reference/api-spec) +- **Pagina di stato**: Controlla lo stato del servizio su [veniceai-status.com](https://veniceai-status.com) +- **Twitter**: Segui [@AskVenice](https://x.com/AskVenice) per gli aggiornamenti diff --git a/ko/overview/getting-started.mdx b/ko/overview/getting-started.mdx index a1f4737..e87600e 100644 --- a/ko/overview/getting-started.mdx +++ b/ko/overview/getting-started.mdx @@ -1,22 +1,21 @@ --- -title: 시작하기 -description: "Venice API 빠른 시작 — API 키를 발급받고, 첫 chat completion을 보내고, 이미지·비디오·오디오 엔드포인트를 몇 분 만에 살펴보세요." -"og:title": "Quickstart | Venice API Docs" +title: "빠른 시작" +description: "Venice API 빠른 시작 가이드 — API 키를 생성하고, 첫 채팅 완성 요청을 보내고, 이미지, 비디오, 오디오 엔드포인트를 몇 분 안에 살펴보세요." +og:title: "빠른 시작 | Venice API 문서" --- -몇 분 안에 Venice API를 시작하고 실행해보세요. API 키를 발급받고, 첫 요청을 보내고, 빌드를 시작하세요. +Venice API를 몇 분 안에 시작해보세요. API 키를 생성하고, 첫 요청을 보내고, 개발을 시작하세요. ## 빠른 시작 - [Venice API 설정](https://venice.ai/settings/api)으로 이동해 새 API 키를 생성합니다. + [Venice API 설정](https://venice.ai/settings/api)으로 이동하여 새 API 키를 생성하세요. - 자세한 가이드는 [API 키 가이드](/guides/getting-started/generating-api-key)를 참고하세요. + 자세한 안내는 [API 키 가이드](/guides/getting-started/generating-api-key)를 확인하세요. - - - API 키를 환경변수에 추가합니다. 셸에서 export할 수 있습니다: + + 환경에 API 키를 추가하세요. 셸에서 export할 수 있습니다: ```bash export VENICE_API_KEY='your-api-key-here' @@ -28,969 +27,361 @@ description: "Venice API 빠른 시작 — API 키를 발급받고, 첫 chat com VENICE_API_KEY=your-api-key-here ``` - - - Venice는 OpenAI 호환이므로 OpenAI SDK를 그대로 사용할 수 있습니다. cURL이나 raw HTTP 요청을 선호한다면 이 단계는 건너뛰어도 됩니다. + + Venice는 OpenAI 호환이므로 OpenAI SDK를 사용할 수 있습니다. cURL이나 원시 HTTP 요청을 사용하는 것을 선호한다면 이 단계를 건너뛸 수 있습니다. - ```bash Python - pip install openai - ``` - ```bash Node.js - npm install openai - ``` + ```bash Python + pip install openai + ``` + + ```bash Node.js + npm install openai + ``` + - - ```python Python - 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) - ``` - - ```javascript Node.js - 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); - ``` - - ```bash cURL - 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": [ + + ```python Python + 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) + ``` + + ```javascript Node.js + 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); + ``` + + ```bash cURL + 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?"} + ] + }' + ``` + - **메시지 역할(role):** + **메시지 역할:** + - `system` - 모델이 어떻게 동작해야 하는지에 대한 지침 - - `user` - 사용자의 prompt 또는 질문 - - `assistant` - 이전 모델 응답(멀티턴 대화용) - - `tool` - 함수 호출 결과(도구 사용 시) + - `user` - 여러분의 프롬프트 또는 질문 + - `assistant` - 이전 모델 응답 (멀티턴 대화용) + - `tool` - 함수 호출 결과 (도구 사용 시) + + 모든 요청에는 `model` ID가 포함됩니다. 다른 모델을 사용하려면 요청의 `model` 값을 변경하세요. 인기 있는 선택지: - - 모든 요청에는 `model` ID가 포함됩니다. 다른 모델을 사용하려면 요청의 `model` 값을 변경하세요. 자주 쓰이는 선택지: - - `zai-org-glm-5` - 대부분의 사용 사례를 위한 기본 모델 - - `kimi-k2-6` - 복잡한 작업에 강한 추론 능력 + - `zai-org-glm-5` - 대부분의 사용 사례에 적합한 기본 모델 + - `kimi-k2-6` - 더 복잡한 작업을 위한 강력한 추론 능력 - `claude-opus-4-8` - 복잡한 작업을 위한 고지능 모델 - - `venice-uncensored-1-2` - Venice의 검열되지 않은(uncensored) 모델 + - `venice-uncensored-1-2` - Venice의 검열되지 않은 모델 - 가격, 기능, context 한도와 함께 전체 모델 목록을 확인하세요 + 가격, 기능, 컨텍스트 제한과 함께 모든 모델의 전체 목록을 살펴보세요 - - - `venice_parameters`를 사용해 웹 검색 같은 Venice 전용 기능을 활성화할 수 있습니다: + + `venice_parameters`를 사용하여 웹 검색과 같은 Venice 전용 기능을 활성화할 수 있습니다: - ```python Python - 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) - ``` - - ```javascript Node.js - 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); - ``` - - ```bash cURL - 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": [ + + ```python Python + 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?"} - ], - "venice_parameters": { - "enable_web_search": "auto", - "include_venice_system_prompt": true - } - }' - ``` - + ], + extra_body={ + "venice_parameters": { + "enable_web_search": "auto", + "include_venice_system_prompt": True + } + } + ) + + print(completion.choices[0].message.content) + ``` - [사용 가능한 모든 파라미터](https://docs.venice.ai/api-reference/api-spec#venice-parameters)를 확인하세요. - + ```javascript Node.js + 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); + ``` - - `stream=True`를 사용해 응답을 실시간으로 스트리밍합니다: + ```bash cURL + 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 + } + }' + ``` - - ```python Python - 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="") - ``` - - ```javascript Node.js - 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); - } - } - ``` - - ```bash cURL - 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 - }' - ``` - - - temperature, max tokens 등 다양한 파라미터로 모델 응답 방식을 제어하세요: + 모든 [사용 가능한 매개변수](https://docs.venice.ai/api-reference/api-spec#venice-parameters)를 확인하세요. + + + `stream=True`를 사용하여 응답을 실시간으로 스트리밍하세요: - ```python Python - 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) - ``` - - ```javascript Node.js - 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); - ``` - - ```bash cURL - 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 - } - }' - ``` - - 지원되는 모든 파라미터에 대한 자세한 내용은 [Chat Completions 문서](/api-reference/endpoint/chat/completions)를 확인하세요. + ```python Python + 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="") + ``` + + ```javascript Node.js + 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); + } + } + ``` + + ```bash cURL + 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 + }' + ``` + + - + + temperature, max tokens 등의 매개변수로 모델의 응답 방식을 제어하세요: ---- + -## 더 많은 기능 - -### 이미지 생성 - -확산(diffusion) 모델로 텍스트 prompt에서 이미지를 생성합니다: - - - ```python Python - 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()) - ``` - - ```javascript Node.js - 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); - } - ``` - - ```bash cURL - 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 - }' - ``` - - -**참고:** 응답은 `images` 배열에 base64로 인코딩된 이미지를 반환합니다. base64 문자열을 디코딩해 이미지를 저장하거나 표시하세요. - -**인기 있는 이미지 모델:** -- `qwen-image` - 가장 높은 품질의 이미지 생성 -- `venice-sd35` - 기본 선택, 모든 기능과 호환 -- `hidream` - 프로덕션 환경을 위한 빠른 생성 - - - 가격과 기능과 함께 사용 가능한 모든 이미지 모델을 확인하세요 - - -`cfg_scale`, `negative_prompt`, `style_preset`, `seed`, `variants` 등 더 고급 파라미터 옵션은 [Images API 레퍼런스](/api-reference/endpoint/image/generate)를 참고하세요. - -### 이미지 편집 - -Qwen-Image 모델을 활용한 AI 기반 인페인팅으로 기존 이미지를 수정합니다: - - - ```python Python - 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) - ``` - - ```javascript Node.js - 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)); - ``` - - ```bash cURL - 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..." - }' - ``` - - -**참고:** 이미지 편집기는 Qwen-Image 모델을 사용하며 실험적 endpoint입니다. 입력 이미지는 base64로 인코딩된 문자열로 보내고, API는 편집된 이미지를 바이너리 데이터로 반환합니다. - -모든 파라미터는 [Image Edit API](/api-reference/endpoint/image/edit)를 참고하세요. - -### 이미지 업스케일링 - -이미지를 더 높은 해상도로 향상시키고 업스케일링합니다: - - - ```python Python - 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) - ``` - - ```javascript Node.js - 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)); - ``` - - ```bash cURL - 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 - }' - ``` - - -**참고:** 입력 이미지는 base64로 인코딩된 문자열로 보내고, API는 업스케일된 이미지를 바이너리 데이터로 반환합니다. - -모든 파라미터는 [Image Upscale API](/api-reference/endpoint/image/upscale)를 참고하세요. - -### Text-to-Speech - -50개 이상의 다국어 음성으로 텍스트를 음성으로 변환합니다: - - - ```python Python - 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) - ``` - - ```javascript Node.js - 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)); - ``` - - ```bash cURL - 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 - ``` - - -`tts-kokoro` 모델은 `af_sky`, `af_nova`, `am_liam`, `bf_emma`, `zf_xiaobei`, `jm_kumo` 등 50개 이상의 다국어 음성을 지원합니다. - -모든 음성 옵션은 [TTS API](/api-reference/endpoint/audio/speech)를 참고하세요. - -### Speech-to-Text - -오디오 파일을 텍스트로 전사합니다: - - - ```python Python - 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()) - ``` - - ```javascript Node.js - 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); - ``` - - ```bash cURL - 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 - ``` - - -지원 포맷: WAV, FLAC, MP3, M4A, AAC, MP4. 단어 단위 타이밍 데이터가 필요하면 `timestamps=true`를 활성화하세요. - -모든 옵션은 [Transcriptions API](/api-reference/endpoint/audio/transcriptions)를 참고하세요. - -### 임베딩(Embeddings) - -시맨틱 검색, RAG, 추천 등을 위한 벡터 임베딩을 생성합니다: - - - ```python Python - 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()) - ``` - - ```javascript Node.js - 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); - } - ``` - - ```bash cURL - 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" - }' - ``` - - -배치 처리와 고급 옵션은 [Embeddings API](/api-reference/endpoint/embeddings/generate)를 참고하세요. - -### 비전(멀티모달) - -`qwen3-vl-235b-a22b` 같은 비전 지원 모델을 사용해 이미지와 텍스트를 함께 분석합니다: - - - ```python Python - 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) - ``` - - ```javascript Node.js - 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); - ``` - - ```bash cURL - 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" - } + ```python Python + 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 } - ] } - ] - }' - ``` - - -### 함수 호출(Function Calling) - -모델이 외부 도구와 API와 상호작용하기 위해 호출할 수 있는 함수를 정의합니다: - - - ```python Python - 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) - ``` - - ```javascript Node.js - 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); - ``` - - ```bash cURL - 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?" + ) + + print(completion.choices[0].message.content) + ``` + + ```javascript Node.js + 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 } - ], - "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"] - } - } + }); + + console.log(completion.choices[0].message.content); + ``` + + ```bash cURL + 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 } - ] - }' - ``` - + }' + ``` + + + + 지원되는 모든 매개변수에 대한 자세한 내용은 [Chat Completions 문서](/api-reference/endpoint/chat/completions)를 확인하세요. + + --- ## 다음 단계 -첫 요청을 보내봤다면, Venice API의 더 많은 기능을 살펴보세요: +첫 요청을 완료했으니, Venice API가 제공하는 더 많은 기능을 살펴보세요: - 사용 가능한 모든 모델의 기능, 가격, context 한도를 비교하세요 + 사용 가능한 모든 모델의 기능, 가격, 컨텍스트 제한을 비교하세요 + - 모든 endpoint와 파라미터가 포함된 상세 API 문서를 살펴보세요 + 모든 엔드포인트와 매개변수에 대한 자세한 API 문서를 살펴보세요 + - 스키마가 보장되는 JSON 응답을 받는 방법을 알아보세요 + 보장된 스키마로 JSON 응답을 받는 방법을 알아보세요 + - 에이전트 앱, 코딩 에이전트, MCP 도구, 스킬, 크립토 워크플로로 빌드하세요 + 에이전트 앱, 코딩 에이전트, MCP 도구, 스킬, 암호화폐 워크플로우를 구축하세요 -### 추가 리소스 +### 추가 자료 - - rate limit과 프로덕션 사용 모범 사례를 이해하세요 + + 프로덕션 사용을 위한 속도 제한과 모범 사례를 이해하세요 - - API 에러 처리 및 문제 해결을 위한 레퍼런스 + + + API 오류 처리 및 문제 해결에 대한 참고 자료 + - 간편한 테스트를 위해 완전한 Postman 컬렉션을 임포트하세요 + 간편한 테스트를 위해 전체 Postman 컬렉션을 가져오세요 + - Venice의 프라이버시 우선 아키텍처와 데이터 처리 방식을 알아보세요 + Venice의 프라이버시 우선 아키텍처와 데이터 처리 방식에 대해 알아보세요 @@ -998,9 +389,9 @@ Qwen-Image 모델을 활용한 AI 기반 인페인팅으로 기존 이미지를 ## 도움이 필요하신가요? -- **Discord 커뮤니티**: [Discord 서버](https://discord.gg/askvenice)에 참여해 지원과 토론을 받으세요 -- **문서**: [완전한 API 레퍼런스](/api-reference/api-spec)를 살펴보세요 +- **Discord 커뮤니티**: 지원과 토론을 위해 [Discord 서버](https://discord.gg/askvenice)에 참여하세요 +- **문서**: [전체 API 레퍼런스](/api-reference/api-spec)를 살펴보세요 - **상태 페이지**: [veniceai-status.com](https://veniceai-status.com)에서 서비스 상태를 확인하세요 -- **Twitter**: 업데이트는 [@AskVenice](https://x.com/AskVenice)를 팔로우하세요 +- **Twitter**: 업데이트를 위해 [@AskVenice](https://x.com/AskVenice)를 팔로우하세요 diff --git a/pt-BR/overview/getting-started.mdx b/pt-BR/overview/getting-started.mdx index bcfcb82..df7695c 100644 --- a/pt-BR/overview/getting-started.mdx +++ b/pt-BR/overview/getting-started.mdx @@ -1,20 +1,19 @@ --- -title: Primeiros passos -description: "Início rápido da Venice API — gere uma chave de API, envie sua primeira chat completion e explore os endpoints de imagem, vídeo e áudio em minutos." -"og:title": "Início rápido | Documentação da API Venice" +title: "Guia rápido" +description: "Guia rápido para a API Venice — gere uma chave de API, envie sua primeira conclusão de chat e explore endpoints de imagem, vídeo e áudio em minutos." +og:title: "Guia rápido | Documentação da API Venice" --- Comece a usar a API Venice em minutos. Gere uma chave de API, faça sua primeira requisição e comece a construir. -## Início rápido +## Guia rápido - Vá até suas [Configurações da API Venice](https://venice.ai/settings/api) e gere uma nova chave de API. + Acesse as [Configurações da API Venice](https://venice.ai/settings/api) e gere uma nova chave de API. - Para um passo a passo detalhado, confira o [guia de chave de API](/guides/getting-started/generating-api-key). + Para um tutorial detalhado, confira o [guia de Chave de API](/guides/getting-started/generating-api-key). - Adicione sua chave de API ao seu ambiente. Você pode exportá-la no seu shell: @@ -22,91 +21,94 @@ Comece a usar a API Venice em minutos. Gere uma chave de API, faça sua primeira export VENICE_API_KEY='your-api-key-here' ``` - Ou adicione-a a um arquivo `.env` no seu projeto: + Ou adicioná-la a um arquivo `.env` no seu projeto: ```bash VENICE_API_KEY=your-api-key-here ``` - - A Venice é compatível com a OpenAI, então você pode usar o SDK da OpenAI. Se preferir usar cURL ou requisições HTTP brutas, pode pular este passo. + A Venice é compatível com a OpenAI, então você pode usar o SDK da OpenAI. Se preferir usar cURL ou requisições HTTP puras, você pode pular esta etapa. - ```bash Python - pip install openai - ``` - ```bash Node.js - npm install openai - ``` + ```bash Python + pip install openai + ``` + + ```bash Node.js + npm install openai + ``` + - - ```python Python - 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) - ``` - - ```javascript Node.js - 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); - ``` - - ```bash cURL - 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": [ + + ```python Python + 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) + ``` + + ```javascript Node.js + 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); + ``` + + ```bash cURL + 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?"} + ] + }' + ``` + - **Papéis de mensagem:** - - `system` - Instruções de como o modelo deve se comportar + **Funções das mensagens:** + + - `system` - Instruções sobre como o modelo deve se comportar - `user` - Seus prompts ou perguntas - - `assistant` - Respostas anteriores do modelo (para conversas com múltiplos turnos) + - `assistant` - Respostas anteriores do modelo (para conversas de múltiplos turnos) - `tool` - Resultados de chamadas de função (ao usar ferramentas) - - Toda requisição inclui um `model` ID. Para usar um modelo diferente, altere o valor de `model` na sua requisição. Escolhas populares: + Cada requisição inclui um ID de `model`. Para usar um modelo diferente, altere o valor de `model` na sua requisição. Escolhas populares: + - `zai-org-glm-5` - Modelo padrão para a maioria dos casos de uso - `kimi-k2-6` - Raciocínio forte para tarefas mais complexas - `claude-opus-4-8` - Modelo de alta inteligência para tarefas complexas @@ -116,864 +118,250 @@ Comece a usar a API Venice em minutos. Gere uma chave de API, faça sua primeira Navegue pela lista completa de modelos com preços, capacidades e limites de contexto - - Você pode optar por habilitar recursos específicos da Venice como busca na web usando `venice_parameters`: + Você pode optar por ativar recursos específicos da Venice, como busca na web, usando `venice_parameters`: - ```python Python - 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) - ``` - - ```javascript Node.js - 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); - ``` - - ```bash cURL - 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": [ + + ```python Python + 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?"} - ], - "venice_parameters": { - "enable_web_search": "auto", - "include_venice_system_prompt": true - } - }' - ``` + ], + extra_body={ + "venice_parameters": { + "enable_web_search": "auto", + "include_venice_system_prompt": True + } + } + ) + + print(completion.choices[0].message.content) + ``` + + ```javascript Node.js + 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); + ``` + + ```bash cURL + 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 + } + }' + ``` + Veja todos os [parâmetros disponíveis](https://docs.venice.ai/api-reference/api-spec#venice-parameters). - - + Faça streaming das respostas em tempo real usando `stream=True`: - ```python Python - 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="") - ``` - - ```javascript Node.js - 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); - } - } - ``` - - ```bash cURL - 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 - }' - ``` + + ```python Python + 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="") + ``` + + ```javascript Node.js + 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); + } + } + ``` + + ```bash cURL + 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 + }' + ``` + - - Controle como o modelo responde com parâmetros como temperature, max tokens e mais: + Controle como o modelo responde com parâmetros como temperature, max tokens e outros: - ```python Python - 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) - ``` - - ```javascript Node.js - 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); - ``` - - ```bash cURL - 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": [ + + ```python Python + 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, - "stream": false, - "venice_parameters": { - "include_venice_system_prompt": false - } - }' - ``` - - - Confira a documentação de [Chat Completions](/api-reference/endpoint/chat/completions) para mais informações sobre todos os parâmetros suportados. - - - ---- - -## Mais capacidades - -### Geração de imagens - -Crie imagens a partir de prompts de texto usando modelos de difusão: - - - ```python Python - 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()) - ``` - - ```javascript Node.js - 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); - } - ``` - - ```bash cURL - 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 - }' - ``` - - -**Nota:** A resposta retorna imagens codificadas em base64 no array `images`. Decodifique a string base64 para salvar ou exibir a imagem. - -**Modelos de imagem populares:** -- `qwen-image` - Geração de imagem da mais alta qualidade -- `venice-sd35` - Escolha padrão, funciona com todos os recursos -- `hidream` - Geração rápida para uso em produção - - - Veja todos os modelos de imagem disponíveis com preços e capacidades - - -Para opções de parâmetros mais avançadas como `cfg_scale`, `negative_prompt`, `style_preset`, `seed`, `variants` e mais, confira a [referência da API de imagens](/api-reference/endpoint/image/generate). - -### Edição de imagem - -Modifique imagens existentes com inpainting com IA usando o modelo Qwen-Image: - - - ```python Python - 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) - ``` - - ```javascript Node.js - 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)); - ``` - - ```bash cURL - 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..." - }' - ``` - - -**Nota:** O editor de imagens usa o modelo Qwen-Image e é um endpoint experimental. Envie a imagem de entrada como uma string codificada em base64, e a API retornará a imagem editada como dados binários. - -Veja a [API de edição de imagens](/api-reference/endpoint/image/edit) para todos os parâmetros. - -### Upscaling de imagem - -Aprimore e faça upscale de imagens para resoluções mais altas: - - - ```python Python - 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) - ``` - - ```javascript Node.js - 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)); - ``` - - ```bash cURL - 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 - }' - ``` - - -**Nota:** Envie a imagem de entrada como uma string codificada em base64, e a API retornará a imagem com upscale como dados binários. - -Veja a [API de upscale de imagem](/api-reference/endpoint/image/upscale) para todos os parâmetros. - -### Texto para fala - -Converta texto em áudio com mais de 50 vozes multilíngues: - - - ```python Python - 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) - ``` - - ```javascript Node.js - 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)); - ``` - - ```bash cURL - 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 - ``` - - -O modelo `tts-kokoro` suporta mais de 50 vozes multilíngues, incluindo `af_sky`, `af_nova`, `am_liam`, `bf_emma`, `zf_xiaobei` e `jm_kumo`. - -Veja a [API de TTS](/api-reference/endpoint/audio/speech) para todas as opções de voz. - -### Fala para texto - -Transcreva arquivos de áudio em texto: - - - ```python Python - 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()) - ``` - - ```javascript Node.js - 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); - ``` - - ```bash cURL - 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 - ``` - - -Formatos suportados: WAV, FLAC, MP3, M4A, AAC, MP4. Habilite `timestamps=true` para obter dados de tempo no nível de palavra. - -Veja a [API de transcrições](/api-reference/endpoint/audio/transcriptions) para todas as opções. - -### Embeddings - -Gere embeddings vetoriais para busca semântica, RAG e recomendações: - - - ```python Python - 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()) - ``` - - ```javascript Node.js - 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); - } - ``` - - ```bash cURL - 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" - }' - ``` - - -Veja a [API de embeddings](/api-reference/endpoint/embeddings/generate) para processamento em lote e opções avançadas. - -### Visão (multimodal) - -Analise imagens junto com texto usando modelos com capacidade de visão como `qwen3-vl-235b-a22b`: - - - ```python Python - 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) - ``` - - ```javascript Node.js - 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); - ``` - - ```bash cURL - 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" - } + ], + 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 } - ] } - ] - }' - ``` - - -### Function calling - -Defina funções que os modelos podem chamar para interagir com ferramentas e APIs externas: - - - ```python Python - 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) - ``` - - ```javascript Node.js - 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); - ``` - - ```bash cURL - 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?" + ) + + print(completion.choices[0].message.content) + ``` + + ```javascript Node.js + 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 } - ], - "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"] - } - } + }); + + console.log(completion.choices[0].message.content); + ``` + + ```bash cURL + 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 } - ] - }' - ``` - + }' + ``` + + + + Confira a [documentação de Chat Completions](/api-reference/endpoint/chat/completions) para mais informações sobre todos os parâmetros suportados. + + --- ## Próximos passos -Agora que você fez suas primeiras requisições, explore mais do que a API Venice oferece: +Agora que você fez suas primeiras requisições, explore mais do que a API Venice tem a oferecer: - + Compare todos os modelos disponíveis com suas capacidades, preços e limites de contexto + Explore a documentação detalhada da API com todos os endpoints e parâmetros + - Aprenda a obter respostas em JSON com schemas garantidos + Aprenda como obter respostas em JSON com esquemas garantidos + - Construa com apps de agente, agentes de programação, ferramentas MCP, skills e fluxos cripto + Construa com apps de agentes, agentes de programação, ferramentas MCP, skills e fluxos de trabalho cripto @@ -983,14 +371,17 @@ Agora que você fez suas primeiras requisições, explore mais do que a API Veni Entenda os limites de taxa e as melhores práticas para uso em produção + - Referência para tratar erros da API e solucionar problemas + Referência para lidar com erros da API e solucionar problemas + - Importe nossa coleção completa do Postman para testes fáceis + Importe nossa coleção completa do Postman para facilitar os testes + - Saiba mais sobre a arquitetura privacy-first da Venice e o tratamento de dados + Saiba mais sobre a arquitetura da Venice, que prioriza a privacidade, e o tratamento de dados diff --git a/zh/overview/getting-started.mdx b/zh/overview/getting-started.mdx index 5e93c62..22ee0fe 100644 --- a/zh/overview/getting-started.mdx +++ b/zh/overview/getting-started.mdx @@ -1,996 +1,387 @@ --- -title: 开始使用 -description: "Venice API 快速上手 —— 生成 API 密钥、发送您的第一个 chat completion,并在几分钟内探索图像、视频和音频端点。" -"og:title": "Quickstart | Venice API Docs" +title: "快速开始" +description: "Venice API 快速开始指南 —— 生成 API 密钥、发送首个聊天补全请求,并在几分钟内探索图像、视频和音频端点。" +og:title: "快速开始 | Venice API 文档" --- -在几分钟内启动并运行 Venice API。生成 API 密钥、发出您的第一个请求,并开始构建。 +在几分钟内上手使用 Venice API。生成 API 密钥,发起首个请求,开始构建。 ## 快速开始 - 前往您的 [Venice API 设置](https://venice.ai/settings/api) 并生成新的 API 密钥。 + 前往您的 [Venice API 设置](https://venice.ai/settings/api) 生成一个新的 API 密钥。 - 如需详细的操作指南,请查看 [API 密钥指南](/guides/getting-started/generating-api-key)。 + 如需详细的操作指导,请查阅 [API 密钥指南](/guides/getting-started/generating-api-key)。 - - - 将您的 API 密钥添加到您的环境中。您可以在 shell 中导出它: + + 将您的 API 密钥添加到环境变量中。您可以在 shell 中导出: ```bash export VENICE_API_KEY='your-api-key-here' ``` - 或将其添加到项目中的 `.env` 文件: + 或将其添加到项目的 `.env` 文件中: ```bash VENICE_API_KEY=your-api-key-here ``` - - Venice 与 OpenAI 兼容,因此您可以使用 OpenAI SDK。如果您更喜欢使用 cURL 或原始 HTTP 请求,可以跳过此步骤。 + Venice 兼容 OpenAI,因此您可以直接使用 OpenAI SDK。如果您更愿意使用 cURL 或原始 HTTP 请求,可以跳过此步骤。 - ```bash Python - pip install openai - ``` - ```bash Node.js - npm install openai - ``` + ```bash Python + pip install openai + ``` + + ```bash Node.js + npm install openai + ``` + - - ```python Python - 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) - ``` - - ```javascript Node.js - 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); - ``` - - ```bash cURL - 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": [ + + ```python Python + 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) + ``` + + ```javascript Node.js + 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); + ``` + + ```bash cURL + 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?"} + ] + }' + ``` + **消息角色:** - - `system` - 模型应如何表现的指令 - - `user` - 您的 prompt 或问题 - - `assistant` - 之前的模型响应(用于多轮对话) - - `tool` - 函数调用结果(使用工具时) - + - `system` - 关于模型应如何表现的指令 + - `user` - 您的提示或问题 + - `assistant` - 模型此前的回复(用于多轮对话) + - `tool` - 函数调用结果(在使用工具时) + - 每个请求都包含一个 `model` ID。要使用不同的模型,请更改请求中的 `model` 值。热门选择: - - `zai-org-glm-5` - 大多数用例的默认模型 - - `kimi-k2-6` - 适用于更复杂任务的强大推理 + 每个请求都包含一个 `model` ID。要使用不同的模型,请更改请求中的 `model` 值。常用选择: + + - `zai-org-glm-5` - 适用于大多数场景的默认模型 + - `kimi-k2-6` - 面向更复杂任务的强推理能力 - `claude-opus-4-8` - 适用于复杂任务的高智能模型 - `venice-uncensored-1-2` - Venice 的无审查模型 - 浏览包含定价、能力和上下文限制的完整模型列表 + 浏览完整的模型列表,包含价格、能力和上下文限制 - - 您可以选择使用 `venice_parameters` 启用 Venice 特有的功能,如网页搜索: + 您可以选择通过 `venice_parameters` 启用 Venice 特有功能,例如网页搜索: - ```python Python - 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) - ``` - - ```javascript Node.js - 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); - ``` - - ```bash cURL - 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": [ + + ```python Python + 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?"} - ], - "venice_parameters": { - "enable_web_search": "auto", - "include_venice_system_prompt": true - } - }' - ``` + ], + extra_body={ + "venice_parameters": { + "enable_web_search": "auto", + "include_venice_system_prompt": True + } + } + ) + + print(completion.choices[0].message.content) + ``` + + ```javascript Node.js + 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); + ``` + + ```bash cURL + 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 + } + }' + ``` + 查看所有[可用参数](https://docs.venice.ai/api-reference/api-spec#venice-parameters)。 - - 使用 `stream=True` 实时流式传输响应: + 使用 `stream=True` 实时流式获取响应: - ```python Python - 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="") - ``` - - ```javascript Node.js - 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); - } - } - ``` - - ```bash cURL - 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 - }' - ``` + + ```python Python + 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="") + ``` + + ```javascript Node.js + 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); + } + } + ``` + + ```bash cURL + 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 + }' + ``` + - - 使用 temperature、max tokens 等参数控制模型的响应方式: + 通过 temperature、max tokens 等参数控制模型的响应方式: - ```python Python - 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) - ``` - - ```javascript Node.js - 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); - ``` - - ```bash cURL - 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": [ + + ```python Python + 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, - "stream": false, - "venice_parameters": { - "include_venice_system_prompt": false - } - }' - ``` - - - 有关所有支持参数的更多信息,请查看 [Chat Completions 文档](/api-reference/endpoint/chat/completions)。 - - - ---- - -## 更多能力 - -### 图像生成 - -使用扩散模型从文本 prompt 创建图像: - - - ```python Python - 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()) - ``` - - ```javascript Node.js - 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); - } - ``` - - ```bash cURL - 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 - }' - ``` - - -**注意:** 响应在 `images` 数组中返回 base64 编码的图像。解码 base64 字符串以保存或显示图像。 - -**热门图像模型:** -- `qwen-image` - 最高质量的图像生成 -- `venice-sd35` - 默认选择,适用于所有功能 -- `hidream` - 用于生产用途的快速生成 - - - 查看所有可用图像模型及其定价和能力 - - -要了解更高级的参数选项,如 `cfg_scale`、`negative_prompt`、`style_preset`、`seed`、`variants` 等,请查看 [图像 API 参考](/api-reference/endpoint/image/generate)。 - -### 图像编辑 - -使用 Qwen-Image 模型通过 AI 驱动的修复修改现有图像: - - - ```python Python - 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) - ``` - - ```javascript Node.js - 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)); - ``` - - ```bash cURL - 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..." - }' - ``` - - -**注意:** 图像编辑器使用 Qwen-Image 模型,是一个实验性端点。将输入图像作为 base64 编码字符串发送,API 以二进制数据返回编辑后的图像。 - -有关所有参数,请参阅 [Image Edit API](/api-reference/endpoint/image/edit)。 - -### 图像放大 - -将图像增强并放大到更高分辨率: - - - ```python Python - 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) - ``` - - ```javascript Node.js - 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)); - ``` - - ```bash cURL - 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 - }' - ``` - - -**注意:** 将输入图像作为 base64 编码字符串发送,API 以二进制数据返回放大的图像。 - -有关所有参数,请参阅 [Image Upscale API](/api-reference/endpoint/image/upscale)。 - -### 文本转语音 - -使用 50+ 种多语言声音将文本转换为音频: - - - ```python Python - 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) - ``` - - ```javascript Node.js - 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)); - ``` - - ```bash cURL - 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 - ``` - - -`tts-kokoro` 模型支持 50+ 种多语言声音,包括 `af_sky`、`af_nova`、`am_liam`、`bf_emma`、`zf_xiaobei` 和 `jm_kumo`。 - -有关所有声音选项,请参阅 [TTS API](/api-reference/endpoint/audio/speech)。 - -### 语音转文本 - -将音频文件转录为文本: - - - ```python Python - 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()) - ``` - - ```javascript Node.js - 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); - ``` - - ```bash cURL - 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 - ``` - - -支持的格式:WAV、FLAC、MP3、M4A、AAC、MP4。启用 `timestamps=true` 以获取字级时间数据。 - -有关所有选项,请参阅 [Transcriptions API](/api-reference/endpoint/audio/transcriptions)。 - -### Embeddings - -为语义搜索、RAG 和推荐生成向量嵌入: - - - ```python Python - 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()) - ``` - - ```javascript Node.js - 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); - } - ``` - - ```bash cURL - 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" - }' - ``` - - -有关批处理和高级选项,请参阅 [Embeddings API](/api-reference/endpoint/embeddings/generate)。 - -### Vision(多模态) - -使用支持视觉的模型如 `qwen3-vl-235b-a22b` 与文本一起分析图像: - - - ```python Python - 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) - ``` - - ```javascript Node.js - 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); - ``` - - ```bash cURL - 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" - } + ], + 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 } - ] } - ] - }' - ``` - - -### 函数调用 - -定义模型可以调用以与外部工具和 API 交互的函数: - - - ```python Python - 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) - ``` - - ```javascript Node.js - 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); - ``` - - ```bash cURL - 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?" + ) + + print(completion.choices[0].message.content) + ``` + + ```javascript Node.js + 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 } - ], - "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"] - } - } + }); + + console.log(completion.choices[0].message.content); + ``` + + ```bash cURL + 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 } - ] - }' - ``` - + }' + ``` + + + + 请查阅 [聊天补全文档](/api-reference/endpoint/chat/completions) 了解所有受支持参数的更多信息。 + + --- -## 下一步 +## 后续步骤 -既然您已经发出了第一个请求,请进一步探索 Venice API 提供的更多内容: +在完成首个请求之后,您可以进一步探索 Venice API 提供的更多功能: - 比较所有可用模型及其能力、定价和上下文限制 + 比较所有可用模型的能力、价格和上下文限制 + - 探索包含所有端点和参数的详细 API 文档 + 浏览详细的 API 文档,包含所有端点和参数 + - 了解如何获取具有保证 schema 的 JSON 响应 + 学习如何获得具有确定 schema 的 JSON 响应 + - 使用 agent 应用、编码 agent、MCP 工具、skill 和加密货币工作流进行构建 + 使用 agent 应用、编码 agent、MCP 工具、技能和加密工作流进行构建 -### 其他资源 +### 更多资源 - 了解速率限制和生产使用的最佳实践 + 了解速率限制及生产环境使用的最佳实践 + - 处理 API 错误和故障排查的参考 + 处理 API 错误和排查问题的参考 - - 导入我们的完整 Postman collection 以方便测试 + + + 导入我们完整的 Postman 集合,轻松进行测试 + - 了解 Venice 的隐私优先架构和数据处理 + 了解 Venice 隐私优先的架构与数据处理方式 @@ -998,9 +389,9 @@ description: "Venice API 快速上手 —— 生成 API 密钥、发送您的第 ## 需要帮助? -- **Discord 社区**:加入我们的 [Discord 服务器](https://discord.gg/askvenice) 获取支持和讨论 -- **文档**:浏览我们的 [完整 API 参考](/api-reference/api-spec) -- **状态页**:在 [veniceai-status.com](https://veniceai-status.com) 检查服务状态 -- **Twitter**:关注 [@AskVenice](https://x.com/AskVenice) 获取更新 +- **Discord 社区**:加入我们的 [Discord 服务器](https://discord.gg/askvenice) 获取支持并参与讨论 +- **文档**:浏览我们的[完整 API 参考](/api-reference/api-spec) +- **状态页面**:在 [veniceai-status.com](https://veniceai-status.com) 查看服务状态 +- **Twitter**:关注 [@AskVenice](https://x.com/AskVenice) 获取最新动态