# AI Translator, Summarizer & Rewriter (`jungle_synthesizer/ai-content-translator-summarizer`) Actor

Transform any URL or text — translate, summarize, rewrite, extract key points, or TL;DR. URL inputs auto-extract to clean text. BYO model via OpenRouter. Token + cost accounting in every dataset row. Local cache for repeat inputs.

- **URL**: https://apify.com/jungle\_synthesizer/ai-content-translator-summarizer.md
- **Developed by:** [BowTiedRaccoon](https://apify.com/jungle_synthesizer) (community)
- **Categories:** AI, Automation
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, NaN bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## AI Translator, Summarizer & Rewriter

Transform any URL or raw text through five AI-powered modes: **translate**, **summarize**, **rewrite**, **extract-key-points**, and **tldr**. URL inputs are automatically fetched and extracted to clean text before processing. Every dataset row includes token counts and vendor cost, so you know exactly what each operation cost.

### What it does

- **Translate** — Render text in any language. Provide an ISO 639-1 code or a language name.
- **Summarize** — Condense content in formal, casual, technical, marketing, or SEO style.
- **Rewrite** — Reword content in a chosen style while preserving length and meaning.
- **Extract key points** — Produce a bulleted list of the core ideas.
- **TL;DR** — One-paragraph summary of any length content.

URL inputs go through a full fetch + article extraction pipeline to strip navigation, ads, and boilerplate before the AI call. Raw text inputs are processed directly.

### Input

| Field | Required | Description |
|-------|----------|-------------|
| `inputs` | Yes | Array of objects. Each must have `url` or `text` (or both). Optional `language` field for source language hint. |
| `openrouterApiKey` | Yes | Your OpenRouter API key (`sk-or-...`). Get a free key at [openrouter.ai](https://openrouter.ai). |
| `mode` | No | `translate` (default), `summarize`, `rewrite`, `extract-key-points`, `tldr`. |
| `targetLanguage` | Required when mode=translate | ISO 639-1 code (e.g. `es`) or language name (e.g. `French`). |
| `style` | No | `formal` (default), `casual`, `technical`, `marketing`, `seo`. Applies to summarize and rewrite modes. |
| `model` | No | OpenRouter model ID. Default: `openai/gpt-4o-mini`. Options: `openai/gpt-4o`, `anthropic/claude-3.5-haiku`, `anthropic/claude-3.5-sonnet`, `google/gemini-flash-1.5`, `mistralai/mistral-small`. |
| `maxOutputTokens` | No | Maximum response length per input. Default: 1024. |
| `useCache` | No | Cache results by input hash (7-day TTL). Identical inputs return instantly without consuming tokens. Default: true. |
| `maxItems` | No | Cap on number of inputs to process. Default: 15. |

#### Example input

```json
{
  "inputs": [
    { "url": "https://example.com/article" },
    { "text": "The quick brown fox jumps over the lazy dog." }
  ],
  "mode": "translate",
  "targetLanguage": "es",
  "model": "openai/gpt-4o-mini",
  "openrouterApiKey": "sk-or-your-key-here"
}
````

### Output

Each input item produces one dataset row:

| Field | Type | Description |
|-------|------|-------------|
| `input` | object | Original input item |
| `mode` | string | Operation mode used |
| `model` | string | OpenRouter model ID |
| `output` | string | Transformed content |
| `inputTokens` | number | Tokens consumed by the prompt |
| `outputTokens` | number | Tokens consumed by the completion |
| `costUsd` | number | Vendor cost in USD for this record |
| `cached` | boolean | True when served from local cache |
| `extractedFromUrl` | boolean | True when a URL was fetched and extracted |
| `sourceLanguage` | string | Source language |
| `targetLanguage` | string | Target language (translate mode only) |
| `status` | string | `success` or `error` |
| `errorMsg` | string | Error detail on failure |

#### Example output row

```json
{
  "input": { "url": "https://example.com/article" },
  "mode": "translate",
  "model": "openai/gpt-4o-mini",
  "output": "El rápido zorro marrón salta sobre el perro perezoso.",
  "inputTokens": 312,
  "outputTokens": 298,
  "costUsd": 0.00000918,
  "cached": false,
  "extractedFromUrl": true,
  "sourceLanguage": "en",
  "targetLanguage": "es",
  "status": "success",
  "errorMsg": null
}
```

### OpenRouter API key

This actor calls the OpenRouter API using your own key. OpenRouter provides a unified gateway to 200+ LLM models from OpenAI, Anthropic, Google, Mistral, and others.

1. Sign up for free at [openrouter.ai](https://openrouter.ai)
2. Create an API key in your dashboard
3. Add credits (pay-as-you-go starting from a few dollars)
4. Paste the key into the `openrouterApiKey` field

The actor passes your key directly to the OpenRouter API. No keys are stored. Costs are charged to your OpenRouter account balance.

### Model selection

| Model | Best for | Cost |
|-------|----------|------|
| `openai/gpt-4o-mini` | Fast, cheap, good quality (default) | Very low |
| `google/gemini-flash-1.5` | Fastest option | Very low |
| `mistralai/mistral-small` | European languages | Low |
| `anthropic/claude-3.5-haiku` | Nuanced rewrites | Low |
| `openai/gpt-4o` | Highest quality | Medium |
| `anthropic/claude-3.5-sonnet` | Complex content | Medium |

For most translation and summarization tasks, `gpt-4o-mini` gives excellent results at minimal cost.

### Caching

When `useCache` is enabled (default), results are cached using a SHA-256 hash of the input text, mode, target language, model, and style. A cache hit returns the stored output immediately with zero LLM calls. The cache TTL is 7 days.

### Concurrency and rate limits

The actor processes up to 10 inputs in parallel. On rate limit responses (HTTP 429), the actor backs off exponentially with jitter and retries up to 5 times before recording an error for that item. Remaining inputs continue processing.

### Error handling

Failed inputs produce a dataset row with `status: "error"` and an `errorMsg`. The actor continues processing remaining inputs. Common error causes:

- Invalid or missing API key
- URL unreachable or extraction returned empty content
- OpenRouter model quota exceeded
- `targetLanguage` missing when `mode` is `translate`

# Actor input Schema

## `sp_intended_usage` (type: `string`):

Please describe how you plan to use the data extracted by this crawler.

## `sp_improvement_suggestions` (type: `string`):

Provide any feedback or suggestions for improvements.

## `sp_contact` (type: `string`):

Provide your email address so we can get in touch with you.

## `inputs` (type: `array`):

Array of objects with either url or text field (or both). Example: \[{"url": "https://example.com"}, {"text": "Hello world"}]

## `mode` (type: `string`):

No description

## `targetLanguage` (type: `string`):

ISO 639-1 code or language name (e.g. 'es', 'French'). Required when mode is translate.

## `style` (type: `string`):

No description

## `maxOutputTokens` (type: `integer`):

Cap on response length per input.

## `model` (type: `string`):

No description

## `openrouterApiKey` (type: `string`):

Your OpenRouter API key (sk-or-...). Get one at openrouter.ai. Required.

## `useCache` (type: `boolean`):

Cache results by input hash. Identical inputs return instantly on re-run without consuming tokens.

## `maxItems` (type: `integer`):

Maximum number of inputs to process. Set to limit costs on large batches.

## Actor input object example

```json
{
  "sp_intended_usage": "Describe your intended use...",
  "sp_improvement_suggestions": "Share your suggestions here...",
  "sp_contact": "Share your email here...",
  "inputs": [
    {
      "url": "https://apify.com/about"
    }
  ],
  "mode": "translate",
  "targetLanguage": "es",
  "style": "formal",
  "maxOutputTokens": 1024,
  "model": "openai/gpt-4o-mini",
  "useCache": true,
  "maxItems": 5
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "sp_intended_usage": "Describe your intended use...",
    "sp_improvement_suggestions": "Share your suggestions here...",
    "sp_contact": "Share your email here...",
    "inputs": [
        {
            "url": "https://apify.com/about"
        }
    ],
    "mode": "translate",
    "targetLanguage": "es",
    "style": "formal",
    "maxOutputTokens": 1024,
    "model": "openai/gpt-4o-mini",
    "useCache": true,
    "maxItems": 5
};

// Run the Actor and wait for it to finish
const run = await client.actor("jungle_synthesizer/ai-content-translator-summarizer").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "sp_intended_usage": "Describe your intended use...",
    "sp_improvement_suggestions": "Share your suggestions here...",
    "sp_contact": "Share your email here...",
    "inputs": [{ "url": "https://apify.com/about" }],
    "mode": "translate",
    "targetLanguage": "es",
    "style": "formal",
    "maxOutputTokens": 1024,
    "model": "openai/gpt-4o-mini",
    "useCache": True,
    "maxItems": 5,
}

# Run the Actor and wait for it to finish
run = client.actor("jungle_synthesizer/ai-content-translator-summarizer").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "sp_intended_usage": "Describe your intended use...",
  "sp_improvement_suggestions": "Share your suggestions here...",
  "sp_contact": "Share your email here...",
  "inputs": [
    {
      "url": "https://apify.com/about"
    }
  ],
  "mode": "translate",
  "targetLanguage": "es",
  "style": "formal",
  "maxOutputTokens": 1024,
  "model": "openai/gpt-4o-mini",
  "useCache": true,
  "maxItems": 5
}' |
apify call jungle_synthesizer/ai-content-translator-summarizer --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=jungle_synthesizer/ai-content-translator-summarizer",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "AI Translator, Summarizer & Rewriter",
        "description": "Transform any URL or text — translate, summarize, rewrite, extract key points, or TL;DR. URL inputs auto-extract to clean text. BYO model via OpenRouter. Token + cost accounting in every dataset row. Local cache for repeat inputs.",
        "version": "1.0",
        "x-build-id": "w8DiU1Kgz1Z0Kfc3O"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/jungle_synthesizer~ai-content-translator-summarizer/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-jungle_synthesizer-ai-content-translator-summarizer",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/jungle_synthesizer~ai-content-translator-summarizer/runs": {
            "post": {
                "operationId": "runs-sync-jungle_synthesizer-ai-content-translator-summarizer",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/jungle_synthesizer~ai-content-translator-summarizer/run-sync": {
            "post": {
                "operationId": "run-sync-jungle_synthesizer-ai-content-translator-summarizer",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "sp_intended_usage",
                    "sp_improvement_suggestions",
                    "inputs",
                    "openrouterApiKey"
                ],
                "properties": {
                    "sp_intended_usage": {
                        "title": "What is the intended usage of this data?",
                        "minLength": 1,
                        "type": "string",
                        "description": "Please describe how you plan to use the data extracted by this crawler."
                    },
                    "sp_improvement_suggestions": {
                        "title": "How can we improve this crawler for you?",
                        "minLength": 1,
                        "type": "string",
                        "description": "Provide any feedback or suggestions for improvements."
                    },
                    "sp_contact": {
                        "title": "Contact Email",
                        "minLength": 1,
                        "type": "string",
                        "description": "Provide your email address so we can get in touch with you."
                    },
                    "inputs": {
                        "title": "Inputs",
                        "type": "array",
                        "description": "Array of objects with either url or text field (or both). Example: [{\"url\": \"https://example.com\"}, {\"text\": \"Hello world\"}]"
                    },
                    "mode": {
                        "title": "Mode",
                        "enum": [
                            "translate",
                            "summarize",
                            "rewrite",
                            "extract-key-points",
                            "tldr"
                        ],
                        "type": "string",
                        "description": "",
                        "default": "translate"
                    },
                    "targetLanguage": {
                        "title": "Target Language",
                        "type": "string",
                        "description": "ISO 639-1 code or language name (e.g. 'es', 'French'). Required when mode is translate.",
                        "default": ""
                    },
                    "style": {
                        "title": "Style",
                        "enum": [
                            "formal",
                            "casual",
                            "technical",
                            "marketing",
                            "seo"
                        ],
                        "type": "string",
                        "description": "",
                        "default": "formal"
                    },
                    "maxOutputTokens": {
                        "title": "Max Output Tokens",
                        "type": "integer",
                        "description": "Cap on response length per input.",
                        "default": 1024
                    },
                    "model": {
                        "title": "Model",
                        "enum": [
                            "openai/gpt-4o-mini",
                            "openai/gpt-4o",
                            "anthropic/claude-3.5-haiku",
                            "anthropic/claude-3.5-sonnet",
                            "google/gemini-flash-1.5",
                            "mistralai/mistral-small"
                        ],
                        "type": "string",
                        "description": "",
                        "default": "openai/gpt-4o-mini"
                    },
                    "openrouterApiKey": {
                        "title": "OpenRouter API Key",
                        "type": "string",
                        "description": "Your OpenRouter API key (sk-or-...). Get one at openrouter.ai. Required."
                    },
                    "useCache": {
                        "title": "Use Cache",
                        "type": "boolean",
                        "description": "Cache results by input hash. Identical inputs return instantly on re-run without consuming tokens.",
                        "default": true
                    },
                    "maxItems": {
                        "title": "Max Items",
                        "type": "integer",
                        "description": "Maximum number of inputs to process. Set to limit costs on large batches.",
                        "default": 15
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
