DeepL API Key

DeepL API Key

DeepL API Key-Stewed Noodles 资源
DeepL API Key
此内容为自动售卡,请付费后查看
6
自动售卡
已售 0库存 3
已购卡密

暂无卡密订单

温馨提示:本文最后更新于2024-10-23 09:51:08,某些文章具有时效性,若有错误或已失效,请在下方留言

官方免费API

DeepL翻译API|机器翻译技术

DeepL的API有三个版本:free、pro、企业版。free版本是免费的,但有一些限制。比如,每月最多可以翻译50万字符。个人使用足够了。

API 版本

注册后,即可获得API Key,用于调用API。

注册时,需求填写信用卡信息,但不会扣费。这个卡需要是境外的信用卡,国内的银联卡不行。

API 调用

调用方法很简单,只需要一个HTTP POST请求。或根据官方文档,使用现成的库。以下为一个Node.js的例子:

Translate text | DeepL API Docs

import * as deepl from 'deepl-node';

const authKey = "f63c02c5-f056-..."; // Replace with your key
const translator = new deepl.Translator(authKey);

(async () => {
    const result = await translator.translateText('Hello, world!', null, 'fr');
    console.log(result.text); // Bonjour, le monde !
})();

Deeplx

OwO-Network/DeepLX: DeepL Free API (No TOKEN required)

DeepLX 是一个开源项目,它基于 DeepL 免费服务,将其转换为本地 API,提供给第三次程序使用,如沉浸式翻译、BOb。它不需要 TOKEN,也不需要注册,直接使用。

接口调用

你可以直接调用接口:https://api.deeplx.org/translate

var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");

var raw = JSON.stringify({
  "text": "Hello, world!",
  "source_lang": "auto",
  "target_lang": "ZH"
});

var requestOptions = {
  method: 'POST',
  headers: myHeaders,
  body: raw,
  redirect: 'follow'
};

fetch("https://api.deeplx.org/translate", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Deeplx NPM

你也可以直接使用打包好的NPM包:deeplx – npm
都不用写请求代码,直接调用API。

import { translate } from 'deeplx'

translate('你好', 'NL')
// hello

转自:全世界最好用的免费翻译API:DeepL API

© 版权声明
THE END
喜欢就支持一下吧
点赞14 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容