( API ) — YuazLLM 3B MoE
API 三种格式
同一个模型,三种调用方式:原子格式(网页服务在用的原生格式)、 OpenAI 兼容、Claude 兼容。三种都支持流式与非流式。
鉴权:公开免鉴权
限流:150 次/分钟
max_tokens:≤ 200
上下文:1024 字
模型名:yuaz-llm-3b-moe
POST
https://ai.yuaz.club/api/ai/chat网页对话页正在使用的原生格式:只传本轮 message 与历史 history,超长由服务端自动剔除最旧轮次。
请求体
{
"message": "你好",
"history": [
{ "role": "user", "content": "上一句" },
{ "role": "assistant", "content": "上一句的回复" }
],
"stream": false,
"max_new_tokens": 200,
"temperature": 0.7,
"top_k": 20,
"top_p": 0.9,
"repetition_penalty": 1.15
}
响应(非流式)
{
"success": true,
"reply": "我是元晦(Yuaz LLM YuAn Hui),原子漫画社……",
"time": "8.2s",
"device": "Vulkan GPU (YuazLLM v6)",
"context_truncated": false,
"dropped_rounds": 0
}
流式(stream: true)
event: meta ← 仅当上下文超限时出现
data: {"context_truncated":true,"dropped_rounds":2}
data: {"token":"我"}
data: {"token":"是"}
data: [DONE]
curl
curl -N -X POST https://ai.yuaz.club/api/ai/chat \
-H 'Content-Type: application/json' \
-d '{"message":"你好","stream":true}'
POST
https://ai.yuaz.club/v1/chat/completionsGET
https://ai.yuaz.club/v1/models兼容 OpenAI Chat Completions。把 SDK 的 base_url 指到 https://ai.yuaz.club/v1,api_key 随便填即可。
请求体
{
"model": "yuaz-llm-3b-moe",
"messages": [
{ "role": "system", "content": "你是一个友好的助手" },
{ "role": "user", "content": "你好" }
],
"max_tokens": 200,
"temperature": 0.7,
"stream": false
}
响应(非流式)
{
"id": "chatcmpl-xxxxxxxx",
"object": "chat.completion",
"created": 1789187000,
"model": "yuaz-llm-3b-moe",
"choices": [
{
"index": 0,
"message": { "role": "assistant", "content": "我是元晦……" },
"finish_reason": "stop"
}
],
"usage": { "prompt_tokens": 0, "completion_tokens": 0, "total_tokens": 0 }
}
流式(标准 SSE chunk)
data: {"id":"chatcmpl-xxx","object":"chat.completion.chunk","choices":[{"index":0,"delta":{"content":"我"},"finish_reason":null}]}
data: {"...":"...","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}
data: [DONE]
Python(openai SDK)
from openai import OpenAI
client = OpenAI(base_url="https://ai.yuaz.club/v1", api_key="not-needed")
resp = client.chat.completions.create(
model="yuaz-llm-3b-moe",
messages=[{"role": "user", "content": "你好"}],
)
print(resp.choices[0].message.content)
curl
curl -N https://ai.yuaz.club/v1/chat/completions \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer not-needed' \
-d '{"model":"yuaz-llm-3b-moe","messages":[{"role":"user","content":"你好"}],"stream":true}'
POST
https://ai.yuaz.club/v1/messages兼容 Anthropic Messages API(含 system 字段与内容块数组,以及助手预填续写)。
请求体
{
"model": "yuaz-llm-3b-moe",
"max_tokens": 200,
"system": "你是一个友好的助手",
"messages": [
{ "role": "user", "content": "你好" }
],
"stream": false
}
响应(非流式)
{
"id": "msg_xxxxxxxx",
"type": "message",
"role": "assistant",
"model": "yuaz-llm-3b-moe",
"content": [ { "type": "text", "text": "我是元晦……" } ],
"stop_reason": "end_turn",
"stop_sequence": null,
"usage": { "input_tokens": 0, "output_tokens": 0 }
}
流式(Anthropic 事件序列)
event: message_start
data: {"type":"message_start","message":{"id":"msg_xxx","role":"assistant","content":[]}}
event: content_block_start
data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""}}
event: content_block_delta
data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"我"}}
event: content_block_stop
data: {"type":"content_block_stop","index":0}
event: message_delta
data: {"type":"message_delta","delta":{"stop_reason":"end_turn"},"usage":{"output_tokens":1}}
event: message_stop
data: {"type":"message_stop"}
Python(anthropic SDK)
from anthropic import Anthropic
client = Anthropic(base_url="https://ai.yuaz.club", api_key="not-needed")
msg = client.messages.create(
model="yuaz-llm-3b-moe",
max_tokens=200,
messages=[{"role": "user", "content": "你好"}],
)
print(msg.content[0].text)
curl
curl -N https://ai.yuaz.club/v1/messages \
-H 'Content-Type: application/json' \
-H 'anthropic-version: 2023-06-01' \
-H 'x-api-key: not-needed' \
-d '{"model":"yuaz-llm-3b-moe","max_tokens":200,"messages":[{"role":"user","content":"你好"}]}'
试一试
结果会显示在这里(非流式)。