Bitzsoft.Integrations.Translation.AI.Volcengine 1.0.0

dotnet add package Bitzsoft.Integrations.Translation.AI.Volcengine --version 1.0.0
                    
NuGet\Install-Package Bitzsoft.Integrations.Translation.AI.Volcengine -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Bitzsoft.Integrations.Translation.AI.Volcengine" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Bitzsoft.Integrations.Translation.AI.Volcengine" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="Bitzsoft.Integrations.Translation.AI.Volcengine" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Bitzsoft.Integrations.Translation.AI.Volcengine --version 1.0.0
                    
#r "nuget: Bitzsoft.Integrations.Translation.AI.Volcengine, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Bitzsoft.Integrations.Translation.AI.Volcengine@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Bitzsoft.Integrations.Translation.AI.Volcengine&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=Bitzsoft.Integrations.Translation.AI.Volcengine&version=1.0.0
                    
Install as a Cake Tool

Bitzsoft.Integrations.Translation.AI.Volcengine

火山引擎机器翻译大模型实现包 -- 语音技术网关 matx_translate 端点(豆包大模型翻译专用服务),原生批量(text_list 单次最多 16 条,超出自动分片)与术语直传(corpus.glossary_list,优先于控制台术语表),实现 IAiTranslationProvider 契约。支持 32 语种互译,源语言缺省自动检测并逐条回显。

功能特性

  • 原生批量:TranslateBatchAsync 映射 text_list(单次 ≤16 条),超出自动分片串行并按序回拼
  • 术语直传:请求级 Terms 映射 corpus.glossary_list(源术语 → 目标译法),控制台术语表经 GlossaryTableName 并存引用
  • 检测语种回显:source_language 缺省自动检测,响应逐条回显 detected_source_language 归一化填入 DetectedSourceLanguage
  • 双鉴权:新版控制台 API Key(X-Api-Key 请求头)或旧版控制台 APP ID + Access Token(X-Api-App-Key / X-Api-Access-Key 请求头)
  • 限流退避重试:net8+ 标准韧性 handler(429/503/504 指数退避)
  • 健康探测:最小代价单字符翻译探测(配额 / 限流降级为 Degraded)
  • 请求审计:内置 RequestLogging 管道记录出站请求

安装

dotnet add package Bitzsoft.Integrations.Translation.AI.Volcengine

配置

appsettings.json

{
  "Translation": {
    "Volcengine": {
      "ApiKey": "your-api-key",
      "GlossaryTableName": "legal-terms"
    }
  }
}
配置项 说明 必填 默认值
ApiKey 新版控制台 API Key(X-Api-Key 请求头) 与 AppId + AppSecret 二选一 -
AppId 旧版控制台 APP ID(X-Api-App-Key 请求头) 见上 -
AppSecret 旧版控制台 Access Token(X-Api-Access-Key 请求头) 见上 -
Endpoint 语音技术网关根地址(不含接口路径) 否 https://openspeech.bytedance.com
BaseAddress 网关覆盖(私有化场景替换根地址) 否 -
GlossaryTableName 控制台术语表名(与请求级 Terms 并存,直传优先) 否 空
Timeout / MaxRetryAttempts / RetryBaseDelay 超时与限流退避 否 30s / 3 / 500ms
HttpClientName 命名 HttpClient 标识 否 VolcengineTranslationProvider

固定请求头 X-Api-Resource-Id: volc.speech.mt 与逐请求随机的 X-Api-Request-Id 由实现自动携带。

注册服务

builder.Services.AddBitzsoftVolcengineTranslation(builder.Configuration);

注册后 ITranslationProviderFactory 按编码 volcengine 解析;IIntegrationProviderResolver<IAiTranslationProvider> 亦可按同一编码解析 AI 能力。

使用示例

// 基础契约:原生批量 + 术语直传
var provider = resolver.GetRequired("volcengine");
var result = await provider.TranslateBatchAsync(new TranslationBatchRequest
{
    Texts = new[] { "不可抗力条款", "违约责任条款" },
    SourceLanguage = "zh",
    TargetLanguage = "en",
    Terms = new[] { new TranslationTerm("不可抗力", "force majeure") },
});

支持语种

32 语种(ISO 639-1 / BCP-47):zh、zh-Hant(统一编码 zh-TW 自动映射)、en、ja、ko、fr、de、es、pt、ru、ar、it、nl、pl、ro、sv、da、nb、fi、hu、cs、hr、el、he、tr、uk、th、vi、id、ms、tl、hi。

能力矩阵

能力 支持 说明
单文本翻译 ✅ 单元素 text_list
批量翻译 ✅ 原生批量 text_list ≤16 条 / 次,超出自动分片串行
语言检测 ❌ 无独立接口(自动检测语种经翻译逐条回显)
领域词汇表(Terms) ✅ 原生直传 corpus.glossary_list
控制台术语表 ✅ corpus.glossary_table_name(GlossaryTableName)
风格 / 指令 / 提示词模板 / 温度 ❌ 翻译专用模型无生成参数,相关字段忽略
HTML 格式 ❌ 纯文本翻译
健康探测 ✅ 单字符翻译探测

限制

  • text_list 单次最多 16 条、单条最长 1024 token(载荷超限服务端返回 45000130,收敛为 InvalidArgument)
  • 术语表条目数量与单条 token 上限以官方控制台文档为准

错误码收敛

火山信号 统一错误码
45000001(参数错误) InvalidArgument
45000130(载荷过大:>16 条或单条超限) InvalidArgument
55000001(内部错误,可重试) OperationFailed
HTTP 401 / 403(鉴权类) AuthenticationFailed / AccessDenied
HTTP 429(限流) RateLimited
网络异常 NetworkUnreachable
超时 Timeout

相关包

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Bitzsoft.Integrations.Translation.AI.Volcengine:

Package Downloads
Bitzsoft.Integrations.Translation.All

翻译服务聚合包 — 传统机翻(阿里云 / 百度 / 腾讯云 / 有道 / DeepL / Google 官方)+ AI 翻译(通义 Qwen-MT / 百度大模型 / 火山引擎大模型,OpenAI 兼容 / Anthropic net8+),配置存在性驱动注册

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 56 10/21/2026