简体中文繁體中文(港)繁體中文(台)EnglishEspañolالعربيةहिन्दीPortuguês日本語한국어FrançaisDeutsch
NG

NG 开发者

使用 NG 分享平台构建。搜索网站、提交网址、实时聊天、集成 AI Agent。

OpenAPI Spec llms.txt AI Plugin MCP Tools
快速开始 API 参考 数据模型 WebSocket 认证 AI 功能 社交检测 站点认领 速率限制 CLI 工具 代码示例 发现入口

快速开始

几秒内开始使用 NG API。所有公开端点无需认证。

# Search sites
curl https://ng.net/api/sites?search=AI+tools

# Get trending
curl https://ng.net/api/sites?sort=hot

# Submit a URL
curl -X POST https://ng.net/api/sites \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com"}'

# Get chat messages
curl https://ng.net/api/messages?limit=10

# Send a message
curl -X POST https://ng.net/api/messages \
  -H "Content-Type: application/json" \
  -d '{"content": "Hello from the API!"}'

API 参考

所有端点使用 JSON 格式。基础 URL:https://ng.net

GET/api/sites
Search and browse shared sites
参数 & 响应
名称类型必需描述
searchstringKeyword search
tagstringFilter by category tag
sortstringhot (default) or recent
pageintegerPage number (default 1, 60/page)

响应 200

{
  "sites": [{ "id": "abc123", "url": "https://example.com", "title": "Example", ... }],
  "total": 42,
  "page": 1,
  "hasMore": true
}
POST/api/sites
Submit a new URL to the platform
请求体 & 响应

请求体

{
  "url": "https://example.com",        // required
  "turnstileToken": "cf-..."    // required when CAPTCHA enabled
}

响应 201 (new)

{ "site": { ... }, "isNew": true }

响应 200 (existing, submit count incremented)

{ "site": { ... }, "isNew": false }

错误

400 — Invalid URL or request format
403 — Missing or invalid Turnstile token
429 — Rate limited (5/min per IP)
Social profile URLs (Twitter, Instagram, GitHub, etc.) are auto-detected. AI generates tags asynchronously after submission. Metadata (title, description, favicon, OG image) is fetched server-side.
GET/api/sites/tags
Get all available category tags
响应
{ "tags": ["工具", "技术", "设计", "新闻", "社区", ...] }
POST/api/sites/{id}/boost
Boost a site's visibility in hot rankings
参数 & 响应
名称类型必需描述
idstring (path)Site ID (nanoid)

响应 200

{ "site": { ... }, "credits": 0 }

错误

404 — Site not found
429 — Daily limit reached (1/day free, 3/day logged-in)
POST/api/sites/{id}/claim
Verify site ownership
参数 & 响应
名称类型必需描述
idstring (path)Site ID
Requires: <meta name="ngnet-verify" content="{siteId}"> in your site's HTML <head>

响应 200

{ "site": { ... }, "verified": true }

错误

400 — Verification meta tag not found / already claimed
404 — Site not found
POST/api/clicks/{id}
Record a click for analytics
响应
{ "recorded": true }

Rate limit: 30/min per IP

GET/api/messages
Get recent chat messages
参数 & 响应
名称类型必需描述
limitintegerNumber of messages (default 50, max 100)

响应 200

{
  "messages": [{
    "id": "abc", "type": "chat",
    "content": "Hello!", "sender_name": "user123",
    "created_at": "2026-03-27T12:00:00Z"
  }]
}
POST/api/messages
Send a chat message (max 200 chars, rate: 10/min)
请求体 & 响应

请求体

{ "content": "Hello from the API!" }

响应 201

{ "message": { "id": "...", "type": "chat", ... } }

错误

400 — Empty or exceeds 200 chars
429 — Rate limited (10/min per IP)
POST/api/translate
AI-powered translation (12 languages)
请求体 & 响应

请求体

{
  "text": "Hello world",       // max 2000 chars
  "targetLang": "zh-CN"
}

响应 200

{ "translated": "你好世界" }

错误

400 — Missing params or text too long
429 — Rate limited (20/min per IP)
500 — AI translation failed
Uses Cloudflare Workers AI (M2M100-1.2B). Source language is auto-detected.
GET/api/bing-bg
Daily background image from Bing
响应
{
  "imageUrl": "https://www.bing.com/...",
  "videoUrl": "https://...",  // or null
  "copyright": "Photo credit...",
  "title": "Image title"
}
Cached for 6 hours. Proxies Bing's daily image API.
POST/api/auth/send-code
Send login verification code to email
请求体 & 响应

请求体

{ "email": "user@example.com" }

响应 200

{ "sent": true }
POST/api/auth/verify
Verify code and create session
请求体 & 响应

请求体

{ "email": "user@example.com", "code": "123456" }

响应 200

{ "user": { "id": "...", "email": "...", "username": "..." } }
Sets HttpOnly cookie sn_token with JWT session.
GET/api/bookmarks
Get user's bookmarked sites (requires auth)
响应
{ "bookmarks": [{ "site_id": "...", "created_at": "..." }] }

数据模型

API 返回的核心数据结构。

Site

字段类型描述
idstringUnique identifier (nanoid)
urlstringFull URL
titlestringPage title (fetched from metadata)
descriptionstringPage description (fetched from metadata)
favicon_urlstringFavicon URL
og_image_urlstringOpen Graph image URL
domainstringExtracted domain (e.g. example.com)
tagsstring[]AI-generated category tags
submit_countintegerNumber of times submitted
click_countintegerTotal clicks recorded
hot_scorenumberTrending score (higher = more popular)
site_typestringwebsite or profile
social_platformstringPlatform name for profiles (twitter, instagram, etc.)
social_usernamestringUsername for profile-type sites
boost_countintegerNumber of boosts received
is_claimedbooleanWhether site ownership is verified
is_promotedbooleanCurrently running paid promotion
first_submitted_atISO 8601First submission timestamp
last_activity_atISO 8601Last activity timestamp

ChatMessage

字段类型描述
idstringUnique message ID
typestringchat, system, or entrance
contentstringMessage content
content_keystring?i18n key for system messages
content_paramsobject?Interpolation params for i18n
sender_namestringDisplay name or geo-based name
sender_locationstring?Raw location (e.g. CN|Beijing)
created_atISO 8601Message timestamp

WebSocket API

连接 WebSocket 端点获取实时更新。无需认证。

连接方式

// Browser
const ws = new WebSocket("wss://ng.net/api/ws");

ws.onmessage = (event) => {
  const data = JSON.parse(event.data);
  console.log(data.event, data.payload);
};

事件类型

事件载荷
new_messageChatMessage object — new chat/entrance/system message
site_updateSite object — metadata updated after async fetch
like{ messageId, fromUser, toUser } — message liked

示例

// new_message event payload
{
  "event": "new_message",
  "payload": {
    "id": "abc123",
    "type": "entrance",
    "content": "entered",
    "content_key": "chat.entered",
    "sender_name": "United States Dallas",
    "sender_location": "US|Dallas",
    "created_at": "2026-03-27T12:00:00Z"
  }
}

// site_update event payload
{
  "event": "site_update",
  "payload": {
    "id": "xyz789",
    "title": "Example Site",
    "description": "A great website",
    "tags": ["工具", "技术"]
  }
}

// like event payload
{
  "event": "like",
  "payload": {
    "messageId": "msg123",
    "fromUser": "United States Dallas",
    "toUser": "Japan Tokyo"
  }
}

认证

大部分端点公开访问。部分功能需要邮箱登录。

登录流程

1. 发送验证码到邮箱

curl -X POST https://ng.net/api/auth/send-code \
  -H "Content-Type: application/json" \
  -d '{"email": "you@example.com"}'

2. 验证验证码并获取会话

curl -X POST https://ng.net/api/auth/verify \
  -H "Content-Type: application/json" \
  -d '{"email": "you@example.com", "code": "123456"}'
会话存储在 HttpOnly cookie(sn_token)中。请求时携带 cookie 访问受保护端点。

需认证的端点

EndpointDescription
GET /api/bookmarksGet user bookmarks
POST /api/bookmarksAdd bookmark
DELETE /api/bookmarks/{id}Remove bookmark
GET /api/sites/my-submissionsUser's submission history
POST /api/auth/set-usernameChange display name

AI 功能

NG 使用 Cloudflare Workers AI 驱动智能功能。

自动标签

提交网址时,AI 分析页面内容并自动分配分类标签。使用 Meta Llama 3.1 8B Instruct 模型。

可用标签

工具 (Tools)技术 (Tech)设计 (Design)新闻 (News) 社区 (Community)学习 (Learning)娱乐 (Entertainment)资源 (Resources) 商业 (Business)生活 (Lifestyle)社交 (Social)
Tags are assigned asynchronously after URL submission. The AI analyzes the fetched page content and selects 1-3 tags from the above list. Tags are stored as Chinese strings in the database but displayed in the user's language via i18n mapping.

翻译

翻译 API 支持 12 种语言,使用 M2M100-1.2B 模型。自动检测源语言。

支持的语言

zh-CNzh-HKzh-TWenesar hiptjakofrde

社交资料检测

来自社交平台的 URL 会被自动检测并以个人资料卡片形式展示,带有丰富的元数据。

支持的平台

PlatformURL PatternExample
Twitter / Xx.com/{user}, twitter.com/{user}x.com/elonmusk
Instagraminstagram.com/{user}instagram.com/cristiano
GitHubgithub.com/{user}github.com/torvalds
TikToktiktok.com/@{user}tiktok.com/@khaby.lame
YouTubeyoutube.com/@{user}youtube.com/@MrBeast
Facebookfacebook.com/{user}, fb.me/{user}facebook.com/zuck
LinkedInlinkedin.com/in/{user}linkedin.com/in/satyanadella
Redditreddit.com/user/{user}reddit.com/user/spez
Telegramt.me/{user}t.me/durov
Pinterestpinterest.com/{user}pinterest.com/pinterest

检测基于 URL 模式匹配。个人资料 URL 会被抓取 Open Graph 元数据(头像、简介、显示名称)。

个人资料专属字段

字段描述
site_type"profile" (instead of "website")
social_platformPlatform identifier (twitter, instagram, github, etc.)
social_usernameExtracted username handle
og_image_urlProfile avatar (from Open Graph)
descriptionBio / profile description (from Open Graph)

站点认领

站点所有者可以验证所有权,解锁分析和高级展示等附加功能。

验证步骤

1. 在 ng.net 找到你的网站并记下站点 ID

2. 在你网站的 HTML <head> 中添加 meta 标签

<meta name="ngnet-verify" content="YOUR_SITE_ID">

3. 调用认领 API 端点

curl -X POST https://ng.net/api/sites/YOUR_SITE_ID/claim

认领的好处

速率限制

速率限制保护平台免受滥用。限制按 IP 地址计算。

端点限制
POST /api/sites (Submit URL)5/min per IP
POST /api/messages (Chat)10/min per IP
POST /api/translate20/min per IP
POST /api/clicks/{id}30/min per IP
POST /api/sites/{id}/boost1-3/day per IP
POST /api/auth/send-code3/min per email
POST /api/auth/verify5/min per email
被限流时返回 HTTP 429 及 JSON 错误信息。

CLI 工具

NG 分享平台官方 CLI 工具。从终端搜索、提交和管理网站。

安装

# Install globally
npm install -g @ngnet/cli

# Or use directly with npx
npx ngnet help

命令

命令描述
ngnet search <query>Search sites by keyword
ngnet trendingShow trending (hot) sites
ngnet recentShow recently submitted sites
ngnet tagsList all category tags
ngnet tag <name>Browse sites by specific tag
ngnet submit <url>Submit a URL to the platform
ngnet boost <id>Boost a site's visibility
ngnet translate <text> --to <lang>Translate text between languages
ngnet send <message>Send a chat message
ngnet messagesShow recent chat messages
ngnet info <id>Show detailed info for a site
ngnet helpShow help information

全局选项

OptionDescription
--jsonOutput raw JSON (for piping to other tools)
--to <lang>Target language for translation (e.g. en, ja, zh-CN)

示例

# Search for AI tools
ngnet search "AI tools"

# Get trending sites as JSON
ngnet trending --json

# Filter by tag
ngnet tag 技术

# Submit a site
ngnet submit https://example.com

# Boost a site
ngnet boost abc123

# Translate text
ngnet translate "Hello world" --to ja

# Send chat message
ngnet send "Hello from CLI!"

# Pipe JSON output to jq
ngnet search "design" --json | jq '.sites[].title'

代码示例

常见集成模式,提供多种语言示例。

搜索网站

curl -s "https://ng.net/api/sites?search=AI+tools&sort=hot" | jq .
const res = await fetch('https://ng.net/api/sites?search=AI+tools');
const { sites, total } = await res.json();
console.log(`Found ${total} sites`);
sites.forEach(s => console.log(s.title, s.url));
import requests

r = requests.get("https://ng.net/api/sites", params={"search": "AI tools"})
data = r.json()
for site in data["sites"]:
    print(site["title"], site["url"])

提交网址

curl -X POST https://ng.net/api/sites \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com"}'
const res = await fetch('https://ng.net/api/sites', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ url: 'https://example.com' })
});
const { site, isNew } = await res.json();
console.log(isNew ? 'New!' : 'Already exists', site.title);
import requests

r = requests.post("https://ng.net/api/sites", json={"url": "https://example.com"})
data = r.json()
print("New!" if data["isNew"] else "Exists", data["site"]["title"])

WebSocket 实时

// Browser WebSocket client
const ws = new WebSocket("wss://ng.net/api/ws");

ws.onopen = () => console.log("Connected!");

ws.onmessage = (event) => {
  const { event: type, payload } = JSON.parse(event.data);
  switch (type) {
    case "new_message":
      console.log(`[${payload.sender_name}] ${payload.content}`);
      break;
    case "site_update":
      console.log(`Site updated: ${payload.title}`);
      break;
    case "like":
      console.log(`${payload.fromUser} liked a message`);
      break;
  }
};

ws.onclose = () => console.log("Disconnected");

更新日志

API 版本历史和重要更新。

VersionDateChanges
v1.22026-03v1.2 — 新增站点认领、社交资料检测、多语言支持(12 种语言)、CLI 工具。
v1.12026-02v1.1 — 新增 WebSocket 实时事件、消息点赞、AI 翻译自动检测语言。
v1.02026-01v1.0 — 初始版本,包含网站、消息、加热和翻译 API。

发现入口

面向 AI Agent 和自动化工具的机器可读入口。

OpenAPI 3.1

Machine-readable API specification with schemas and examples

/openapi.json

LLM Context (short)

Quick summary for LLM context windows

/llms.txt

LLM Full Reference

Complete API docs for LLM consumption

/llms-full.txt

AI Plugin (ChatGPT)

OpenAI plugin manifest for GPT-based agents

/.well-known/ai-plugin.json

MCP Tools (Claude)

Model Context Protocol tool definitions

/.well-known/mcp.json

Sitemap

XML sitemap with i18n alternates

/sitemap.xml