JSON

App 导出、CLI 与网关 API 同一个 JSON 形态。

概览

本地网关 127.0.0.1:1117,OpenAI 兼容,用 App 内展示的 Bearer key 鉴权。语音端点返回同一个 JSON 形态——与桌面端「导出 JSON」和 edgespeak-cli 的 JSON 输出完全一致。

POST /v1/audio/transcriptions  →  {task:"transcribe", duration, language?, text, segments[], usage}
POST /v1/audio/alignments      →  {task:"align", duration, text, segments[], usage}
POST /v1/text/segmentations    →  {task:"segment", text, segments[]}
GET  /v1/models                →  {object:"list", data[]}

POST /v1/audio/transcriptions

Multipart 上传。response_format=verbose_json 加 timestamp_granularities[]=word 返回词级时间戳。桌面端「导出 JSON」与 edgespeak-cli transcribe 输出的就是这个响应。

curl http://127.0.0.1:1117/v1/audio/transcriptions \
  -H "Authorization: Bearer sk-edgespeak-..." \
  -F file=@meeting.m4a \
  -F model="lattice-2-flash" \
  -F response_format=verbose_json \
  -F "timestamp_granularities[]=word"

{
  "task": "transcribe",
  "duration": 19.69,
  "language": "English",
  "text": "EdgeSpeak AI is a high-performance engine ...",
  "segments": [
    {
      "id": 0,
      "start": 0.0,
      "end": 6.44,
      "text": "EdgeSpeak AI is a high-performance engine designed for ...",
      "words": [
        { "word": "EdgeSpeak", "start": 0.22, "end": 0.64, "score": 0.991 }
      ]
    }
  ],
  "usage": { "type": "duration", "seconds": 19.69 }
}

POST /v1/audio/alignments

强制对齐:给定文稿,引擎只找时间。参考文本放 text 字段,或 text_path——本机绝对路径,由网关直接读取。响应恒无 language 键;score 是 [0, 1] 置信度。

curl http://127.0.0.1:1117/v1/audio/alignments \
  -H "Authorization: Bearer sk-edgespeak-..." \
  -F file=@meeting.m4a \
  -F text="LattifAI is a high performance engine ..."

{
  "task": "align",
  "duration": 19.6909375,
  "text": "LattifAI is a high performance engine ...",
  "segments": [
    {
      "id": 0,
      "start": 0.22,
      "end": 19.52,
      "text": "LattifAI is a high performance engine ...",
      "words": [
        { "word": "LattifAI", "start": 0.22, "end": 1.04, "score": 0.8463 }
      ]
    }
  ],
  "usage": { "type": "duration", "seconds": 19.6909375 }
}

POST /v1/text/segmentations

语义分句,JSON 请求体:纯文本用 text,带时间戳用 segments[]。纯文本输入的句子不含 start 和 end;speaker、start、end 只在输入携带时出现。可选 threshold (默认 0.35)、min_chars、max_chars。

curl http://127.0.0.1:1117/v1/text/segmentations \
  -H "Authorization: Bearer sk-edgespeak-..." \
  -H "Content-Type: application/json" \
  -d '{"text": "LattifAI is a high-performance engine designed for the structuring of audio and video content assets. It runs entirely on local compute, ensuring your data security."}'

{
  "task": "segment",
  "text": "LattifAI is a high-performance engine ... It runs entirely on local compute ...",
  "segments": [
    { "text": "LattifAI is a high-performance engine designed for the structuring of audio and video content assets." },
    { "text": "It runs entirely on local compute, ensuring your data security." }
  ]
}

GET /v1/models

列出可用模型,每条带 x_edgespeak 扩展:capabilities、local、active_for。模型 ID 是运行时返回值,调用方应读取响应,不要硬编码。

curl http://127.0.0.1:1117/v1/models \
  -H "Authorization: Bearer sk-edgespeak-..."

{
  "object": "list",
  "data": [
    {
      "id": "<active-transcription-model>",
      "object": "model",
      "created": 0,
      "owned_by": "EdgeSpeak",
      "x_edgespeak": { "capabilities": ["transcribe"], "local": true, "active_for": ["transcribe"] }
    },
    {
      "id": "<alignment-model>",
      "object": "model",
      "created": 0,
      "owned_by": "EdgeSpeak",
      "x_edgespeak": { "capabilities": ["align"], "local": true, "active_for": [] }
    },
    {
      "id": "<text-segmentation-model>",
      "object": "model",
      "created": 0,
      "owned_by": "EdgeSpeak",
      "x_edgespeak": { "capabilities": ["segment"], "local": true, "active_for": [] }
    }
  ]
}

字段语义

所有时间值单位为秒。segments[] 元素为 {id, start, end, text, words?};词条目 {word, start, end, score?},score 是 [0, 1] 置信度。词级时间戳只挂在 segments[].words 下,没有顶层 words。usage 恒为 {"type": "duration", "seconds": …}。可选键没有数据时整键省略,不写 null。JSON 键序不保证,请按键名取值。