Documentation menu
Getting started
New in v2.0
Feature deep dives
Reference
AI rewriting
Telegram AI Rewriting with Custom Prompts
Enable or disable LLM rewriting per task, pick a provider, write your own prompts with version history, and keep forwarding even when the model is unreachable.
Verified against the checkout built for v2.2.4 · updated 20 Oct 2026
On this page
TransformationNew in v2.0
Toggle per task. If the provider is down, messages still go out — rewritten text is a bonus, never a dependency.
Enable it where it earns its keep
- The rewrite toggle lives on the task, so a news feed can rewrite while an archive feed stays byte-exact.
- A reachability probe reports whether the configured provider actually answers, instead of silently skipping the pass.
- When the provider is unreachable or the response fails validation, the original text is forwarded unchanged and the event is logged with its reason.
- Rewrites run before delivery and after the content policy, so the model never sees text that was already going to be dropped.
Providers and configuration
| Field | Purpose |
|---|---|
| provider | OpenAI, Anthropic, Gemini, Groq, DeepSeek or a custom OpenAI-compatible endpoint. |
| model | Model id, for example gpt-4o-mini. |
| api_key / base_url | Encrypted at rest with AES-256-GCM; base_url points at a self-hosted or proxy endpoint. |
| system_prompt | The instruction the model receives. |
| user_prompt_template | Template with {text} as the message placeholder. |
| temperature | Sampling temperature per configuration. |
| target_language | Requested output language, including auto for the Persian↔English preset. |
| is_enabled | Configuration-level switch, independent of the per-task toggle. |
Custom prompts with version history
Prompt templates are first-class records: name, description, system prompt, user template, target language and a version number that increments on every save. Edit history is retained, so a prompt that made output worse can be rolled back by number.
Four presets ship with the service: Professional Clean, Persian↔English Translator, Executive Summarizer and Telegram Format Enhancer. Any of them can be copied into a custom template and edited without touching the original.
sys_pro_clean Professional Clean — strips promo text, ads and @channel mentions
sys_translate_fa_en Persian <-> English Translator — keeps tickers and technical terms
sys_summarizer Executive Summarizer — headline plus 2-3 bullets plus takeaway
sys_format_enhancer Telegram Format Enhancer — bold section headers, clean listsTest before you route
# test a configuration against sample text
curl -sX POST https://your-host/api/v1/ai/<config-id>/test \
-H "Authorization: Bearer $ATF_TOKEN" \
-H 'Content-Type: application/json' \
-d '{"text": "Join our VIP group — 50% OFF today!!!"}'
# the CLI reports provider reachability as part of the diagnosis
atf doctor
atf config listFrequently asked
What happens if my AI provider is down?
The rewrite is skipped, the original message is delivered, and a log entry records the reason. Delivery never depends on a third-party API.
Are my API keys stored in plain text?
No. Configuration secrets are encrypted at rest with AES-256-GCM using your master key, and log lines pass through field-aware redaction.
Can I use a self-hosted or OpenAI-compatible model?
Yes. Set the provider to a custom OpenAI-compatible entry and point base_url at your endpoint; model and prompts behave the same way.