【准备工作】先拿到 Key:用邀请码注册双方各得 2000万
即可。 无需 Cloudflare Worker 或其他什么中转。
然后打开你的 NextChat,如果你的版本太旧不支持插件你可以先用我的 GPT-4 风格高级灰版: https://15.cn-gpt.wiki
点击左上的【发现】→【Plugins】→ 新建:

授权方式选 Bearer ,Token 填你最上面拿到的 硅基流动 的 Key,纯新人不知道 Key 在哪拿的话可以先用这个:
sk-xcdcquzwbsycxgadtwijeetzukhroyeorzqqzfvrtwrlmqrs
之后将这里的 Schema 代码全选复制粘贴到下面小黑框里: 点击展开 OpenAPI Schema
openapi: 3.0.1
info:
title: SiliconImagen
description: A plugin to generate images using SiliconFlow API
version: 'v1.0'
servers:
- url: https://api.siliconflow.cn
paths:
/v1/images/generations:
post:
operationId: generateImage
x-openai-isConsequential: false
summary: Generate an image based on text prompt
security:
- bearerAuth: []
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
prompt:
type: string
description: The text prompt to generate image from. If input cannot be translated to English, use "a question mark, centered, white background, simple, minimalistic"
model:
type: string
default: "stabilityai/stable-diffusion-3-5-large"
image_size:
type: string
default: "1024x1024"
enum: ["1024x1024", "512x1024", "768x512", "768x1024", "1024x576", "576x1024"]
batch_size:
type: integer
default: 1
num_inference_steps:
type: integer
default: 25
guidance_scale:
type: number
default: 7.5
required:
- prompt
responses:
"200":
description: OK
content:
application/json:
schema:
type: object
properties:
images:
type: array
items:
type: object
properties:
url:
type: string
timings:
type: object
properties:
inference:
type: number
seed:
type: integer
shared_id:
type: string
data:
type: array
items:
type: object
properties:
url:
type: string
created:
type: integer
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
粘贴完后按一下 Tab 键(焦点移出黑框即可)下面多出一个 generateImage,插件就配置完毕了。
【最后一步】将这段 Prompt 放到对话的 System Prompt 里: 点击展开 System Prompt
将用户发送的内容转译成英文 Prompt,调用 SiliconImagen 插件为用户生成图片。
**若用户不指定其他参数,则使用下述参数:**
>**model**: Pro/black-forest-labs/FLUX.1-schnell
**image_size**: 768x512
**batch_size**: 1
**num_inference_steps**: 25
**guidance_scale**: 7.5
可选尺寸:`1024x1024`, `512x1024`, `768x512`, `768x1024`, `1024x576`, `576x1024 `
接收到插件响应后按下述格式输出,*输出转译后的 Prompt 的内容无需标题*:
*直接输出 Prompt 的内容!
>耗时:timings.inference、Seed:seed
![created]\(images.url)
↑ 这里对应的是响应的键名,取其键值即可。如果用户请求了多张图响应略有不同时你就自行优化。
具体细节你可以自己改,面向 Prompt 编程.jpg
然后就可以直接用了,效果:

PS. 需要模型本身支持 FC 就是 Tools – Function Calling,一众旗舰模型例如 GPT-4o、Sonnet、GLM-4-Plus 都是肯定支持的无需管这个。
若使用硅基流动家模型的话现在只有 2 个模型支持 – 首选智谱的「 Pro/THUDM/glm-4-9b-chat」比官方那个 AIR 执行得好很多、Qwen 系列除最新的 128K 那个外也支持但会有调用前缀声明强迫症体验不太好。
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
暂无评论内容