潇楠 Web3哨兵 API SDK - 封装文本对话、文生图、文生视频、TTS、播客、市场分析等20+功能
Project description
潇楠 Web3哨兵 API SDK
一个 API Key,调用所有功能:文本对话、文生图、文生视频、TTS、播客、市场分析、代币安全检测、DEX分析、网页提取、快讯、特朗普动态等 20+ 功能。
安装
pip install xiaonan-web3
快速开始
- 购买 API Key
- 在代码中初始化客户端
from xiaonan import Client
client = Client(api_key="sk-你的Key")
功能列表
文本对话
reply = client.chat("你好,请介绍一下你自己") print(reply)
查询可用模型列表
models = client.list_models() for m in models: print(m['id'], m['name'])
多模态模型列表
multimodal_models = client.list_multimodal_models() for m in multimodal_models: print(m['model_id'], m['name'], m['type'])
文生图
image_url = client.image("一只在月亮下奔跑的狼") print(image_url)
文生视频
task = client.video("海浪拍打礁石的慢动作") video_url = task.wait() print(video_url)
TTS 文本转语音
audio_url = client.tts("你好世界") print(audio_url)
双人语音播客
task = client.podcast(text="人工智能的未来发展趋势") audio_url = task.wait() print(audio_url)
AI 一键创作
article = client.article("Web3发展趋势") print(article['title']) print(article['content'])
市场数据 + AI分析
data = client.market("BTCUSDT") print(data['ai_analysis'])
风控检查 + AI解读
report = client.risk(pair="BTCUSDT", side="long", leverage=10) print(report['ai_analysis'])
代币安全检测
result = client.token_check("0x55d398326f99059fF775485246999027B3197955") print(result['ai_analysis'])
代币合约审计
result = client.token_audit("0x55d398326f99059fF775485246999027B3197955") print(result['ai_analysis'])
DEX交易对分析
result = client.dex("0x55d398326f99059fF775485246999027B3197955", chain="bsc") print(result['ai_analysis'])
网页内容提取
result = client.extract("https://example.com/article") print(result['results'])
实时Web3快讯
news = client.newsflash(category="ai", page=1, size=10) for item in news['data']['list']: print(item['title'])
特朗普动态追踪
feed = client.trump_feed() for post in feed['posts']: print(post['content'], post['platform'])
视频解析
info = client.video_parse("https://v.douyin.com/xxx/") print(info['direct_url'])
AI数字人视频生成
V1 (OmniHuman1.5, 消耗50次配额)
task = client.digital_human(text="你好,欢迎使用AI数字人", image_url="https://example.com/photo.jpg") video_url = task.wait()
V2 (单图音频驱动, 消耗20次配额)
task = client.digital_human_v2(text="你好,欢迎使用AI数字人", image_url="https://example.com/photo.jpg") video_url = task.wait()
配额查询
info = client.quota() print(f"剩余: {info['remaining']}, 已用: {info['used_quota']}, 总: {info['total_quota']}")
错误处理
SDK 在 API 调用失败时会抛出异常,异常信息包含具体的错误原因。例如:
try: reply = client.chat("你好") except Exception as e: print(f"调用失败: {e}")
更多信息
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file xiaonan_web3-1.0.0.tar.gz.
File metadata
- Download URL: xiaonan_web3-1.0.0.tar.gz
- Upload date:
- Size: 12.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3f25756a7cf4ee497a037f78f85167d109d63ad9aaeb86f7e15164fc7c5f0720
|
|
| MD5 |
2a18863f6e7b0d74bcf50f09e2acb174
|
|
| BLAKE2b-256 |
10c785486067fd54e133beb779ed261e17f63c19be292d3660bf2b4815724509
|
File details
Details for the file xiaonan_web3-1.0.0-py3-none-any.whl.
File metadata
- Download URL: xiaonan_web3-1.0.0-py3-none-any.whl
- Upload date:
- Size: 14.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c3e6941cd385f4c6d779dfd9ee609f3fb6586386a790495d53b183fa95c4adb1
|
|
| MD5 |
866f28f5e98bbcd4841a72672c8ce0be
|
|
| BLAKE2b-256 |
db3ba0facc8f852f1eb4f6ee4a64a009dcfc403042dc6856fa9b7b4839b8a612
|