1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "rows": [
12 {
13 "text": "今天的新品很好用 #科技",
14 "demo": true
15 },
16 {
17 "text": "支持中文和英文 🌟",
18 "demo": true
19 },
20 {
21 "text": "物流速度很快",
22 "demo": true
23 },
24 {
25 "text": "这个价格很合适",
26 "demo": true
27 },
28 {
29 "text": "@demo 下次再来 #购物",
30 "demo": true
31 }
32 ],
33 "fields": [
34 "text"
35 ],
36 "targetLanguage": "en",
37 "glossary": {},
38 "batchSize": 5,
39 "includePinyin": true,
40 "scriptMode": "traditional",
41 "detectLanguage": true,
42 "maxItems": 5,
43 "baseUrl": "https://openrouter.ai/api/v1",
44 "model": "deepseek/deepseek-v4-flash",
45 "maxOutputTokens": 768,
46 "maxTotalTokens": 40000,
47 "temperature": 0.2,
48 "maxConcurrency": 1
49};
50
51
52const run = await client.actor("zinin/chinese-social-media-dataset-translator").call(input);
53
54
55console.log('Results from dataset');
56console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
57const { items } = await client.dataset(run.defaultDatasetId).listItems();
58items.forEach((item) => {
59 console.dir(item);
60});
61
62