API 文档

Navor AI 提供 OpenAI-compatible 网关。网页会员额度用于前台工作区;API credits 用于开发者接口调用,两套额度分开计费。

POST /v1/chat/completions

使用 Bearer API key。当前支持 OpenAI-compatible 非流式聊天补全,配置 DeepSeek key 后走真实调用。

curl
curl http://localhost:3000/v1/chat/completions \
  -H "Authorization: Bearer nv_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v4-flash",
    "messages": [
      {"role": "user", "content": "Write a short product intro"}
    ]
  }'

Node.js

node
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.NAVOR_API_KEY,
  baseURL: "http://localhost:3000/v1"
});

const response = await client.chat.completions.create({
  model: "deepseek-v4-flash",
  messages: [{ role: "user", content: "Write a short product intro" }]
});

console.log(response.choices[0].message.content);

Python

python
from openai import OpenAI

client = OpenAI(
    api_key="nv_live_YOUR_KEY",
    base_url="http://localhost:3000/v1"
)

response = client.chat.completions.create(
    model="deepseek-v4-flash",
    messages=[{"role": "user", "content": "Write a short product intro"}],
)

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

GET /v1/models

返回 Navor AI 当前公开且可选的模型清单。未开通或未配置的上游不会作为可用模型开放给用户。

models
curl http://localhost:3000/v1/models \
  -H "Authorization: Bearer nv_live_YOUR_KEY"

多模态接口

图片、视频、语音和 3D 已经有 API 入口、鉴权、额度预估、调用日志和清晰错误返回。不同上游的可用状态以模型清单和后台健康检查为准。

image
curl http://localhost:3000/v1/images/generations \
  -H "Authorization: Bearer nv_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "doubao-seedream-5-0-260128",
    "prompt": "A clean product render of a futuristic API gateway dashboard",
    "sequential_image_generation": "disabled",
    "response_format": "url",
    "size": "2K",
    "stream": false,
    "watermark": true
  }'
video
curl http://localhost:3000/v1/videos/generations \
  -H "Authorization: Bearer nv_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "doubao-seedance-2-0-260128",
    "prompt": "A short cinematic demo of an AI developer platform",
    "duration": 5,
    "resolution": "720p",
    "ratio": "16:9",
    "generate_audio": true,
    "watermark": false
  }'
video status
curl http://localhost:3000/v1/videos/generations/cgt_YOUR_TASK_ID \
  -H "Authorization: Bearer nv_live_YOUR_KEY"
speech
curl http://localhost:3000/v1/audio/speech \
  -H "Authorization: Bearer nv_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "seed-tts-2.0",
    "input": "Welcome to Navor AI.",
    "voice": "zh_female_vv_uranus_bigtts",
    "format": "mp3"
  }'
3d
curl http://localhost:3000/v1/3d/generations \
  -H "Authorization: Bearer nv_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "hunyuan-3d-3.0",
    "prompt": "A stylized robot assistant for a SaaS product",
    "input_mode": "text"
  }'

额度和扣费

API 调用只消耗 API credits。不同模型、质量、分辨率、时长和任务类型会按 Navor rate card 动态折算。 网页会员套餐的额度只用于 Navor AI 前台工作区,不会和 API 包混用。

rate card
curl http://localhost:3000/v1/rates \
  -H "Authorization: Bearer nv_live_YOUR_KEY"

错误格式

provider_not_configured
{
  "error": {
    "message": "Image generation provider is not configured yet.",
    "type": "navor_api_error",
    "code": "provider_not_configured",
    "request_id": "req_..."
  }
}
invalid_key
{
  "error": {
    "message": "Invalid or revoked API key.",
    "type": "navor_api_error",
    "code": "invalid_api_key",
    "request_id": "req_..."
  }
}