API 文档

基础地址 https://api.gengwiki.niox.lol/v1,返回 JSON。

鉴权

在 个人中心 创建 API Key

curl https://api.gengwiki.niox.lol/v1/memes/search?q=躺平 \
  -H "Authorization: Bearer gwk_live_xxx"

范围

创建 Key 时选择它的范围,之后的检索都只在范围内进行

梗

任意多个,/memes 只返回这些

人设

最多一个,选中后会带入它关联的梗和表情包

表情包

任意多个,/stickers 只返回这些

全站热门梗走单独的 /trending,不受范围限制,适合让模型了解最近在流行什么

接口

方法路径Scope说明
GET/memes/search?q=&limit=memes:read在 Key 关联的梗里搜索,q 为空时按热度列出
GET/memes/{slug}memes:readKey 关联的梗的详情,含用法、相关梗、贡献者和最后更改时间
GET/trending?limit=trending:read全站热门梗,不受 Key 范围限制
GET/personapersona:readKey 绑定的人设,含完整 System Prompt
GET/stickers/search?q=&limit=stickers:read在 Key 关联的表情包里按说明、名称、标签搜索
GET/sticker-packsstickers:readKey 关联的表情包及全部图片
GET/stickers/{id}/image无需 Key图片本身,可直接放进 Markdown 或 img
GET/me/lexiconslexicon:read:self我的个人词库
POST/me/lexiconslexicon:write:self新建个人词库
GET/me/lexicons/{id}/entrieslexicon:read:self个人词库词条
POST/me/lexicons/{id}/entrieslexicon:write:self添加个人词条
GET/me/usage无近 30 天调用量
GET/me/rate-limit无当前限流档位与剩余额度

DeepSeek Function Calling

把下面的工具定义传给模型,模型遇到不认识的梗时会主动调用。

{
  "type": "function",
  "function": {
    "name": "search_memes",
    "description": "搜索中文网络热梗,返回释义和用法。遇到不认识的网络用语时调用。",
    "parameters": {
      "type": "object",
      "properties": {
        "q": { "type": "string", "description": "梗的关键词、别名或拼音缩写" },
        "limit": { "type": "integer", "description": "返回条数,默认 5" }
      },
      "required": ["q"]
    }
  }
}

完整的 Python 调用示例

import json, requests
from openai import OpenAI

client = OpenAI(api_key="sk-...", base_url="https://api.deepseek.com")
GW = {"Authorization": "Bearer gwk_live_xxx"}
tools = [TOOL]  # 上面的 search_memes

def search_memes(q, limit=5):
    r = requests.get("https://api.gengwiki.niox.lol/v1/memes/search", params={"q": q, "limit": limit}, headers=GW)
    return r.json()

messages = [{"role": "user", "content": "同事说我身上班味好重,是什么意思?"}]
resp = client.chat.completions.create(model="deepseek-chat", messages=messages, tools=tools)
msg = resp.choices[0].message

if msg.tool_calls:
    call = msg.tool_calls[0]
    result = search_memes(**json.loads(call.function.arguments))
    messages += [msg, {"role": "tool", "tool_call_id": call.id,
                       "content": json.dumps(result, ensure_ascii=False)}]
    resp = client.chat.completions.create(model="deepseek-chat", messages=messages, tools=tools)

print(resp.choices[0].message.content)

限流

每个 Key 每分钟 600 次,每天 100,000 次

两个维度同时计数,任一超出都会返回 429

维度每分钟每天说明
API Key600100,000同一个 Key 的所有请求合计,不论来自哪台机器
IP1,200不限同一个 IP 的所有请求合计,包括无效 Key 的请求,用来拦截刷接口和猜 Key
  • 分钟按自然分钟计算,每天在 UTC 零点(北京时间 8 点)重置
  • 429 响应带 Retry-After,等这么多秒后再重试
  • 用 /me/rate-limit 随时查看这个 Key 的用量

错误码

{ "error": { "code": "forbidden", "message": "..." } }
400bad_request参数不合法
401unauthorized缺少或无效的 API Key
403forbidden缺少 scope
404not_found资源不存在,或不在此 Key 的范围内
429rate_limited超出限流,按 Retry-After 秒数后重试