Nameyn 官方指南
Nameyn Guide
新一代 AI 中转服务 · 极速 · 稳定 · 便捷 Next-Gen AI Relay · Fast · Stable · Easy
快捷入口
Quick Links
注册账号 Registration 👉 点击注册 👉 Register Now
接口示例
API Examples
添加自定义 Provider(关键步骤)
Add Custom Provider (Key Step)
在配置文件中,将以下 JSON 代码片段加入到 models.providers 块中:
Add the following JSON to models.providers block:
"models": {
"providers": {
"claude": {
"baseUrl": "https://nameyn.shop",
"apiKey": "sk-xxxxxx你的网站获取的秘钥",
"api": "anthropic-messages",
"models": [
{
"id": "claude-opus-4-6",
"name": "claude-opus-4-6",
"reasoning": false,
"input": ["text"],
"cost": {
"input": 0,
"output": 0,
"cacheRead": 0,
"cacheWrite": 0
},
"contextWindow": 200000,
"maxTokens": 8192
}
]
}
}
}
cURL 示例
cURL Example
curl https://nameyn.shop/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-xxxxxxxx" \
-d '{
"model": "gemini-3-pro-preview",
"messages": [{"role": "user", "content": "Hi!"}]
}'
Python 示例
Python Example
from openai import OpenAI
client = OpenAI(
api_key="sk-xxxxxxxx",
base_url="https://nameyn.shop/v1"
)
response = client.chat.completions.create(
model="gemini-3-pro-preview",
messages=[{"role": "user", "content": "Hi!"}]
)
获取 API 令牌
Get API Token
🎬 令牌配置教程
点击令牌管理
Click Token Management
显示操作项,选择添加令牌 Show options, select Add Token
输入名称并选择分组
Enter Name and Select Group
名称任意输入,点击下滑栏按需求选择令牌分组 Enter any name, select Token Group from dropdown
默认选auto分组即可!!! Just select "auto" group by default!!!
设置过期时间和数量
Set Expiration and Quantity
过期时间选择永不过期,新建数量选择一个 Set expiration to Never, quantity to 1
设置令牌额度
Set Token Quota
令牌额度选择无限额度 Select Unlimited Quota
模型限制(可选)
Model Restrictions (Optional)
模型限制列表默认不做选择 Leave model restrictions empty by default
复制密钥
Copy Key
生成的密钥选择小眼睛旁边的点击复制即可 Click Copy button next to the generated key
Claude Code 配置指南
Claude Code Setup
GitHub farion1231/cc-switch v3.11.1(单击跳转!)安装步骤
Installation Steps
1. 安装 Node.js
1. Install Node.js
访问 Node.js 官网,建议下载左侧的 LTS 版本,它是长期支持版,更加稳定。 Visit Node.js official website, download the LTS version on the left for better stability.
2. 安装 Git
2. Install Git
访问 Git 官网,页面会自动推荐适合你操作系统的版本,点击按钮即可下载。 Visit Git official website, the page will automatically recommend the version for your OS.
3. 安装 Claude Code
3. Install Claude Code
打开 cmd 命令行,通过 npm 安装 claude-code: Open cmd and install claude-code via npm:
npm install -g @anthropic-ai/claude-code
🎬 Claude Code 配置教程
配置步骤
Configuration Steps
1. 配置 API 信息
1. Configure API Info
启动 Claude Code 后,配置以下 API 信息: After launching Claude Code, configure the following API info:
- API URL:
https://nameyn.shopAPI URL:https://nameyn.shop - API Key:站点令牌秘钥
sk-xxxxAPI Key: Site tokensk-xxxx - API 格式:anthropic-messages API Format: anthropic-messages
- 模型:
claude-opus-4-6Model:claude-opus-4-6
2. 启动
2. Start
claude
CC Switch 配置教程
CC Switch Configuration
GitHub farion1231/cc-switch v3.11.1(单击跳转下载!)1. Claude 配置
1. Claude Configuration
打开 cc switch 并选择 Claude
Open cc switch and select Claude
启动 cc switch,根据所使用插件进行配置,选择 Claude。 Launch cc switch and select Claude based on your plugin.
点击右上角加号添加配置
Click Plus to Add Configuration
- 供应商名称:随意填写 Provider Name: Any name
- API Key:站点令牌秘钥 API Key: Site token
- 请求地址:
https://nameyn.shopRequest URL:https://nameyn.shop - API 格式:anthropic messages(原生) API Format: anthropic messages (native)
- 主模型:
claude-opus-4-6Main Model:claude-opus-4-6
2. Gemini 配置
2. Gemini Configuration
打开 cc switch 并选择 Gemini
Open cc switch and select Gemini
在 cc switch 中选择 Gemini 插件。 Select Gemini plugin in cc switch.
点击右上角加号添加配置
Click Plus to Add Configuration
- 供应商名称:随意填写 Provider Name: Any name
- API Key:站点令牌秘钥 API Key: Site token
- 请求地址:
https://nameyn.shopRequest URL:https://nameyn.shop - 主模型:
[次]gemini-3.1-pro-previewMain Model:[次]gemini-3.1-pro-preview
3. OpenCode 配置
3. OpenCode Configuration
打开 cc switch 并选择 OpenCode
Open cc switch and select OpenCode
在 cc switch 中选择 OpenCode 插件。 Select OpenCode plugin in cc switch.
点击右上角加号添加配置
Click Plus to Add Configuration
- 供应商标识:claude Provider ID: claude
- 供应商名称:随意填写 Provider Name: Any name
- API Key:站点令牌秘钥 API Key: Site token
- 请求地址:
https://nameyn.shopRequest URL:https://nameyn.shop - 主模型:
claude-opus-4-6Main Model:claude-opus-4-6 - 显示名称:
claude-opus-4-6Display Name:claude-opus-4-6
4. OpenClaw 配置
4. OpenClaw Configuration
选择 OpenClaw 界面
Select OpenClaw Interface
在 cc switch 中选择 OpenClaw 插件界面。 Select OpenClaw plugin interface in cc switch.
点击右上角加号添加配置
Click Plus to Add Configuration
- 供应商标识:claude Provider ID: claude
- 供应商名称:Nameyn Provider Name: Nameyn
- API 协议:anthropic messages API Protocol: anthropic messages
- API Key:站点令牌秘钥 API Key: Site token
- API 端点:
https://nameyn.shopAPI Endpoint:https://nameyn.shop - 模型 ID:
claude-opus-4-6Model ID:claude-opus-4-6 - 模型名称:
claude-opus-4-6Model Name:claude-opus-4-6
Gemini CLI 配置指南
Gemini CLI Setup
🎬 Gemini CLI 配置教程
安装步骤
Installation Steps
1. 安装 Node.js
1. Install Node.js
访问 Node.js 官网,建议下载左侧的 LTS 版本,它是长期支持版,更加稳定。 Visit Node.js official website, download the LTS version on the left for better stability.
2. 安装 Git
2. Install Git
访问 Git 官网,页面会自动推荐适合你操作系统的版本,点击按钮即可下载。 Visit Git official website, the page will automatically recommend the version for your OS.
3. 安装 Gemini CLI
3. Install Gemini CLI
打开 cmd 命令行,通过 npm 安装 gemini-cli: Open cmd and install gemini-cli via npm:
npm install -g @google/gemini-cli
配置步骤
Configuration Steps
配置 (.env)
Configure (.env)
创建配置文件 (Windows: %USERPROFILE%\.gemini\.env, Mac/Linux: ~/.gemini/.env)
Create config file at ~/.gemini/.env
GOOGLE_GEMINI_BASE_URL=https://nameyn.shop
GEMINI_API_KEY=sk-xxxxxxxx
GEMINI_MODEL=gemini-2.5-pro
启动
Start
gemini
CodeX CLI 配置指南
CodeX CLI Setup
添加 agents.defaults(关键步骤)
Add agents.defaults (Key Step)
还需要告知 OpenClaw 优先使用该节点: Tell OpenClaw to use this provider by default:
"agents": {
"defaults": {
"model": {
"primary": "claude/claude-opus-4-6"
},
"models": {
"claude/claude-opus-4-6": {
"alias": "claude-opus-4-6"
}
}
}
}
4. 启动
4. Start
codex
Codex CC 配置指南
Codex CC Setup
示例调用参数
Example Call Parameters
1. 获取 API Key
1. Get API Key
进入站点控制台 → 令牌管理 → 复制令牌秘钥。 Go to Site Console → Token Management → Copy Token Key.
2. 填写请求地址
2. Enter Request URL
将请求地址设置为 Nameyn 的 API 接入点: Set the request URL to Nameyn's API endpoint:
3. 选择模型
3. Select Model
模型名称填写: Enter model name:
配置截图
Configuration Screenshots
VS Code (Cline)
🎬 Cline 配置教程
配置步骤
Configuration
- 安装 Cline 插件。
- API Provider: OpenAI Compatible
- Base URL:
https://nameyn.shop/v1 - API Key: 填入您的令牌
- Model ID:
[次]gemini-2.5-pro
OpenClaw 配置指南
OpenClaw Setup
Website https://openclaw.ai/(官网单击跳转!) GitHub openclaw/openclaw(GitHub 仓库)🎬 OpenClaw 配置教程
配置文件下载
Configuration File Download
openclaw.json(点击下载完整配置文件 - Windows版) openclaw.json(点击下载完整配置文件 - Mac版)阿里云配置教程
Alibaba Cloud Configuration
配置 JSON 文件
Configure JSON File
使用以下 JSON 配置模板,替换教程中的文本为下方文本,并替换自己的密钥: Use the following JSON configuration template, replace the tutorial text with the content below, and replace with your own API key:
"models": {
"providers": {
"claude": {
"baseUrl": "https://nameyn.shop",
"apiKey": "sk-xxxxxxx秘钥",
"api": "anthropic-messages",
"models": [
{
"id": "claude-opus-4-6",
"name": "claude-opus-4-6",
"reasoning": false,
"input": ["text"],
"cost": {
"input": 0,
"output": 0,
"cacheRead": 0,
"cacheWrite": 0
},
"contextWindow": 200000,
"maxTokens": 8192
}
]
}
}
},
"agents": {
"defaults": {
"model": {
"primary": "claude/claude-opus-4-6"
},
"models": {
"claude/claude-opus-4-6": {
"alias": "claude-opus-4-6"
}
}
}
}
- 将
sk-xxxxxxx秘钥替换为您从 Nameyn 网站获取的实际令牌 Replacesk-xxxxxxx秘钥with your actual token from Nameyn - baseUrl 使用
https://nameyn.shopUsehttps://nameyn.shopas baseUrl - api 协议选择
anthropic-messagesUseanthropic-messagesas API protocol - 模型使用
claude-opus-4-6Useclaude-opus-4-6model
腾讯云配置教程
Tencent Cloud Configuration
在自定义服务器里面选择自定义模型配置
Select Custom Model Configuration in Custom Server
打开 OpenClaw,进入自定义服务器设置,选择自定义模型配置选项。 Open OpenClaw, go to custom server settings, and select custom model configuration.
配置自定义 JSON 文件
Configure Custom JSON File
使用以下 JSON 配置模板: Use the following JSON configuration template:
{
"provider": "openai",
"base_url": "https://nameyn.shop",
"api": "anthropic-messages",
"api_key": "sk-xxxxxxxxx",
"model": {
"id": "claude-opus-4-6",
"name": "claude-opus-4-6"
}
}
通用配置模板
Universal Configuration Template
如果需要其他模型,可以使用以下通用模板接入任何兼容 OpenAI/Anthropic (openai-completions/anthropic-messages) 协议的模型: For other models, use this universal template to connect any OpenAI/Anthropic compatible model:
{
"provider": "openai",
"base_url": "https://nameyn.shop",
"api": "anthropic-messages",
"api_key": "sk-xxxxxxxxx",
"model": {
"id": "claude-opus-4-6",
"name": "claude-opus-4-6"
}
}
- provider: 提供商名称(可自定义) provider: Provider name (customizable)
- base_url: API 接入点 base_url: API endpoint
- api: API 协议类型(openai-completions 或 anthropic-messages) api: API protocol type (openai-completions or anthropic-messages)
- api_key: 您的 Nameyn 令牌 api_key: Your Nameyn token
- model.id: 模型标识符 model.id: Model identifier
- model.name: 模型显示名称 model.name: Model display name
一、本地部署
1. Local Deployment
安装 Node.js
Install Node.js
访问 nodejs.org 下载 LTS 长期支持版(稳定性强,适合开发/生产环境)。页面会自动识别你的系统,直接点下载按钮就行。 Visit nodejs.org to download LTS version.
安装 Git
Install Git
访问 git-scm.com 下载安装。Windows 建议选 64 位版本,安装时默认选项基本够用。 Visit git-scm.com to download and install.
验证安装
Verify Installation
安装完成后,打开命令行(Windows 用 CMD/PowerShell,Mac/Linux 用终端),分别输入以下命令,能显示版本号就是安装成功: After installation, open terminal and run these commands to verify:
node -v
npm -v
安装 OpenClaw
Install OpenClaw
npm i -g openclaw
二、核心配置流程
2. Core Configuration
定位配置文件
Locate Config File
OpenClaw 的配置在 openclaw.json 中。请根据您的操作系统找到它:
OpenClaw config is in openclaw.json. Find it based on your OS:
| 操作系统 | 默认路径 |
|---|---|
| Windows | C:\Users\<Your_Username>\.openclaw\openclaw.json |
| macOS / Linux | ~/.openclaw/openclaw.json |
添加自定义 Provider(关键步骤)
Add Custom Provider (Key Step)
在配置文件中,将以下 JSON 代码片段加入到 models.providers 块中。根据您的需求选择配置:
Add the following JSON to models.providers block. Choose based on your needs:
"models": {
"providers": {
"claude": {
"baseUrl": "https://nameyn.shop",
"apiKey": "sk-xxxxxx你的网站获取的秘钥",
"api": "anthropic-messages",
"models": [
{
"id": "claude-opus-4-6",
"name": "claude-opus-4-6",
"reasoning": false,
"input": ["text"],
"cost": {
"input": 0,
"output": 0,
"cacheRead": 0,
"cacheWrite": 0
},
"contextWindow": 200000,
"maxTokens": 8192
}
]
}
}
}
添加 agents.defaults(关键步骤)
Add agents.defaults (Key Step)
还需要告知 OpenClaw 优先使用该节点。根据上面选择的 Provider 配置对应的 defaults: Tell OpenClaw to use this provider by default. Configure based on your chosen provider:
"agents": {
"defaults": {
"model": {
"primary": "claude/claude-opus-4-6"
},
"models": {
"claude/claude-opus-4-6": {
"alias": "claude-opus-4-6"
}
}
}
}
配置文件下载
Configuration File Download
在配置文件中,将以下 JSON 代码片段加入到 models.providers 块中:
Add the following JSON to models.providers block:
三、启动服务
3. Start Service
启动网关服务
Start Gateway Service
openclaw gateway
打开链接
Open Link
还需要告知 OpenClaw 优先使用该节点: Tell OpenClaw to use this provider by default:
OpenCode 配置指南
OpenCode Setup
Website https://opencode.ai(单击跳转!)🎬 OpenCode 配置教程
配置步骤
Configuration Steps
创建配置文件
Create Config File
在项目根目录创建 opencode.json 配置文件:
Create opencode.json config file in project root:
{
"$schema": "https://opencode.ai/config.json",
"theme": "opencode",
"provider": {
"google": {
"options": {
"apiKey": "YOUR_API_KEY_HERE",
"baseURL": "https://nameyn.shop/v1"
}
}
},
"model": "google/gemini-3-pro-preview",
"autoupdate": true
}
配置说明
Configuration Details
- apiKey:将
YOUR_API_KEY_HERE替换为您的 Nameyn 令牌 apiKey: ReplaceYOUR_API_KEY_HEREwith your Nameyn token - baseURL:API 接入点
https://nameyn.shop/v1baseURL: API endpointhttps://nameyn.shop/v1 - model:使用
google/gemini-3-pro-preview模型 model: Usegoogle/gemini-3-pro-previewmodel
Copaw 配置指南
Copaw Setup
Website https://copaw.agentscope.io/docs/quickstart(配置安装教程)配置步骤
Configuration Steps
1. 选择模型添加供应商
1. Select Model and Add Provider
在 Copaw 中选择模型,然后添加供应商配置。 Select a model in Copaw and add provider configuration.
2. 新建并添加模型
2. Create and Add Model
创建新的模型配置,填写从 Nameyn 网站模型广场复制的模型名称(按量模型)。 Create new model configuration and enter the model name copied from Nameyn model marketplace (pay-per-use model).
3. 配置 API 信息
3. Configure API Information
- API 地址:
https://nameyn.shop/v1API URL:https://nameyn.shop/v1 - API Key: 填入您的 Nameyn 令牌 API Key: Enter your Nameyn token
- 模型名称: 从模型广场复制的按量模型名称 Model Name: Pay-per-use model name from marketplace
4. 保存设置
4. Save Settings
保存配置后即可开始使用 Copaw 进行聊天。 After saving the configuration, you can start chatting with Copaw.
Dify
配置步骤
Configuration
- 设置 -> 模型供应商 -> OpenAI-API-compatible
- URL:
https://nameyn.shop/v1 - API Key: 填入您的令牌
- Model:
[次]gemini-2.5-pro
n8n
🎬 n8n 配置教程
配置步骤
Configuration
- 添加 OpenAI 模块 -> Message a model
- Credential: Create New -> Custom
- URL:
https://nameyn.shop/v1 - API Key: 填入您的令牌
- Model:
[次]gemini-2.5-pro
Easydict (macOS)
配置步骤
Configuration
- 服务: OpenAI 翻译
- API Key: 填入您的令牌
- 完整地址 (Full URL):
https://nameyn.shop/v1/chat/completions - Model:
[次]gemini-2.5-pro
Python SDK
🎬 Python SDK 配置教程
from openai import OpenAI
# 初始化客户端
client = OpenAI(
api_key="sk-xxxxxxxx", # 填入您的令牌
base_url="https://nameyn.shop/v1" # API 接入点
)
# 发送请求
response = client.chat.completions.create(
model="[次]gemini-2.5-pro",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello!"}
],
stream=False
)
print(response.choices[0].message.content)
🎬 Python 分析视频教程
import cv2
import base64
import requests
import os
import math
class VideoAnalyzer:
def __init__(self, video_path):
self.video_path = video_path
if not os.path.exists(video_path):
raise FileNotFoundError(f"❌ 找不到视频文件: {video_path}")
def get_metadata(self):
"""1. 获取视频基础技术参数"""
cap = cv2.VideoCapture(self.video_path)
if not cap.isOpened():
return None
fps = cap.get(cv2.CAP_PROP_FPS)
frame_count = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))
width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
duration = frame_count / fps if fps > 0 else 0
cap.release()
return {
"width": width,
"height": height,
"fps": round(fps, 2),
"frame_count": frame_count,
"duration_sec": round(duration, 2),
"file_size_mb": round(os.path.getsize(self.video_path) / (1024 * 1024), 2)
}
def extract_keyframes(self, max_frames=5, target_width=512):
"""2. 抽取关键帧用于AI分析"""
print("📸 正在抽取关键帧...")
cap = cv2.VideoCapture(self.video_path)
total_frames = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))
if total_frames == 0:
return []
interval = max(1, total_frames // max_frames)
base64_frames = []
for i in range(0, total_frames, interval):
if len(base64_frames) >= max_frames:
break
cap.set(cv2.CAP_PROP_POS_FRAMES, i)
ret, frame = cap.read()
if ret:
h, w, _ = frame.shape
aspect_ratio = h / w
new_height = int(target_width * aspect_ratio)
resized_frame = cv2.resize(frame, (target_width, new_height))
_, buffer = cv2.imencode('.jpg', resized_frame)
base64_str = base64.b64encode(buffer).decode('utf-8')
base64_frames.append(base64_str)
cap.release()
print(f"✅ 成功抽取 {len(base64_frames)} 帧关键画面")
return base64_frames
def analyze_content_with_ai(self, api_key, base64_frames):
"""3. 调用视觉大模型解析视频内容"""
print("🧠 正在请求 AI 分析视频内容...")
url = "https://nameyn.shop/v1/chat/completions"
content_payload = [
{"type": "text", "text": "这是同一个视频中按时间顺序抽取的几帧画面。请详细描述这个视频里发生了什么?包括场景、人物动作、氛围和主要事件。"}
]
for b64 in base64_frames:
content_payload.append({
"type": "image_url",
"image_url": {
"url": f"data:image/jpeg;base64,{b64}",
"detail": "low"
}
})
payload = {
"model": "[次]gemini-3-pro-preview",
"messages": [{"role": "user", "content": content_payload}],
"max_tokens": 1000,
"stream": True
}
try:
response = requests.post(url, headers={"Authorization": f"Bearer {api_key}"}, json=payload, stream=True)
print("\n📝 视频分析报告:\n" + "="*30)
full_analysis = ""
for line in response.iter_lines():
if line:
decoded = line.decode('utf-8')
if decoded.startswith('data: ') and decoded != 'data: [DONE]':
try:
chunk = decoded[6:]
import json
delta = json.loads(chunk)['choices'][0]['delta'].get('content', '')
print(delta, end='', flush=True)
full_analysis += delta
except:
pass
print("\n" + "="*30)
return full_analysis
except Exception as e:
print(f"❌ 分析失败: {e}")
return None
# 使用示例
if __name__ == "__main__":
video_file = r"你的视频文件路径.mp4" # 替换为你的视频文件路径
my_api_key = "sk-xxxxxxxx" # 替换为你的API Key
if not os.path.exists(video_file):
print(f"⚠️ 未找到 {video_file},请先准备一个视频文件。")
else:
analyzer = VideoAnalyzer(video_file)
meta = analyzer.get_metadata()
print(f"\n📊 视频元数据: {meta}")
frames = analyzer.extract_keyframes(max_frames=5)
if frames:
analyzer.analyze_content_with_ai(my_api_key, frames)
🎬 Python 分析图片教程
import requests, json, base64
API_URL = "https://nameyn.shop/v1/chat/completions"
API_KEY = "Bearer sk-xxxxxxxx" # 替换为你的API Key
def analyze_image(img_path):
"""分析图片"""
with open(img_path, "rb") as f:
img_base64 = base64.b64encode(f.read()).decode()
payload = {
"model": "[次]gemini-3-pro-preview", # 模型名称
"messages": [{
"role": "user",
"content": [
{"type": "text", "text": "请描述这张图片"},
{
"type": "image_url",
"image_url": {"url": f"data:image/jpeg;base64,{img_base64}"}
}
]
}],
"stream": True
}
headers = {
"Content-Type": "application/json",
"Authorization": API_KEY
}
response = requests.post(API_URL, json=payload, headers=headers, stream=True)
for line in response.iter_lines():
if line:
line = line.decode('utf-8').replace('data: ', '')
if line.strip() == '[DONE]': break
try:
data = json.loads(line)
if content := data['choices'][0]['delta'].get('content'):
print(content, end="", flush=True)
except:
continue
print()
# 使用示例
analyze_image(r"你的图片路径.jpg") # 替换为实际图片路径
🎬 Python 视频生成教程
import requests
import time
import json
import os
def generate_video_stream_with_retry(prompt, api_key, max_retries=3):
"""带重试机制的流式视频生成指令获取函数"""
base_url = "https://nameyn.shop/v1/chat/completions"
headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
}
payload = {
"model": "veo_3_1",
"messages": [
{
"role": "user",
"content": f"请帮我生成一个视频,描述是:{prompt}。请告诉我视频生成的步骤或直接提供视频链接。"
}
],
"max_tokens": 5000,
"temperature": 0.7,
"stream": True
}
for attempt in range(max_retries):
print(f"\n🔄 尝试 {attempt + 1}/{max_retries}...")
full_content = ""
try:
response = requests.post(base_url, headers=headers, json=payload, timeout=120, stream=True)
if response.status_code != 200:
print(f"❌ 请求失败,状态码: {response.status_code}")
if 500 <= response.status_code < 600:
print("⏳ 服务器端错误,等待后重试...")
time.sleep(5)
continue
else:
return None
print("✅ 连接成功,开始接收数据流...\n")
print("-" * 30)
for line in response.iter_lines():
if line:
decoded_line = line.decode('utf-8')
if decoded_line.startswith('data: '):
data_str = decoded_line[6:]
if data_str.strip() == '[DONE]':
print("\n" + "-" * 30)
print("\n✅ 流式传输结束")
break
try:
data_json = json.loads(data_str)
delta = data_json['choices'][0]['delta'].get('content', '')
if delta:
print(delta, end='', flush=True)
full_content += delta
except json.JSONDecodeError:
continue
if full_content:
with open("ai_response.txt", "w", encoding="utf-8") as f:
f.write(full_content)
print(f"📝 完整回复已保存到 ai_response.txt")
return full_content
else:
print("⚠️ 未接收到任何内容")
return None
except requests.exceptions.Timeout:
print("⏰ 连接超时")
time.sleep(5)
continue
except Exception as e:
print(f"❌ 未知错误: {e}")
return None
print(f"😞 经过 {max_retries} 次尝试后仍然失败")
return None
# 使用示例
if __name__ == "__main__":
my_api_key = "sk-xxxxxxxx" # 替换为你的API Key
result = generate_video_stream_with_retry(
prompt="在海上冲浪的狗",
api_key=my_api_key,
max_retries=5
)
if result:
print("\n🎬 任务完成")
else:
print("\n❌ 任务失败")
🎬 Python 图片生成教程
import requests
import json
import os
import re
from datetime import datetime
from pathlib import Path
from typing import Optional, Dict, Any, List
from urllib.parse import urlparse
class ImageGenerator:
def __init__(self):
self.api_key = "sk-xxxxxxxx" # 替换为你的API密钥
self.api_url = "https://nameyn.shop/v1/chat/completions"
self.model = "nano-banana"
self.headers = {
"Authorization": f"Bearer {self.api_key}",
"Content-Type": "application/json"
}
def generate_image(self, prompt: str, save_dir: str = "./generated_images") -> Dict[str, Any]:
"""生成图像并返回图片链接"""
Path(save_dir).mkdir(parents=True, exist_ok=True)
payload = {
"model": self.model,
"messages": [{"role": "user", "content": f"Generate an image based on this prompt: {prompt}"}],
"max_tokens": 1000
}
print(f"正在生成图像...")
print(f"提示词: {prompt}")
try:
response = requests.post(self.api_url, headers=self.headers, json=payload, timeout=600)
if response.status_code == 200:
return self._process_response(response, prompt, save_dir)
else:
print(f"API请求失败: {response.status_code}")
return {"success": False, "error": f"HTTP {response.status_code}", "image_links": []}
except requests.exceptions.RequestException as e:
print(f"请求异常: {e}")
return {"success": False, "error": str(e), "image_links": []}
def _process_response(self, response, prompt, save_dir):
result = {"success": False, "image_links": [], "content": "", "error": None}
try:
response_data = response.json()
if "choices" in response_data and response_data["choices"]:
content = response_data["choices"][0]["message"]["content"]
result["content"] = content
print(f"API响应内容: {content}")
# 提取图片链接
url_patterns = [
r'https?://[^\s]+?\.(?:jpg|jpeg|png|gif|bmp|webp)',
r'https?://[^\s]+?/image/[^\s]+',
]
found_links = []
for pattern in url_patterns:
matches = re.findall(pattern, content, re.IGNORECASE)
found_links.extend(matches)
if found_links:
result["success"] = True
result["image_links"] = found_links
print(f"找到图片链接: {found_links}")
else:
result["success"] = True
result["note"] = "API返回的是文本描述,未找到图片链接"
except Exception as e:
result["error"] = f"处理响应失败: {e}"
return result
def main():
print("🎨 图像生成脚本")
print("-" * 50)
generator = ImageGenerator()
prompt = "一只可爱的小狗在花园里玩耍" # 修改这里的prompt内容
result = generator.generate_image(prompt=prompt, save_dir="./test_images")
print("\n" + "=" * 50)
if result.get("success", False):
print("✅ 请求成功!")
if result.get("image_links"):
print(f"\n📷 找到 {len(result['image_links'])} 个图片链接:")
for i, link in enumerate(result["image_links"], 1):
print(f" {i}. {link}")
else:
print(f"❌ 生成失败: {result.get('error', '未知错误')}")
if __name__ == "__main__":
main()
Cursor
Website https://cursor.com/(单击跳转下载!)🎬 Cursor 配置教程
配置指南
Configuration Guide
打开设置
Open Settings
点击右上角的齿轮图标 ⚙️,选择 Models 选项 Click the gear icon ⚙️ in the top right corner, select Models
配置 API
Configure API
- OpenAI API Key:输入您的 API 密钥(直接用默认令牌即可) OpenAI API Key: Enter your API key (use default token)
- Override OpenAI Base URL:勾选并输入
https://nameyn.shop/v1Override OpenAI Base URL: Check and enterhttps://nameyn.shop/v1 - 点击 Verify 验证配置 Click Verify to validate configuration
- 输入模型名称:
gemini-2.5-proEnter model name:gemini-2.5-pro
Cursor 配置 Cline 插件教程
Cursor Cline Plugin Setup
Website https://cursor.com(单击跳转下载!)配置步骤
Configuration Steps
- 点击扩展按钮搜索 cline 插件 Click extensions and search for cline plugin
- 配置 URL:
https://nameyn.shop/v1Configure URL:https://nameyn.shop/v1 - 密钥:nova 网站令牌管理下面密钥复制 API Key: Copy from Nova token management
- 模型名称:
[次]gemini-3.1-pro-preview-thinkingModel:[次]gemini-3.1-pro-preview-thinking
Trae 配置 Cline 插件教程
Trae Cline Plugin Setup
Website https://www.trae.ai(单击跳转下载!)配置步骤
Configuration Steps
- 点击扩展按钮搜索 cline 插件 Click extensions and search for cline plugin
- 配置 URL:
https://nameyn.shop/v1Configure URL:https://nameyn.shop/v1 - 密钥:nova 网站令牌管理下面密钥复制 API Key: Copy from Nova token management
- 模型名称:
[次]gemini-3.1-pro-preview-thinkingModel:[次]gemini-3.1-pro-preview-thinking
Trae 配置教程
Trae Setup
Website https://www.trae.ai(单击跳转下载!)1. 打开 Trae 后点击设置
1. Open Trae and Click Settings
2. 点击"模型"
2. Click "Models"
3. 点击"添加模型"
3. Click "Add Model"
4. 填入 API 信息
4. Fill in API Info
- 供应商:OpenAIProvider: OpenAI
- 模型:自定义模型Model: Custom Model
- 模型 ID:
gemini-3.1-pro-preview(可从模型广场挑选)Model ID:gemini-3.1-pro-preview(pick from marketplace) - API 秘钥:sk-秘钥(在令牌管理界面获取)API Key: sk-key from Token Management
- 自定义请求地址:
https://nameyn.shop/v1/chat/completionsCustom URL:https://nameyn.shop/v1/chat/completions
5. 确认保存并开启"自定义"
5. Save and Enable "Custom"
点击确认保存后打开"自定义",然后开启刚刚配置的模型。 Click confirm to save, then enable the configured model under "Custom".
6. 点击"AI 侧边栏"
6. Click "AI Sidebar"
7. 切换至配置好的模型
7. Switch to Configured Model
点击模型列表,切换到刚刚配置好的模型。 Click model list and switch to the configured model.
8. 配置完成,开始使用
8. Configuration Complete
Roo Code 配置教程
Roo Code Setup
1. 安装完 Roo Code 后点击 "use without an account"
1. After Install, Click "Use Without an Account"
2. 选择第三方供应商
2. Select Third-Party Provider
3. 填入 Nameyn 配置信息
3. Fill in Nameyn Configuration
- API 供应商:OpenAI CompletionsAPI Provider: OpenAI Completions
- OpenAI 基础 URL:
https://nameyn.shop/v1OpenAI Base URL:https://nameyn.shop/v1 - API 秘钥:sk-站点令牌秘钥API Key: sk-your token
- 模型输入完之后即可获取并选择使用Models can be fetched and selected after input
4. 配置完成即可使用
4. Ready to Use After Configuration
QwenPaw 配置教程
QwenPaw Setup
1. 进入 QwenPaw 页面后点击 Model 选项
1. Open QwenPaw and Click Model
点击 model 选项进入供应商配置界面。 Click "model" to enter provider configuration.
2. 点击 Add Provider 添加供应商
2. Click Add Provider
3. 填入 API 信息
3. Fill in API Info
- Provider ID:openai
- Display Name:Nameyn
- Default Base URL:
https://nameyn.shop/v1 - Protocol:OpenAI-completions (Chat Completions)
填入信息后点击 create 按钮。 Click "create" after filling in the info.
4. 搜索并配置 Nameyn
4. Search and Configure Nameyn
添加完成后在搜索框搜索 Nameyn,点击 Models 按钮添加模型。 After adding, search "Nameyn" and click Models to add models.
5. 添加模型
5. Add Model
点击 Add Model,输入 Model ID 和 Model Name(要与模型广场一致),例如 qwen-3.5-plus、[次]gemini-3.1-pro-preview 等。
Click Add Model, enter Model ID and Name (must match model marketplace), e.g., qwen-3.5-plus, [次]gemini-3.1-pro-preview.
6. 测试模型
6. Test Model
添加之后可以点击测试按钮测试模型可用性,还可以测试多模态。 Click the test button to verify availability, including multimodal capability.
7. 回到对话页面使用
7. Use in Chat
测试成功后点击 chat 按钮回到对话页面,在对话界面右上角选择 Nameyn 供应商和模型即可。 After testing, click chat to return. Select Nameyn provider and model in the top right.
WorkBuddy 配置教程
WorkBuddy Setup
1. 点击模型选择
1. Click Model Selection
2. 配置自定义模型
2. Configure Custom Model
3. 选择自定义供应商
3. Select Custom Provider
点击供应商类别,把供应商换成自定义供应商。 Click provider category and switch to custom provider.
4. 配置 API 信息
4. Configure API Info
- API key:令牌管理界面的令牌秘钥API Key: From Token Management
- 接口地址:
https://nameyn.shop/v1/chat/completions - 模型名称:
qwen-3.5-plus - 输入:1000000,输出:64kInput: 1000000, Output: 64k
5. 保存并重启软件
5. Save and Restart
保存之后重启软件,然后在模型选择中选取自定义模型。 Save and restart the software, then select your custom model.
6. 配置完后即可使用
6. Ready to Use
Claude Code 配置 GPT 模型 (CC Switch)
Claude Code Configuring GPT Model (CC Switch)
配置步骤
Configuration Steps
1. 在 CC Switch 中配置
1. Configure in CC Switch
打开 CC Switch,要把 API 格式换成 OpenAI Chat Completions。 Open CC Switch and switch API Format to OpenAI Chat Completions.
- API 格式:OpenAI Chat Completions
- 请求地址:
https://nameyn.shop/v1 - API Key:站点令牌秘钥
- 模型:例如
gpt-5.4等 GPT 系列模型
2. 调用案例
2. Usage Example
配置完成后,即可在 Claude Code 中正常调用 GPT/OpenAI 模型。 After configuration, you can call GPT/OpenAI models directly in Claude Code.
Hermes Agent 配置指南
Hermes Agent Setup
.env 配置文件即可接入 Nameyn 服务。
Hermes Agent is an AI agent tool that can connect to Nameyn services by modifying the .env configuration file.
配置步骤
Configuration Steps
更改 hermes-agent 文件夹下的 .env 文件:
Modify the .env file in the hermes-agent folder:
1. 找到 LLM PROVIDER (OpenRouter) 部分
1. Find LLM PROVIDER (OpenRouter) Section
在 .env 文件中搜索找到 LLM PROVIDER (OpenRouter) 部分。
Search for the LLM PROVIDER (OpenRouter) section in the .env file.
2. 更改 OPENROUTER_BASE_URL 路径并添加 API Key
2. Change OPENROUTER_BASE_URL and Add API Key
将 OPENROUTER_BASE_URL 改为以下地址,并且把前面的 # 号删掉(取消注释):
Change OPENROUTER_BASE_URL to the following URL and remove the # prefix (uncomment):
OPENROUTER_BASE_URL=https://nameyn.shop
然后在 OPENROUTER_BASE_URL 下方添加一条新指令:
Then add a new line below OPENROUTER_BASE_URL:
OPENROUTER_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxx
将 sk-xxxxxxxxxxxxxxxxxxxxxxx 替换为您从 Nameyn 网站获取的实际令牌秘钥。
Replace sk-xxxxxxxxxxxxxxxxxxxxxxx with your actual token from Nameyn.
3. 更改 LLM_MODEL
3. Change LLM_MODEL
找到 LLM_MODEL 配置项,把前面的 # 号删掉(取消注释),并将值改为:
Find the LLM_MODEL configuration, remove the # prefix (uncomment), and change the value to:
LLM_MODEL=anthropic/claude-opus-4.6
完整配置示例
Complete Configuration Example
# LLM PROVIDER (OpenRouter)
OPENROUTER_BASE_URL=https://nameyn.shop
OPENROUTER_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxx
LLM_MODEL=anthropic/claude-opus-4.6
anthropic/claude-opus-4.6 是模型名称。不同厂商的模型有统一的前缀命名规则:
anthropic/claude-opus-4.6 is the model name. Different providers follow a unified prefix naming convention:
- Claude 系列:使用
anthropic/开头,例如anthropic/claude-opus-4.6Claude models: Useanthropic/prefix, e.g.,anthropic/claude-opus-4.6 - Gemini 系列:使用
google/开头,例如google/gemini-2.5-proGemini models: Usegoogle/prefix, e.g.,google/gemini-2.5-pro - GPT 系列:使用
openai/开头,例如openai/gpt-4oGPT models: Useopenai/prefix, e.g.,openai/gpt-4o
AstrBot 配置指南
AstrBot Setup
配置步骤
Configuration Steps
1. 首次登录后点击配置 API
1. Click Configure API After First Login
首次登录 AstrBot 之后,点击配置 API按钮。 After first login to AstrBot, click the Configure API button.
2. 点击新增按钮
2. Click Add Button
点击新增按钮来添加新的 API 配置。 Click the Add button to create a new API configuration.
3. 选择 OpenAI Compatible
3. Select OpenAI Compatible
在 API 类型中选择 OpenAI Compatible。 Select OpenAI Compatible as the API type.
4. 填入配置信息并保存
4. Fill in Configuration and Save
填入 ID、API Key、API Base URL 后点击保存配置,然后点击获取模型。 Enter ID, API Key, API Base URL, then click Save Configuration and Get Models.
- API Key:填入您的 Nameyn 令牌秘钥 API Key: Enter your Nameyn token
- API Base URL:
https://nameyn.shop/v1API Base URL:https://nameyn.shop/v1
5. 获取模型列表
5. Get Model List
保存配置后可以看到获取到站点所有的模型。 After saving, you can see all available models from the site.
6. 搜索并选择模型
6. Search and Select Model
可以通过搜索栏搜索模型,例如选用按次计费的 gemini-3.1-pro-preview。
You can search for models via the search bar, e.g., select pay-per-use gemini-3.1-pro-preview.
7. 选用 Chat 模式
7. Select Chat Mode
选用 Chat 聊天模式。 Select Chat mode.
8. 选择配置好的模型
8. Select Configured Model
点击 Model 按钮,选用刚刚配置好的模型。 Click the Model button and select the model you just configured.
9. 开始使用
9. Start Using
配置完成后,就可以通过对话来使用模型了。 After configuration, you can start using the model through conversations.
10. 开始对话
10. Start Chatting
配置完成后,就可以通过对话来使用模型了。 After configuration, you can start using the model through conversations.
Kelivo
1. 打开设置
1. Open Settings
打开 Kelivo 后,点击左下角的设置按钮。 After opening Kelivo, click the Settings button in the bottom left corner.
2. 选择供应商并填写 API 信息
2. Select Provider and Fill in API Info
选用 OpenAI 供应商,然后填入相应 API 信息: Select OpenAI provider, then fill in the API information:
3. 完成配置
3. Complete Configuration
配置后即可正常使用 Kelivo。 After configuration, you can use Kelivo normally.
OpenCowork 配置教程
OpenCowork Setup
配置步骤
Configuration Steps
1. 点击设置按钮
1. Click Settings Button
在 OpenCowork 界面点击设置按钮(左下角齿轮)。 Click the settings button (gear icon in the bottom left) on the OpenCowork interface.
2. 进入 API 设置
2. Enter API Settings
进入设置页面之后选择 API 设置。 After entering the settings page, select API Settings.
3. 配置 API 信息
3. Configure API Info
进入 API 设置界面之后填写以下信息: After entering the API settings interface, fill in the following information:
- API 供应商:选择"更多模型" API Provider: Select "More Models"
- API 秘钥:站点令牌秘钥
sk-xxxx(在站点令牌管理界面获取) API Key: Site tokensk-xxxx(from Token Management) - 协议:OpenAI Protocol: OpenAI
- 基础 URL:
https://nameyn.shop/v1Base URL:https://nameyn.shop/v1 - 模型:
[次]gemini-3.1-pro-previewModel:[次]gemini-3.1-pro-preview
填完信息后点击保存设置。 After filling in the information, click Save Settings.
4. 返回对话页面使用
4. Return to Chat and Use
设置完后返回对话页面即可正常使用。 After setting up, return to the chat page to start using.
Zotero 翻译文献教程
Zotero Translation Tutorial
下载 https://www.zotero.org/download/(Zotero 官方下载,单击跳转!) 插件 Zotero 插件商店 | Zotero 中文社区(Awesome GPT 插件,单击跳转!)配置步骤
Configuration Steps
1. 安装 Zotero 与 Awesome GPT 插件
1. Install Zotero and Awesome GPT Plugin
访问 Zotero 官网 下载并安装 Zotero,然后在 Zotero 中文社区插件商店 中下载 Awesome GPT 插件并安装。 Download and install Zotero, then install the Awesome GPT plugin from the Zotero Chinese community plugin store.
2. 配置 Awesome GPT 插件
2. Configure Awesome GPT Plugin
- 配置 URL:
https://nameyn.shopConfig URL:https://nameyn.shop - 密钥:从 Nova 网站令牌管理下方复制 sk- 开头的密钥 API Key: Copy sk- key from Nova Token Management
- 模型名称:
[次]gemini-3.1-pro-preview-thinkingModel:[次]gemini-3.1-pro-preview-thinking
Chatbox
Website https://chatboxai.app(单击跳转!)🎬 Chatbox 电脑端配置教程
🎬 Chatbox 手机端配置教程
配置步骤
Configuration
- 设置 -> 模型提供方 -> 手动添加配置 (Custom)
- API 模式:OpenAI API 兼容
- API Host:
https://nameyn.shop/v1 - API Key: 填入您的令牌
- 模型 (Model):
[次]gemini-2.5-pro - 注意:勾选所有模型能力,开启"改善网络兼容性"。
Cherry Studio
Download https://www.cherry-ai.com/download(单击跳转下载!)🎬 Cherry Studio 配置教程
配置步骤
Configuration
- 访问 Cherry Studio 官网 下载并安装客户端 Visit Cherry Studio official website to download and install
- 打开 Cherry Studio 后选择其他供应商 After opening Cherry Studio, select Other Provider
- 点击下方添加按钮,新建供应商配置 Click Add button to create a new provider
- 填入供应商名称(如:Nameyn)和类型后点击确定 Fill in Provider Name (e.g., Nameyn) and Type, click OK
- API 地址:
https://nameyn.shopAPI URL:https://nameyn.shop - API Key: 填入您的令牌 API Key: Enter your token
- 点击获取模型列表获得所有可用模型 Click Get Model List to get all available models
- 点击确定后选用默认模型、快速模型和翻译模型 Click OK then select Default Model, Quick Model, and Translation Model
- 注意:Cherry Studio 不需要在末尾加
/v1。 Note: Cherry Studio does not need/v1at the end.
Cherry Studio 绘图配置教程
Cherry Studio Image Generation Setup
配置步骤
Configuration Steps
1. 点击左上角加号
1. Click the Plus Icon in Top Left
2. 选择绘画
2. Select Drawing
3. 供应商选择 New API
3. Select New API as Provider
4. 点击设置按钮配置模型
4. Click Settings to Configure Model
5. 配置 API 秘钥 + API 地址,获取模型
5. Configure API Key + URL, Get Models
填入 API 秘钥和 API 地址后,点击获取模型,然后搜索 gpt-image-2。
Enter API Key and URL, click Get Models, then search for gpt-image-2.
6. 点击模型旁边的小齿轮设置按钮
6. Click the Gear Icon Next to Model
7. 终点类型换成"图像生成(OpenAI)"并保存
7. Change Endpoint Type to "Image Generation (OpenAI)" and Save
把终点类型换成图像生成(OpenAI),然后点击保存。 Switch endpoint type to Image Generation (OpenAI), then click Save.
8. 返回绘图界面即可使用
8. Return to Drawing Interface to Use
返回绘图界面之后即可调用使用。 Return to the drawing interface and start using it.
gpt-image-2,终点类型务必设置为图像生成(OpenAI)。
Use token from auto group. Select gpt-image-2 model and make sure endpoint type is set to Image Generation (OpenAI).
酒馆 (SillyTavern)
SillyTavern
配置步骤
Configuration
- API 来源: Custom (OpenAI Compatible)
- API Endpoint:
https://nameyn.shop/v1 - API Key: 填入您的令牌
- Model:
[次]gemini-2.5-pro
安卓 SillyTavern 酒馆安装教程
Android SillyTavern Installation
🎬 安卓 SillyTavern 配置教程
安装 Termux
Install Termux
从 F-Droid 或 GitHub 下载并安装 Termux。 Download and install Termux from F-Droid or GitHub.
更新软件包
Update Packages
在 Termux 中更新软件包: Update packages in Termux:
pkg update && pkg upgrade
安装 Git
Install Git
pkg install git
克隆酒馆仓库
Clone SillyTavern
git clone https://github.com/SillyTavern/SillyTavern -b release
进入目录并安装 Node.js
Enter Directory and Install Node.js
进入 SillyTavern 目录并安装 Node.js: Enter SillyTavern directory and install Node.js:
cd SillyTavern
pkg install nodejs
安装依赖
Install Dependencies
npm install
运行酒馆
Run SillyTavern
如果已在 SillyTavern 文件夹下,直接运行启动脚本: If already in SillyTavern folder, run the start script:
cd SillyTavern
./start.sh
http://127.0.0.1:8000
If redirect fails, open in browser: http://127.0.0.1:8000
配置 API
Configure API
在 SillyTavern 中配置 Nameyn: Configure Nameyn in SillyTavern:
- 点击设置,聊天补全来源选择 自定义(兼容 OpenAI 协议)
- 自定义端点 URL:
https://nameyn.shop/v1 - API 密钥: 填入您的令牌
- 模型名称:
[次]gemini-2.5-pro - 点击"获取可用模型"验证配置
Lovemo
Website lovemo.app(单击跳转!)API 来源: Custom (OpenAI Compatible)
Omate
Website omate.org(单击跳转!)API 来源: Custom (OpenAI Compatible)
Rikkahub
Website rikka-ai.com(单击跳转!)API 来源: Custom (OpenAI Compatible)
Tavo
Website tavoai.dev(单击跳转!)API 来源: Custom (OpenAI Compatible)
LifeKline
Website lifekline(单击跳转!)注意:此应用使用 gemini-3-pro-preview 模型。
提示词优化器配置教程
Prompt Optimizer Configuration
Website https://prompt.always200.com/(单击跳转!)配置步骤
Configuration Steps
1. 点击网页右上角的模型管理
1. Click Model Management in Top Right
打开提示词优化器网站后,点击页面右上角的"模型管理"按钮。 After opening the Prompt Optimizer website, click the "Model Management" button in the top right corner.
2. 配置 API 信息
2. Configure API Information
在模型管理页面中,按照以下信息进行配置: In the Model Management page, configure with the following information:
- 提供商:选择
openaiProvider: Selectopenai - API 密钥:填入您从 Nameyn 网站获取的令牌 API Key: Enter your token from Nameyn
- API 地址:
https://nameyn.shop/v1API URL:https://nameyn.shop/v1
3. 选择模型
3. Select Model
在模型选择中,选择 [次]gemini-2.5-pro 模型。
In model selection, choose [次]gemini-2.5-pro model.
4. 开始使用
4. Start Using
配置完成后,选择刚才配置的模型进行对话即可。提示词优化器将帮助你优化和改进你的 AI 提示词。 After configuration, select the configured model to start chatting. The Prompt Optimizer will help you optimize and improve your AI prompts.
小懿 (XiaoYi)
Website xiaoyi.ink(单击跳转!)API 来源: Custom (OpenAI Compatible)
小手机 (SmallPhone)
API 来源: Custom (OpenAI Compatible)