AINative API Discovery
AINative exposes 89+ REST API endpoints at https://api.ainative.studio.
Endpoint Categories
Authentication & Users
| Endpoint | Method | Description |
|---|
| INLINECODE1 | POST | Email/password login → JWT |
| INLINECODE2 |
POST | Create account |
|
/api/v1/auth/refresh | POST | Refresh JWT token |
|
/api/v1/auth/logout | POST | Invalidate session |
|
/api/v1/users/me | GET | Get current user profile |
Chat & AI Completions
| Endpoint | Method | Description |
|---|
| INLINECODE6 | POST | Chat completion (streaming + non-streaming) |
| INLINECODE7 |
POST | Managed chat with session tracking |
|
/api/v1/public/models | GET | List available AI models |
Memory (ZeroMemory)
| Endpoint | Method | Description |
|---|
| INLINECODE9 | POST | Store a memory |
| INLINECODE10 |
POST | Semantic search memories |
|
/api/v1/public/memory/v2/forget | DELETE | Remove memories |
|
/api/v1/public/memory/v2/reflect | GET | Get memory insights |
|
/api/v1/public/memory/v2/profile | GET | Build user profile from memories |
|
/api/v1/public/memory/v2/graph | GET | Memory knowledge graph |
Credits & Billing
| Endpoint | Method | Description |
|---|
| INLINECODE15 | GET | Get current credit balance |
| INLINECODE16 |
GET | Credit usage history |
|
/api/v1/billing/subscribe | POST | Subscribe to a plan |
|
/api/v1/billing/invoices | GET | List invoices |
Developer Program (Echo)
| Endpoint | Method | Description |
|---|
| INLINECODE19 | POST | Register as a developer |
| INLINECODE20 |
GET | Get earnings summary |
|
/api/v1/echo/payouts | GET | List payouts |
|
/api/v1/echo/markup | PUT | Set your markup rate (0-40%) |
ZeroDB (Vector/NoSQL/Storage)
| Endpoint | Method | Description |
|---|
| INLINECODE23 | POST | Upsert vector embedding |
| INLINECODE24 |
POST | Semantic vector search |
|
/api/v1/public/zerodb/tables | GET/POST | List/create NoSQL tables |
|
/api/v1/public/zerodb/files/upload | POST | Upload file |
Admin & Monitoring
| Endpoint | Method | Description |
|---|
| INLINECODE27 | GET | List all users (superuser) |
| INLINECODE28 |
GET | System health metrics |
|
/admin/database | GET | Database pool status |
|
/health | GET | Health check (no auth) |
Authentication
All public endpoints require an API key:
CODEBLOCK0
Code Examples
Python
CODEBLOCK1
JavaScript/TypeScript
CODEBLOCK2
curl
CODEBLOCK3
References
- -
docs/api/API_REFERENCE.md — Complete endpoint documentation - INLINECODE32 — Full endpoint index
- INLINECODE33 — Implementation source
AINative API 发现
AINative 在 https://api.ainative.studio 上公开了 89 个以上的 REST API 端点。
端点分类
认证与用户
| 端点 | 方法 | 描述 |
|---|
| /api/v1/auth/login | POST | 邮箱/密码登录 → JWT |
| /api/v1/auth/register |
POST | 创建账户 |
| /api/v1/auth/refresh | POST | 刷新 JWT 令牌 |
| /api/v1/auth/logout | POST | 使会话失效 |
| /api/v1/users/me | GET | 获取当前用户资料 |
聊天与 AI 补全
| 端点 | 方法 | 描述 |
|---|
| /v1/public/chat/completions | POST | 聊天补全(流式 + 非流式) |
| /api/v1/public/managed-chat |
POST | 带会话跟踪的托管聊天 |
| /api/v1/public/models | GET | 列出可用的 AI 模型 |
记忆(ZeroMemory)
| 端点 | 方法 | 描述 |
|---|
| /api/v1/public/memory/v2/remember | POST | 存储一条记忆 |
| /api/v1/public/memory/v2/recall |
POST | 语义搜索记忆 |
| /api/v1/public/memory/v2/forget | DELETE | 删除记忆 |
| /api/v1/public/memory/v2/reflect | GET | 获取记忆洞察 |
| /api/v1/public/memory/v2/profile | GET | 从记忆构建用户画像 |
| /api/v1/public/memory/v2/graph | GET | 记忆知识图谱 |
积分与计费
| 端点 | 方法 | 描述 |
|---|
| /api/v1/public/credits/balance | GET | 获取当前积分余额 |
| /api/v1/public/credits/usage |
GET | 积分使用历史 |
| /api/v1/billing/subscribe | POST | 订阅套餐 |
| /api/v1/billing/invoices | GET | 列出发票 |
开发者计划(Echo)
| 端点 | 方法 | 描述 |
|---|
| /api/v1/echo/register | POST | 注册为开发者 |
| /api/v1/echo/earnings |
GET | 获取收益摘要 |
| /api/v1/echo/payouts | GET | 列出付款记录 |
| /api/v1/echo/markup | PUT | 设置加价率(0-40%) |
ZeroDB(向量/NoSQL/存储)
| 端点 | 方法 | 描述 |
|---|
| /api/v1/public/zerodb/vectors/upsert | POST | 插入或更新向量嵌入 |
| /api/v1/public/zerodb/vectors/search |
POST | 语义向量搜索 |
| /api/v1/public/zerodb/tables | GET/POST | 列出/创建 NoSQL 表 |
| /api/v1/public/zerodb/files/upload | POST | 上传文件 |
管理与监控
| 端点 | 方法 | 描述 |
|---|
| /admin/users | GET | 列出所有用户(超级用户) |
| /admin/monitoring |
GET | 系统健康指标 |
| /admin/database | GET | 数据库连接池状态 |
| /health | GET | 健康检查(无需认证) |
认证
所有公共端点都需要 API 密钥:
bash
请求头格式
X-API-Key: ak
yourkey_here
或 Bearer 令牌(用于用户会话)
Authorization: Bearer eyJ...
代码示例
Python
python
import requests
APIKEY = akyour_key
BASE = https://api.ainative.studio
聊天补全
resp = requests.post(f{BASE}/v1/public/chat/completions,
headers={X-API-Key: API_KEY},
json={model: claude-3-5-sonnet-20241022,
messages: [{role: user, content: Hello}]}
)
print(resp.json()[choices][0][message][content])
积分余额
balance = requests.get(f{BASE}/api/v1/public/credits/balance,
headers={X-API-Key: API_KEY}).json()
print(f积分: {balance[remaining_credits]})
JavaScript/TypeScript
typescript
const API
KEY = akyour_key;
const BASE = https://api.ainative.studio;
const resp = await fetch(${BASE}/v1/public/chat/completions, {
method: POST,
headers: { X-API-Key: API_KEY, Content-Type: application/json },
body: JSON.stringify({
model: claude-3-5-sonnet-20241022,
messages: [{ role: user, content: Hello }]
})
});
const data = await resp.json();
curl
bash
curl -X POST https://api.ainative.studio/v1/public/chat/completions \
-H X-API-Key: ak
yourkey \
-H Content-Type: application/json \
-d {model:claude-3-5-sonnet-20241022,messages:[{role:user,content:Hello}]}
参考资料
- - docs/api/APIREFERENCE.md — 完整的端点文档
- docs/api/APIENDPOINTS_REFERENCE.md — 完整的端点索引
- src/backend/app/api/v1/endpoints/ — 实现源代码