BatchIn

BatchIn 开发者文档

基于 MDX 内容结构组织的完整文档:快速开始、API 参考、教程、Cookbook 与更新日志。

上线准备度

把文档变成可运行结果

按“注册 → 创建密钥 → Playground → Batch”路径,最快 60 秒内完成首个请求。

模型可用数: --

API 健康状态: --

最近检查: --

BatchIn vs SiliconFlow

面向开发者的实用对比,重点看可验证性、批处理调度、支付路径和 GPU 控制权。

能力项BatchInSiliconFlow
VaaS 审计轨迹内置 Ed25519 审计记录,并支持浏览器侧验签。暂无等价验证层。
批处理优先级支持 High / Low / Fill 三档,并把价格取舍直接暴露给操作者。仅提供标准批处理。
支付方式支持 Stripe、USDC,以及后续智能体支付路线。以区域化支付方式为主。
GPU 控制权GPU 租赁支持 SSH root 和运行时控制。Reserved GPU 容量不提供同等级的操作者控制模型。

快速开始(3 种语言)

1) 安装

pip install openai

2) 首个请求

from openai import OpenAI

client = OpenAI(
  base_url="https://api.luminapath.tech/v1",
  api_key="YOUR_API_KEY"
)

resp = client.chat.completions.create(
  model="qwen3-32b",
  messages=[{"role": "user", "content": "Hello from BatchIn"}]
)
print(resp.choices[0].message.content)

3) 流式输出

stream = client.chat.completions.create(
  model="qwen3-32b",
  messages=[{"role": "user", "content": "Write a haiku about latency"}],
  stream=True
)

for chunk in stream:
  delta = chunk.choices[0].delta.content
  if delta:
    print(delta, end="")

平台操作手册

GPU 租赁申请路径

查看当前 GPU 档位、SSH 访问方式,以及申请专属容量的商业路径。

打开

白标部署路径

在启动白标项目之前,先明确品牌域名、Key 形态和计费隔离方式。

打开

API 参考

POST/v1/users公开

创建用户

创建用户账户(BFF 内部调用)。

请求示例

{
  "email": "dev@luminapath.tech",
  "name": "BatchIn Team",
  "password": "secure_password_123"
}

响应示例

{
  "id": "f6e2c67b-90cf-4f4e-b1e5-31d45f3b1b0a",
  "email": "dev@luminapath.tech",
  "name": "BatchIn Team",
  "credit_balance_cents": 0
}

代码示例

import os
import requests

headers = {}
headers["Content-Type"] = "application/json"
response = requests.request(
    "POST",
    "https://api.luminapath.tech/v1/users",
    headers=headers,
    json={
  "email": "dev@luminapath.tech",
  "name": "BatchIn Team",
  "password": "secure_password_123"
}
)

print(response.json())

参数表

NameType必填说明
emailstring(email)用户邮箱
namestring显示名称
passwordstring登录密码

错误码

CodeHTTP信息处理建议
conflict409该邮箱已注册改用登录流程或更换邮箱。
前往 Try it
POST/v1/users/login公开

用户登录

通过邮箱与密码登录。

请求示例

{
  "email": "dev@luminapath.tech",
  "password": "secure_password_123"
}

响应示例

{
  "id": "f6e2c67b-90cf-4f4e-b1e5-31d45f3b1b0a",
  "email": "dev@luminapath.tech",
  "name": "BatchIn Team",
  "credit_balance_cents": 10000
}

代码示例

import os
import requests

headers = {}
headers["Content-Type"] = "application/json"
response = requests.request(
    "POST",
    "https://api.luminapath.tech/v1/users/login",
    headers=headers,
    json={
  "email": "dev@luminapath.tech",
  "password": "secure_password_123"
}
)

print(response.json())

参数表

NameType必填说明
emailstring(email)登录邮箱
passwordstring登录密码

错误码

CodeHTTP信息处理建议
invalid_credentials401邮箱或密码错误确认账户信息后重试。
前往 Try it
GET/v1/users/meBearer

当前用户信息

获取当前 API Key 对应用户信息。

请求示例

{}

响应示例

{
  "id": "f6e2c67b-90cf-4f4e-b1e5-31d45f3b1b0a",
  "email": "dev@luminapath.tech",
  "name": "BatchIn Team",
  "credit_balance_cents": 10000
}

代码示例

import os
import requests

headers = {}
headers["Authorization"] = f"Bearer {os.environ['BATCHIN_API_KEY']}"
response = requests.request(
    "GET",
    "https://api.luminapath.tech/v1/users/me",
    headers=headers,
    
)

print(response.json())

参数表

NameType必填说明
无参数

错误码

CodeHTTP信息处理建议
unauthorized401API Key 无效或缺失检查 Authorization: Bearer <API_KEY>。
前往 Try it
GET/v1/users/by-email?email={email}公开

按邮箱查询用户

按邮箱查询用户信息(登录前检查)。

请求示例

{}

响应示例

{
  "id": "f6e2c67b-90cf-4f4e-b1e5-31d45f3b1b0a",
  "email": "dev@luminapath.tech",
  "name": "BatchIn Team",
  "credit_balance_cents": 10000
}

代码示例

import os
import requests

headers = {}
response = requests.request(
    "GET",
    "https://api.luminapath.tech/v1/users/by-email?email={email}",
    headers=headers,
    
)

print(response.json())

参数表

NameType必填说明
emailquery:string(email)目标邮箱

错误码

CodeHTTP信息处理建议
not_found404用户不存在先完成注册。
前往 Try it
POST/v1/keysBearer

创建 API Key

创建新 API Key,可设置速率与月预算。

请求示例

{
  "name": "Production Key",
  "rate_limit_rpm": 120,
  "monthly_budget_cents": 500000
}

响应示例

{
  "id": "f40cf8b0-c367-4764-92e3-cbd358fa3d76",
  "key": "batchin_api_xxx",
  "key_prefix": "batchin_api",
  "name": "Production Key",
  "rate_limit_rpm": 120,
  "monthly_budget_cents": 500000,
  "created_at": "2026-04-08T18:00:00Z"
}

代码示例

import os
import requests

headers = {}
headers["Authorization"] = f"Bearer {os.environ['BATCHIN_API_KEY']}"
headers["Content-Type"] = "application/json"
response = requests.request(
    "POST",
    "https://api.luminapath.tech/v1/keys",
    headers=headers,
    json={
  "name": "Production Key",
  "rate_limit_rpm": 120,
  "monthly_budget_cents": 500000
}
)

print(response.json())

参数表

NameType必填说明
namestring密钥名称
rate_limit_rpmnumber每分钟请求上限
monthly_budget_centsnumber月预算(美分)

错误码

CodeHTTP信息处理建议
unauthorized401API Key 无效或缺失检查 Authorization: Bearer <API_KEY>。
前往 Try it
GET/v1/keysBearer

列出 API Keys

返回当前用户全部 API Keys。

请求示例

{}

响应示例

[
  {
    "id": "f40cf8b0-c367-4764-92e3-cbd358fa3d76",
    "key_prefix": "batchin_api",
    "name": "Production Key",
    "rate_limit_rpm": 120,
    "is_active": true,
    "created_at": "2026-04-08T18:00:00Z"
  }
]

代码示例

import os
import requests

headers = {}
headers["Authorization"] = f"Bearer {os.environ['BATCHIN_API_KEY']}"
response = requests.request(
    "GET",
    "https://api.luminapath.tech/v1/keys",
    headers=headers,
    
)

print(response.json())

参数表

NameType必填说明
无参数

错误码

CodeHTTP信息处理建议
unauthorized401API Key 无效或缺失检查 Authorization: Bearer <API_KEY>。
前往 Try it
DELETE/v1/keys/{id}Bearer

删除 API Key

删除指定 API Key。

请求示例

{}

响应示例

204 No Content

代码示例

import os
import requests

headers = {}
headers["Authorization"] = f"Bearer {os.environ['BATCHIN_API_KEY']}"
response = requests.request(
    "DELETE",
    "https://api.luminapath.tech/v1/keys/{id}",
    headers=headers,
    
)

print(response.json())

参数表

NameType必填说明
idpath:uuidAPI Key ID

错误码

CodeHTTP信息处理建议
unauthorized401API Key 无效或缺失检查 Authorization: Bearer <API_KEY>。
not_found404API Key 不存在确认 key id 后重试。
前往 Try it
POST/v1/chat/completionsBearer

聊天补全

用于文本/多轮对话,支持 SSE 流式输出。

请求示例

{
  "model": "qwen3-32b",
  "messages": [{"role":"user","content":"Explain attention in 3 bullets"}],
  "temperature": 0.7,
  "stream": false
}

响应示例

{
  "id": "chatcmpl_xxx",
  "object": "chat.completion",
  "model": "qwen3-32b",
  "choices": [{"index":0,"message":{"role":"assistant","content":"..."}}],
  "usage": {"prompt_tokens": 22, "completion_tokens": 90, "total_tokens": 112}
}

代码示例

import os
import requests

headers = {}
headers["Authorization"] = f"Bearer {os.environ['BATCHIN_API_KEY']}"
headers["Content-Type"] = "application/json"
response = requests.request(
    "POST",
    "https://api.luminapath.tech/v1/chat/completions",
    headers=headers,
    json={
  "model": "qwen3-32b",
  "messages": [{"role":"user","content":"Explain attention in 3 bullets"}],
  "temperature": 0.7,
  "stream": false
}
)

print(response.json())

参数表

NameType必填说明
modelstring模型 ID
messagesarray对话消息数组
temperaturenumber采样温度
max_tokensnumber最大输出 tokens
streamboolean是否流式返回

错误码

CodeHTTP信息处理建议
unauthorized401API Key 无效或缺失检查 Authorization: Bearer <API_KEY>。
payment_required402余额不足或预算超限充值或提高月预算后重试。
前往 Try it
POST/v1/completionsBearer

文本补全 / FIM

兼容 OpenAI completions,并支持 prefix/suffix 形式的 FIM 请求。

请求示例

{
  "model": "qwen3-32b",
  "prompt": "Complete this sentence: Batch processing helps",
  "suffix": "for large workloads.",
  "max_tokens": 128
}

响应示例

{
  "id": "cmpl_xxx",
  "object": "text_completion",
  "choices": [{"index":0,"text":"reduce manual toil at scale.","finish_reason":"stop"}],
  "usage": {"prompt_tokens": 24, "completion_tokens": 12, "total_tokens": 36}
}

代码示例

import os
import requests

headers = {}
headers["Authorization"] = f"Bearer {os.environ['BATCHIN_API_KEY']}"
headers["Content-Type"] = "application/json"
response = requests.request(
    "POST",
    "https://api.luminapath.tech/v1/completions",
    headers=headers,
    json={
  "model": "qwen3-32b",
  "prompt": "Complete this sentence: Batch processing helps",
  "suffix": "for large workloads.",
  "max_tokens": 128
}
)

print(response.json())

参数表

NameType必填说明
modelstring补全模型 ID
promptstring|array输入前缀或文本
suffixstringFIM 后缀
max_tokensnumber最大输出 tokens

错误码

CodeHTTP信息处理建议
unauthorized401API Key 无效或缺失检查 Authorization: Bearer <API_KEY>。
前往 Try it
POST/v1/embeddingsBearer

向量嵌入

将文本转换为向量表示。

请求示例

{
  "model": "bge-m3",
  "input": ["batch inference", "retrieval augmented generation"]
}

响应示例

{
  "object": "list",
  "data": [
    {"index":0,"embedding":[0.012,-0.043,...]},
    {"index":1,"embedding":[0.021,-0.011,...]}
  ]
}

代码示例

import os
import requests

headers = {}
headers["Authorization"] = f"Bearer {os.environ['BATCHIN_API_KEY']}"
headers["Content-Type"] = "application/json"
response = requests.request(
    "POST",
    "https://api.luminapath.tech/v1/embeddings",
    headers=headers,
    json={
  "model": "bge-m3",
  "input": ["batch inference", "retrieval augmented generation"]
}
)

print(response.json())

参数表

NameType必填说明
modelstring嵌入模型 ID
inputstring|array待向量化文本

错误码

CodeHTTP信息处理建议
unauthorized401API Key 无效或缺失检查 Authorization: Bearer <API_KEY>。
前往 Try it
POST/v1/audio/speechBearer

语音合成

使用 CosyVoice / TTS 模型把文本转换为音频响应。

请求示例

{
  "model": "cosyvoice",
  "input": "Welcome to BatchIn",
  "voice": "alloy",
  "response_format": "mp3"
}

响应示例

Binary audio payload (audio/mpeg)

代码示例

import os
import requests

headers = {}
headers["Authorization"] = f"Bearer {os.environ['BATCHIN_API_KEY']}"
headers["Content-Type"] = "application/json"
response = requests.request(
    "POST",
    "https://api.luminapath.tech/v1/audio/speech",
    headers=headers,
    json={
  "model": "cosyvoice",
  "input": "Welcome to BatchIn",
  "voice": "alloy",
  "response_format": "mp3"
}
)

print(response.content)

参数表

NameType必填说明
modelstring语音模型 ID
inputstring待合成文本
voicestring音色
response_formatstring返回格式

错误码

CodeHTTP信息处理建议
unauthorized401API Key 无效或缺失检查 Authorization: Bearer <API_KEY>。
前往 Try it
POST/v1/video/generateBearer

视频生成

使用 Wan 2.2 等模型发起视频生成任务。

请求示例

{
  "model": "wan-2.2",
  "prompt": "Create a product teaser for an AI cloud launch",
  "duration_seconds": 6
}

响应示例

{
  "id": "video_xxx",
  "object": "video.generation",
  "status": "queued",
  "duration_seconds": 6,
  "output_url": "https://cdn.luminapath.tech/mock/video_xxx.mp4"
}

代码示例

import os
import requests

headers = {}
headers["Authorization"] = f"Bearer {os.environ['BATCHIN_API_KEY']}"
headers["Content-Type"] = "application/json"
response = requests.request(
    "POST",
    "https://api.luminapath.tech/v1/video/generate",
    headers=headers,
    json={
  "model": "wan-2.2",
  "prompt": "Create a product teaser for an AI cloud launch",
  "duration_seconds": 6
}
)

print(response.json())

参数表

NameType必填说明
modelstring视频模型 ID
promptstring视频提示词
duration_secondsnumber视频秒数
aspect_ratiostring画幅比例

错误码

CodeHTTP信息处理建议
unauthorized401API Key 无效或缺失检查 Authorization: Bearer <API_KEY>。
前往 Try it
POST/v1/images/generationsBearer

图像生成

文本生成图像。

请求示例

{
  "model": "flux-schnell",
  "prompt": "A futuristic city at sunrise",
  "size": "1024x1024"
}

响应示例

{
  "created": 1775671200,
  "data": [{"url":"https://luminapath.tech/images/generated/abc.png"}]
}

代码示例

import os
import requests

headers = {}
headers["Authorization"] = f"Bearer {os.environ['BATCHIN_API_KEY']}"
headers["Content-Type"] = "application/json"
response = requests.request(
    "POST",
    "https://api.luminapath.tech/v1/images/generations",
    headers=headers,
    json={
  "model": "flux-schnell",
  "prompt": "A futuristic city at sunrise",
  "size": "1024x1024"
}
)

print(response.json())

参数表

NameType必填说明
modelstring图像模型 ID
promptstring图像提示词
sizestring输出尺寸

错误码

CodeHTTP信息处理建议
unauthorized401API Key 无效或缺失检查 Authorization: Bearer <API_KEY>。
前往 Try it
GET/v1/models公开

模型列表

返回模型状态、价格、上下文与许可证信息。

请求示例

{}

响应示例

{
  "object": "list",
  "data": [
    {
      "id":"qwen3-32b",
      "status":"always_on",
      "context_length":131072,
      "pricing":{"std_input":0.02,"std_output":0.08}
    }
  ]
}

代码示例

import os
import requests

headers = {}
response = requests.request(
    "GET",
    "https://api.luminapath.tech/v1/models",
    headers=headers,
    
)

print(response.json())

参数表

NameType必填说明
无参数

错误码

CodeHTTP信息处理建议
service_unavailable503模型服务不可用查看状态页并稍后重试。
前往 Try it
POST/v1/batchesBearer

创建批处理

提交批处理任务(支持混合模型与优先级)。

请求示例

{
  "priority": "fill",
  "webhook_url": "https://luminapath.tech/webhooks/batchin",
  "tasks": [
    {"custom_id":"task-1","model":"qwen3-32b","request_body":{"messages":[{"role":"user","content":"translate this"}]}},
    {"custom_id":"task-2","model":"deepseek-r1","request_body":{"messages":[{"role":"user","content":"summarize this"}]}}
  ]
}

响应示例

{
  "id":"0b0db2a6-0baf-4ec4-a5e7-bce60da57db6",
  "status":"pending",
  "priority":"fill",
  "total_tasks":2,
  "completed_tasks":0,
  "failed_tasks":0
}

代码示例

import os
import requests

headers = {}
headers["Authorization"] = f"Bearer {os.environ['BATCHIN_API_KEY']}"
headers["Content-Type"] = "application/json"
response = requests.request(
    "POST",
    "https://api.luminapath.tech/v1/batches",
    headers=headers,
    json={
  "priority": "fill",
  "webhook_url": "https://luminapath.tech/webhooks/batchin",
  "tasks": [
    {"custom_id":"task-1","model":"qwen3-32b","request_body":{"messages":[{"role":"user","content":"translate this"}]}},
    {"custom_id":"task-2","model":"deepseek-r1","request_body":{"messages":[{"role":"user","content":"summarize this"}]}}
  ]
}
)

print(response.json())

参数表

NameType必填说明
tasksarray任务数组(每项可指定 model)
prioritystring(high|low|fill)调度优先级
webhook_urlstring(url)回调地址

错误码

CodeHTTP信息处理建议
unauthorized401API Key 无效或缺失检查 Authorization: Bearer <API_KEY>。
payload_too_large413批任务 JSON 超过 2MB拆分批次或减少单批任务数。
前往 Try it
GET/v1/batchesBearer

列出批处理

列出当前用户批处理任务。

请求示例

{}

响应示例

[
  {
    "id":"0b0db2a6-0baf-4ec4-a5e7-bce60da57db6",
    "status":"completed",
    "priority":"fill",
    "total_tasks":2,
    "completed_tasks":2,
    "failed_tasks":0
  }
]

代码示例

import os
import requests

headers = {}
headers["Authorization"] = f"Bearer {os.environ['BATCHIN_API_KEY']}"
response = requests.request(
    "GET",
    "https://api.luminapath.tech/v1/batches",
    headers=headers,
    
)

print(response.json())

参数表

NameType必填说明
无参数

错误码

CodeHTTP信息处理建议
unauthorized401API Key 无效或缺失检查 Authorization: Bearer <API_KEY>。
前往 Try it
GET/v1/batches/{id}Bearer

获取批处理详情

获取批处理任务与子任务详情。

请求示例

{}

响应示例

{
  "id":"0b0db2a6-0baf-4ec4-a5e7-bce60da57db6",
  "status":"completed",
  "tasks":[{"custom_id":"task-1","status":"completed"}]
}

代码示例

import os
import requests

headers = {}
headers["Authorization"] = f"Bearer {os.environ['BATCHIN_API_KEY']}"
response = requests.request(
    "GET",
    "https://api.luminapath.tech/v1/batches/{id}",
    headers=headers,
    
)

print(response.json())

参数表

NameType必填说明
idpath:uuid批处理 ID

错误码

CodeHTTP信息处理建议
unauthorized401API Key 无效或缺失检查 Authorization: Bearer <API_KEY>。
not_found404批处理不存在确认 batch id 是否正确。
前往 Try it
POST/v1/batches/{id}/cancelBearer

取消批处理

取消进行中的批处理任务。

请求示例

{}

响应示例

{
  "id":"0b0db2a6-0baf-4ec4-a5e7-bce60da57db6",
  "status":"cancelled"
}

代码示例

import os
import requests

headers = {}
headers["Authorization"] = f"Bearer {os.environ['BATCHIN_API_KEY']}"
response = requests.request(
    "POST",
    "https://api.luminapath.tech/v1/batches/{id}/cancel",
    headers=headers,
    
)

print(response.json())

参数表

NameType必填说明
idpath:uuid批处理 ID

错误码

CodeHTTP信息处理建议
unauthorized401API Key 无效或缺失检查 Authorization: Bearer <API_KEY>。
前往 Try it
POST/v1/topup/stripe/checkoutBearer

创建 Stripe Checkout

创建充值支付会话。

请求示例

{
  "amount_cents": 5000
}

响应示例

{
  "checkout_url":"https://buy.stripe.com/9B65kD4US2fLeEF4zweME00",
  "session_id":"cs_test_xxx"
}

代码示例

import os
import requests

headers = {}
headers["Authorization"] = f"Bearer {os.environ['BATCHIN_API_KEY']}"
headers["Content-Type"] = "application/json"
response = requests.request(
    "POST",
    "https://api.luminapath.tech/v1/topup/stripe/checkout",
    headers=headers,
    json={
  "amount_cents": 5000
}
)

print(response.json())

参数表

NameType必填说明
amount_centsnumber充值金额(美分)

错误码

CodeHTTP信息处理建议
unauthorized401API Key 无效或缺失检查 Authorization: Bearer <API_KEY>。
前往 Try it
GET/v1/topup/historyBearer

充值历史

查询充值记录。

请求示例

{}

响应示例

[
  {
    "id":"1544d6df-8fca-46f3-9091-95f81dc37efa",
    "amount_cents":5000,
    "source":"stripe",
    "reference_id":"cs_test_xxx"
  }
]

代码示例

import os
import requests

headers = {}
headers["Authorization"] = f"Bearer {os.environ['BATCHIN_API_KEY']}"
response = requests.request(
    "GET",
    "https://api.luminapath.tech/v1/topup/history",
    headers=headers,
    
)

print(response.json())

参数表

NameType必填说明
无参数

错误码

CodeHTTP信息处理建议
unauthorized401API Key 无效或缺失检查 Authorization: Bearer <API_KEY>。
前往 Try it
GET/v1/topup/usdc/chainsBearer

USDC 链路信息

获取 USDC 充值链与地址。

请求示例

{}

响应示例

{
  "chains":[
    {"chain":"ethereum","deposit_address":"0x...","required_confirmations":12},
    {"chain":"polygon","deposit_address":"0x...","required_confirmations":12}
  ]
}

代码示例

import os
import requests

headers = {}
headers["Authorization"] = f"Bearer {os.environ['BATCHIN_API_KEY']}"
response = requests.request(
    "GET",
    "https://api.luminapath.tech/v1/topup/usdc/chains",
    headers=headers,
    
)

print(response.json())

参数表

NameType必填说明
无参数

错误码

CodeHTTP信息处理建议
unauthorized401API Key 无效或缺失检查 Authorization: Bearer <API_KEY>。
前往 Try it
GET/v1/usage/logs?limit=50&offset=0Bearer

使用日志

查询请求级别使用日志。

请求示例

{}

响应示例

[
  {
    "id":"e73f9476-00ea-491f-ba6f-899602247a15",
    "model":"qwen3-32b",
    "input_tokens":120,
    "output_tokens":88,
    "cost_cents":2
  }
]

代码示例

import os
import requests

headers = {}
headers["Authorization"] = f"Bearer {os.environ['BATCHIN_API_KEY']}"
response = requests.request(
    "GET",
    "https://api.luminapath.tech/v1/usage/logs?limit=50&offset=0",
    headers=headers,
    
)

print(response.json())

参数表

NameType必填说明
limitquery:number返回条数(1-500)
offsetquery:number偏移量

错误码

CodeHTTP信息处理建议
unauthorized401API Key 无效或缺失检查 Authorization: Bearer <API_KEY>。
前往 Try it
GET/v1/usage/summaryBearer

用量汇总

获取总请求、tokens 与成本统计。

请求示例

{}

响应示例

{
  "total_requests": 1304,
  "total_input_tokens": 2341122,
  "total_output_tokens": 1111400,
  "total_cost_cents": 18640
}

代码示例

import os
import requests

headers = {}
headers["Authorization"] = f"Bearer {os.environ['BATCHIN_API_KEY']}"
response = requests.request(
    "GET",
    "https://api.luminapath.tech/v1/usage/summary",
    headers=headers,
    
)

print(response.json())

参数表

NameType必填说明
无参数

错误码

CodeHTTP信息处理建议
unauthorized401API Key 无效或缺失检查 Authorization: Bearer <API_KEY>。
payment_required402API Key 月预算已超限提高月预算或更换 key。
前往 Try it
GET/v1/usage/by-modelBearer

按模型聚合

按模型维度统计用量。

请求示例

{}

响应示例

[
  {
    "model":"qwen3-32b",
    "total_requests": 880,
    "total_input_tokens": 1620012,
    "total_output_tokens": 801202,
    "total_cost_cents": 9900
  }
]

代码示例

import os
import requests

headers = {}
headers["Authorization"] = f"Bearer {os.environ['BATCHIN_API_KEY']}"
response = requests.request(
    "GET",
    "https://api.luminapath.tech/v1/usage/by-model",
    headers=headers,
    
)

print(response.json())

参数表

NameType必填说明
无参数

错误码

CodeHTTP信息处理建议
unauthorized401API Key 无效或缺失检查 Authorization: Bearer <API_KEY>。
前往 Try it
POST/v1/auditBearer

创建审计记录

创建可验证审计记录并返回签名。

请求示例

{
  "input_text": "What is a zero-knowledge proof?",
  "output_text": "A cryptographic method...",
  "model_id": "qwen3-32b",
  "gpu_id": "gpu-42"
}

响应示例

{
  "audit_id":"ee3cc19e-710d-4a2d-bf01-0edca0c5fdf4",
  "input_hash":"9a5f...",
  "output_hash":"2f1b...",
  "signature":"bfc4..."
}

代码示例

import os
import requests

headers = {}
headers["Authorization"] = f"Bearer {os.environ['BATCHIN_API_KEY']}"
headers["Content-Type"] = "application/json"
response = requests.request(
    "POST",
    "https://api.luminapath.tech/v1/audit",
    headers=headers,
    json={
  "input_text": "What is a zero-knowledge proof?",
  "output_text": "A cryptographic method...",
  "model_id": "qwen3-32b",
  "gpu_id": "gpu-42"
}
)

print(response.json())

参数表

NameType必填说明
input_textstring输入文本
output_textstring输出文本
model_idstring模型 ID
gpu_idstringGPU 标识

错误码

CodeHTTP信息处理建议
unauthorized401API Key 无效或缺失检查 Authorization: Bearer <API_KEY>。
前往 Try it
GET/v1/audit/{id}公开

查询审计记录

按 audit_id 获取审计详情。

请求示例

{}

响应示例

{
  "audit_id":"ee3cc19e-710d-4a2d-bf01-0edca0c5fdf4",
  "input_hash":"9a5f...",
  "output_hash":"2f1b...",
  "signature":"bfc4..."
}

代码示例

import os
import requests

headers = {}
response = requests.request(
    "GET",
    "https://api.luminapath.tech/v1/audit/{id}",
    headers=headers,
    
)

print(response.json())

参数表

NameType必填说明
idpath:uuid审计 ID

错误码

CodeHTTP信息处理建议
not_found404审计记录不存在检查 audit_id。
前往 Try it
GET/v1/audit/{id}/verify公开

验证审计签名

验证审计记录签名是否合法。

请求示例

{}

响应示例

{
  "audit_id":"ee3cc19e-710d-4a2d-bf01-0edca0c5fdf4",
  "valid": true
}

代码示例

import os
import requests

headers = {}
response = requests.request(
    "GET",
    "https://api.luminapath.tech/v1/audit/{id}/verify",
    headers=headers,
    
)

print(response.json())

参数表

NameType必填说明
idpath:uuid审计 ID

错误码

CodeHTTP信息处理建议
前往 Try it
GET/v1/audit/pubkey/current公开

获取当前公钥

获取浏览器验签所需公钥。

请求示例

{}

响应示例

{
  "verify_key_hex":"1fbd9285..."
}

代码示例

import os
import requests

headers = {}
response = requests.request(
    "GET",
    "https://api.luminapath.tech/v1/audit/pubkey/current",
    headers=headers,
    
)

print(response.json())

参数表

NameType必填说明
无参数

错误码

CodeHTTP信息处理建议
前往 Try it
GET/health公开

系统健康检查

服务健康状态探活端点。

请求示例

{}

响应示例

{
  "status":"ok"
}

代码示例

import os
import requests

headers = {}
response = requests.request(
    "GET",
    "https://api.luminapath.tech/health",
    headers=headers,
    
)

print(response.json())

参数表

NameType必填说明
无参数

错误码

CodeHTTP信息处理建议
前往 Try it

教程

Batch 教程

  1. 上传 JSONL 输入文件(每行一个任务)。
  2. 创建 batch 任务并记录 batch_id。
  3. 轮询状态,完成后下载输出文件。

VaaS 教程

  1. 发送文本到 /v1/audit。
  2. 根据 risk_score 设置阈值策略。
  3. 将决策链路接入审核日志。

Cookbook

百万文档 Batch 处理流水线

将 1,000,000 条文档拆分为 JSONL 任务,按优先级分批处理并自动回调入库。

生产级 RAG 管线

组合 Embeddings + 检索 + 重排序 + 生成,构建可观测、可回滚的问答系统。

VaaS 审计一体化接入

在输入、输出、人工复核三个节点写入审计证据,并完成 Ed25519 验签。

更新日志

  • 2026-04-08Console 体验升级

    Playground 新增 Python ZIP 导出、只读分享链接;通知中心改为真实 API 聚合。

  • 2026-04-07文档体系增强

    新增完整端点参数/错误码表、Batch 与 VaaS 教程、Try it 控制台跳转。

  • 2026-04-06安全与鉴权加固

    上线会话签名、双层鉴权、CORS 生产收敛与未知模型计费拒绝策略。