You need to enable JavaScript to run this app.
文档中心
火山方舟

火山方舟

复制全文
下载 pdf
分词 API
分词 API
复制全文
下载 pdf
分词 API
POST https://ark.cn-beijing.volces.com/api/v3/tokenization​
对输入的文本进行分词,返回每个 Token 的 ID 和偏移量。仅支持文本输入。​
鉴权​
本接口支持鉴权方式如下,详情请参见 Base URL 及鉴权。​
  • API Key 鉴权,请在 API Key 管理 页面,获取长效 API Key。​
​​
请求参数​
Body 参数​
model string 必选 | 模型 ID​
​
text string / string[] 必选 | 分词内容​
​
user string | 用户标识​
​
​
响应参数​
created integer | 创建时间​
​
data object[] | 分词结果​
​
id string | 请求 ID​
​
model string | 使用的模型​
​
object string | 对象类型​
​
​

Request

curl https://ark.cn-beijing.volces.com/api/v3/tokenization \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $ARK_API_KEY" \
  -d $'{
    "model": "doubao-pro-32k-241215",
    "text": [
        "天空为什么这么蓝",
        "花儿为什么这么香"
    ]
}'

Response

{
  "object": "list",
  "id": "0217441868631536d992e302715172e42d8bf34590a60cadc221f",
  "model": "doubao-pro-32k-241215",
  "data": [
    {
      "object": "tokenization",
      "index": 0,
      "total_tokens": 4,
      "token_ids": [14539, 4752, 5189, 5399],
      "offset_mapping": [
        [0, 2],
        [2, 5],
        [5, 7],
        [7, 8]
      ]
    },
    {
      "object": "tokenization",
      "index": 1,
      "total_tokens": 4,
      "token_ids": [45018, 4752, 5189, 2920],
      "offset_mapping": [
        [0, 2],
        [2, 5],
        [5, 7],
        [7, 8]
      ]
    }
  ],
  "created": 1744186863
}
最近更新时间:2026.09.09 19:08:06
这个页面对您有帮助吗?
有用
有用
无用
无用