Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including tss-capi with all npm packages installed. Try it out:

var tssCapi = require("tss-capi")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

tss-capi v0.2.5

Tencent cloud api sdk

Tencent Cound API

This is a basement api tool for all tencent cloud apis.


Capi is the only class for create a client request instance, and the instance only has one method request. You can use it like below:

import { Capi } from 'tss-capi';

const client = new Capi({
  Region: 'ap-guangzhou',
  SecretId: 'Please input your SecretId',
  SecretKey: 'Please input your SecretKey',
  ServiceType: 'tmt',
try {
  const res = await client.request(
      Action: 'TextTranslate',
      Version: '2018-03-21',
      SourceText: 'hello',
      Source: 'auto',
      Target: 'zh',
      ProjectId: 0,
      debug: true,
      host: '',
  console.log('res', res);
} catch (e) {

This is a demo for using Tencent Machine Translator.


const client = new Capi(CapiOptions)
client.request(RequestData, RequestOptions, isV3)

CapiOptions for Capi Constructor

ServiceTypetencent service typestringtrue''
Regionrequest regionstringtrueap-guangzhou
SecretIdtencent account secret idstringtrue''
SecretKeytencenttencent account secret keystringtrue''
debugwhether enable log debug infobooleanfalsefalse
hostrequest hoststringfalsefalse
baseHostrequest domainstringfalse''
pathrequest pathstringfalse'/'
methodrequest methodstringfalse'POST'
protocolrequest protocolstringfalse'https'
SignatureMethodrequest signaturestringfalse'sha1'

RequestData for reqeust method

Actionapi actionstringtrue''
Versionapi versionstringtrue'2018-03-21'
RequestClientspecify your servicestringfalse'TSS-CAPI'
[propName]left api parametersanyfalse''

RequestOptions for reqeust method

It is a copy from CapiOptions, if you set this, you can rewrite the properties in CapiOptions.

isV3 for request method

isV3 is used to specify to use version for authentication.

true: using TC3-HMAC-SHA256
false: using HmacSHA256 or Sha1



RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free