Skip to content
TORNLIFE More

torn-cli | Torn API + FFScouter API CLI for terminals / AI Agents

Started by Manuel [3747263] on in Tools & Userscripts.

2 replies · 120 views · thread synced · 7 days ago · View on torn.com
About this thread

Posts archived: 3 / 3 posts (100%) · the total is Torn's reply count + the opening post at the last fetch

Counted by TornLife from the archived posts.

Archived posts
3
Discussion span
→
People posting
1
Likes on archived posts
16
Authority score
35 / 100
Historical score
23 / 100
Story score
32 / 100
Engagement score
52 / 100
Manuel [3747263]

torn-cli

 

Hey everyone,

I made a small tool called torn-cli. It is a fast, privacy-first command-line tool for the Torn API v2 and FFScouter.

I originally built this for myself, mainly so my AI coding agents could safely query Torn data, use structured JSON output, and avoid leaking API keys in logs or URLs.

 


What it does

  • Works with Torn API v2 endpoints
  • Includes shortcuts for common user, faction, market, company, and log queries
  • Includes FFScouter commands for stats, targets, activity, hit calling, losses, and more, including PREMIUM features.
  • Outputs JSON, pretty text, tables, CSV, or raw API responses
  • Has watch mode for repeating checks, like hospital timers
  • Redacts API keys from logs, cache keys, URLs, and output where possible
  • Useful for scripts, terminals, and AI agents that need clean machine-readable output

 


Install

Requires Rust/Cargo.


cargo install --git https://github.com/manuelcecchetto/torn-cli --locked

Basic setup

torn config set torn-api-key
torn config set ffscouter-api-key
torn config check

Examples

torn api user basic --pretty
torn api user basic --id PLAYER_ID --json
torn api faction members --id FACTION_ID --table
torn ff stats --target PLAYER_ID --pretty
torn ff targets --preset respect --limit 10 --json

Watch mode example

Subject to Torn API rate limits of course. This command lets you watch the status of a player.

 

torn --watch 2s --pretty api user basic --id PLAYER_ID

 

AI Agents .skill

A skill on the repo explains perfectly to your ai agent how to install and use the cli.

 

Just prompt your Codex/Claude Code/whatever you nerds are using

 

Help me set up https://github.com/manuelcecchetto/torn-cli

 


Why I made it

Mostly personal convenience. I wanted a safer way for local scripts and AI agents to access Torn/FFScouter data without pasting keys everywhere, scraping pages, or manually formatting API responses.

It is not a bot and does not play the game for you. It just calls API endpoints you request and formats the result.

AI agents are pretty good at concatenating requests and outputs to create you every report you need.

 


Links

GitHub: HERE

 

Feedback, bug reports, and feature requests are welcome.

Manuel [3747263]

torn-cli update

  • Added --all-pages for API commands.
  • CLI now follows Torn’s _metadata.links.next pagination automatically.
  • Added --page-limit N to cap how many pages are fetched.
  • Paginated JSON results are merged into one clean output.
  • Duplicate items are removed by id.
  • Added safeguards against stuck/repeating pagination links.
  • Useful for large endpoints like faction attacks.

 

Example:


torn --all-pages api faction attacks --from 1781964000 --to 1782012665 --sort ASC --limit 100 --json

 

This now fetches the full attack window in one command instead of manual pagination.