venice-py
<div align="center">
<a href="https://venice-docs.sbang.dev/"><img src="https://raw.githubusercontent.com/sethbang/venice-py/main/website/static/img/venice-py-banner.png" alt="venice-py — unofficial, community-maintained Python SDK for Venice.ai" width="720"></a>
PyPI version
Python Versions
License: MIT
CI Status
Coverage Status
Security Scan
Docs
Venice.ai를 위한 프로덕션 레디 Python SDK로, 엔터프라이즈급 Rate Limiting, 지능형 스케줄링 및 포괄적인 오류 처리를 제공합니다.
문서(Documentation) | 예제(Examples) | 변경 로그(Changelog) | API 참조(API Reference)
</div>
이것은 Venice.ai를 위한 비공식, 커뮤니티 유지보수 SDK입니다.
Venice AI와 제휴하거나 보증하지 않습니다. 공식 리소스는 Venice.ai를 방문하십시오.
venice-py로 설치됩니다. 이 패키지는 v2.1.0을 통해 venice-ai로 게시되었습니다.
사용하는 코드는 변경되지 않습니다 — import 패키지는 여전히 venice_ai이며 환경 변수는 여전히 VENICE_API_KEY입니다. 이름만 설치할 때 바뀌었습니다:
venice-ai는 PyPI에 남아 있으며 아무것도 제거되지 않으므로 기존의 핀(pin)은 계속 해결됩니다. 최종 릴리스인 2.1.1은 venice-py를 가져오는 메타데이터 전용 브릿지입니다. 이 브릿지는 **어떠한 추가 기능(extras)**도 선언하지 않기 때문에, 만약 [cli], [x402], [redis], [all] 중 어떤 것을 설치하더라도 이름을 변경하거나 pip가 경고를 표시하고 조용히 건너뛰게 됩니다.
v2.x — v1.3.x 대비 기업 수준의 기능(enterprise-grade features)을 갖춘 완전한 리라이트 버전입니다. 업그레이드하기 전에 릴리스 노트, CHANGELOG, 그리고 마이그레이션 가이드를 검토하세요.
Quick Start
Python 3.11 이상 필요. 이전 버전에서는 pip가 일치하는 배포판을 찾을 수 없다고 보고합니다.
pip install 'venice-py'
export VENICE_API_KEY="your-api-key-here"
import asyncio
from venice_ai import VeniceClient, UserMessage
...
v1.x에서 마이그레이션하셨나요? 마이그레이션 가이드를 확인하세요.
Command Line Interface
명령어는 venice-py입니다. 이는 Venice의 공식 CLI가 아니며, 공식 CLI는 별도의 Node 프로그램인 veniceai-cli이며 venice로 호출됩니다. 두 가지 모두 한 번에 설치할 수 있습니다. (이 명령어는 v2.0.x에서 venice였습니다. 업그레이드하는 경우 CHANGELOG를 확인하세요.)
pip install 'venice-py[cli]'
venice-py chat start
...
기능: 6가지 애니메이션 모드를 갖춘 스트리밍 채팅, 11개 이상의 파라미터로 이미지 생성, 모델 검색(model discovery), 풍부한 터미널 UI. 전체 CLI 문서는 CLI 레퍼런스를 참조하세요.
SDK에는 네 가지 Claude Code skills가 포함되어 있습니다. venice-py skills install을 사용하여 현재 프로젝트에 설치하거나, 전역으로 설치하려면 venice-py skills install --global을 사용하세요(경로: ~/.claude/skills/); 목록은 venice-py skills list로 확인할 수 있습니다. 이 스킬들은 트리거 컨텍스트가 일치하면 자동으로 로드되어 — “Venice chat”, “generate an image with Venice”, “Venice rate limits”, “Venice x402”와 같은 경우에 — Claude를 OpenAI 스타일이나 v1 패턴 대신 관용적인 v2 코드(동적 모델 해상도, async with stream:, run_with_tools, client.gather(max_concurrency=N), top_up_with 등)로 유도합니다.
venice-py skills install
venice-py skills install --global
venice-py skills list
카탈로그: venice-py (채팅 / 스트리밍 / 도구 / 구조화된 출력), venice-py-multimodal (이미지 / 오디오 / 비디오 / 음악), venice-py-production (재시도 / 속도 제한 / 비용 추적 / 관측 가능성), venice-py-x402 (지갑 인증 / SIWE / 온체인 상한 충전). 전체 카탈로그 및 유효성 검사 도구는 tools/skills/README.md를 참조하세요.
핵심 기능 (Core Features)
채팅 완성 (Chat Completions)
from venice_ai import UserMessage, SystemMessage
async with VeniceClient() as client:
...
-> examples/chat/simple_chat.py
스트리밍 (Streaming)
model = await client.models.resolve_chat()
async with await client.chat.completions.stream(
model=model,
...
완성된 응답을 얻으려면: response = await stream.collect().
-> examples/chat/streaming_chat.py
동기식 사용 (Synchronous Usage)
from venice_ai import SyncVeniceClient, UserMessage
with SyncVeniceClient() as client:
...
SyncVeniceClient가 반환하는 스트림은 동기적으로 반복됩니다 (for chunk in stream:).
함수 호출 (Function Calling)
from venice_ai import tool_from_function
def get_weather(location: str) -> str:
...
더 풍부한 스키마를 위해서는 tool_from_model(MyPydanticModel)도 사용할 수 있습니다.
-> examples/chat/tool_calling.py
이미지 생성 (Image Generation)
image_model = await client.models.resolve_image()
response = await client.image.create(
model=image_model,
...
image.multi_edit()의 패스스루 필드에는 이제 model=...이 포함되며, SDK는 이를 API로 modelId(이전에는 조용히 누락되던 값)로 전달합니다.
-> examples/image/text_to_image.py | -> examples/image/web_search.py
텍스트 음성 변환 (Text-to-Speech)
from venice_ai.types.enums import Voice, ResponseFormat
tts_model = await client.models.resolve_tts()
...
-> examples/audio/text_to_speech.py
임베딩 (Embeddings)
embedding_model = await client.models.resolve_embedding()
response = await client.embeddings.create(
model=embedding_model,
...
-> examples/embeddings/basic_embeddings.py
비디오 생성 (Video Generation)
video_model = await client.models.resolve_video()
job = await client.video.run(
model=video_model,
...
Advanced body fields on submit() (모두 선택 사항):
upscale_factor, end_image_url, audio_url, video_url,
reference_image_urls (최대 9개), elements (최대 4개의 Kling-O3 구조화된 문자), scene_image_urls (최대 4개). 전용 topaz-video-upscale 모델의 경우, resolution 대신 video_url + upscale_factor (1/2/4)를 전달해야 합니다. quote()는 API 사양에 따라 가격 관련 하위 집합(model, duration_seconds, aspect_ratio, resolution, upscale_factor, audio, video_url)만 허용하며, 프롬프트 텍스트와 참조 이미지는 가격에 영향을 미치지 않습니다.
-> examples/video/text_to_video.py | -> examples/video/advanced_fields.py | -> examples/video/upscale.py
모델 선택 (Model Selection)
chat_model = await client.models.resolve_chat(
preferred_models=["llama-3.3-70b", "qwen-2.5-72b"],
require_function_calling=True,
...
Venice 전용 기능 (Venice-Specific Features)
캐릭터 페르소나 (Character Personalities)
from venice_ai import VeniceParameters
model = await client.models.resolve_chat()
...
웹 검색 (Web Search)
model = await client.models.resolve_chat()
response = await client.chat.completions.create(
model=model,
...
의사 결정 모델 (Decision Models) (베타)
의사 결정(
모든 질문은 동일한 상태를 기반으로 병렬적이고 독립적으로 평가되므로, 한 질문이 다른 질문의 답변을 볼 수 없습니다. noul은 부울(bool) 값이 아니라 [0, 1] 범위의 확률입니다. Venice는 POST /decisions 엔드포인트를 불안정(unstable)하다고 문서화하고 있습니다: 요청 및 응답 스키마가 예고 없이 변경될 수 있습니다.
-> examples/decisions/ticket_routing.py
웹 크롤링, 검색 및 텍스트 파싱 (Augment)
page = await client.augment.scrape(url="https://example.com")
print(page.content)
...
-> examples/augment/scrape.py | -> examples/augment/search.py | -> examples/augment/text_parser.py
x402 지갑 결제 (선택 사항)
x402 결제 엔드포인트는 Bearer 토큰 대신 Ethereum 지갑 인증(Base의 SIWE / EIP-4361)을 사용합니다. eth-account + siwe를 사용하려면 선택적 추가 기능을 설치하세요:
pip install 'venice-py[x402]'
from venice_ai.auth.x402 import X402Auth
auth = X402Auth(private_key=os.environ["X402_WALLET_PRIVATE_KEY"])
...
원클릭으로 충전하는 것을 선호하십니까? client.x402.top_up_with(auth=auth, amount_usdc=5.0)을 사용하면 전체 EVM 프로브 → 서명 → 제출 흐름이 자동으로 처리됩니다. 대신 Solana 지갑에서 정산하려면 venice-py[x402-solana]를 설치하고 top_up_with_solana과 함께 SolanaX402Auth를 사용하세요:
from venice_ai.auth.x402_solana import SolanaX402Auth
auth = SolanaX402Auth(private_key=os.environ["X402_SOLANA_SECRET"])
...
-> examples/x402/balance.py | -> examples/x402/transactions.py | -> examples/x402/top_up.py
기밀 컴퓨팅 (TEE / E2EE, 선택 사항)
Venice의 e2ee-* 모델은 클라이언트 측 종단 간 암호화(end-to-end encryption)가 적용된 신뢰 실행 환경(Trusted Execution Environment)에서 실행됩니다. 즉, 엔클레이브를 증명하고(attest), 그 후 엔클레이브만이 파생할 수 있는 키로 각 메시지를 암호화합니다 (secp256k1 ECDH -> HKDF-SHA256 -> AES-256-GCM). 선택적 추가 기능(cryptography)을 설치하세요:
pip install 'venice-py[e2ee]'
model = await client.models.resolve_chat()
...
전체 클라이언트 측 TDX 검증 ([e2ee-verify])