跳转到主要内容
应用内通知 feed。给 console.bytespike.ai 上的铃铛图标供数 —— 通过 webhooks(/me/webhooks)可订阅的同样 5 个事件, 也会在这里累积用于应用内展示,除非你把它们静音了。免费。 要 push 式消费,优先用 webhooks —— 这个端点是轮询 回退(比如不方便跑 webhook 接收器的 IDE 扩展或状态栏)。

端点家族

MethodPath用途
GET/api/v1/me/notifications?unread=&type=&page=&page_size=列出通知
GET/api/v1/me/notifications/unread-count只取未读数
POST/api/v1/me/notifications/:id/mark-read单条标为已读
POST/api/v1/me/notifications/mark-all-read把所有未读标为已读
都需要登录态 key。标已读操作免费。

List

curl 'https://llm.bytespike.ai/api/v1/me/notifications?unread=true&page=1&page_size=10' \
  -H "Authorization: Bearer $BYTESPIKE_API_KEY"

Query 参数

ParamTypeNotes
unreadbooltrue 只返回未读行。与 read 互斥。
readbooltrue 只返回已读行。
typestring按事件类型过滤(见 事件目录)。
pageinteger默认 1
page_sizeinteger默认 50,最大 200

Response

{
  "items": [
    {
      "id": 5001,
      "type": "system.payment.received",
      "title": "Payment received · $25.00",
      "body": "Your top-up has cleared. Available balance is now $31.40.",
      "link": "/billing",
      "read_at": null,
      "created_at": "2026-05-22T08:08:00Z"
    },
    {
      "id": 5006,
      "type": "system.payment.received",
      "title": "Payment received · $50.00",
      "body": "Stripe receipt #ch_3PYj-mock-49. Your balance is now $54.80.",
      "link": "/billing",
      "read_at": "2026-05-20T08:00:00Z",
      "created_at": "2026-05-20T05:08:00Z"
    }
  ],
  "total": 142,
  "page": 1,
  "page_size": 10
}

Response 字段

FieldTypeNotes
items[].typestring5 个用户可见事件之一(见 事件目录)。
items[].titlestring铃铛下拉里的单行摘要。
items[].bodystring一段描述。
items[].linkstring | null点击跳转的 console 相对深链。
items[].read_atstring | null用户打开的 ISO 时间戳。null = 未读。
totalinteger匹配过滤的总数(与 page 无关)。unread=true 时也是未读总数。

未读计数

curl https://llm.bytespike.ai/api/v1/me/notifications/unread-count \
  -H "Authorization: Bearer $BYTESPIKE_API_KEY"
{"count": 7}
比 list 便宜 —— 用于每分钟左右轮询的红点 badge。

标单条为已读

curl -X POST https://llm.bytespike.ai/api/v1/me/notifications/5001/mark-read \
  -H "Authorization: Bearer $BYTESPIKE_API_KEY"
{
  "id": 5001,
  "type": "system.payment.received",
  "read_at": "2026-05-22T08:14:32Z"
}
幂等 —— 对已读行调用是 no-op(read_at 不变)。

全部标为已读

curl -X POST https://llm.bytespike.ai/api/v1/me/notifications/mark-all-read \
  -H "Authorization: Bearer $BYTESPIKE_API_KEY"
{"marked_read": 7}
返回翻转的数量。幂等 —— 再次调用返回 {"marked_read": 0}

事件目录 [#event-catalog]

通知 feed 只展示用户可见事件 —— 是 webhook 事件目录 的精选子集。5 个类型:
Type何时触发
system.payment.received一笔充值进入你的钱包
system.balance.notify.dispatched低余额 cron 跨过你的阈值
admin.org.member.add有人被加入你的组织(对组织 owner/admin 可见)
admin.api_key.revoke平台管理员撤销了你的个人 key
org.api_key.revoke组织管理员撤销了你的某把组织 key
如果你需要完整集合(每次 admin 写入、每次 org 成员变更等),用 webhooks —— 它们收的是更广的目录。

错误

Statuserror.type触发条件
400invalid_request_error同时给 read=trueunread=true,或 type 未知。
401authentication_errorkey 缺失 / 已撤销。
404not_found_error通知 :id 不属于调用方。

示例 —— 轮询状态栏

import time, requests, os

headers = {"Authorization": f"Bearer {os.environ['BYTESPIKE_API_KEY']}"}

while True:
    r = requests.get(
        "https://llm.bytespike.ai/api/v1/me/notifications/unread-count",
        headers=headers,
        timeout=5,
    ).json()
    print(f"Unread: {r['count']}")
    time.sleep(60)
有 HTTPS 端点的话切换到 webhook 订阅 —— 推送在新鲜度和负载上都 胜过轮询。