Skip to main content

Clishortener

A lightweight, feature-rich CLI tool to shorten links using 12+ services—with zero configuration required.

PyPI version Python Version PyPI version PyPI Total Downloads License: MIT Tested for Termux

Asciinema Showcase

Key Features

  • 🔌 12+ Services: TinyURL, Bitly, Short.io, CleanURI, and more.
  • 🛠️ Custom & Self-Hosted: Full support for custom domains and YOURLS instances.
  • 🎨 Colored Output: Optional colorful terminal UI using rich.
  • 🛡️ Privacy Focused: Automatically strips common tracking urls.
  • Pipeline Friendly: Pass raw output directly to stdout or other scripts using bare/silent flags.
  • 🕹 Plug & Play: Start shortening immediately after installation, no setup required.

Installation Options 📥

Via PyPI (recommended)

pip install clishortener[rich]

This will also install rich. To install necessary files only, use pip install clishortener

From source via git

git clone https://github.com/Ruizennis/Clishortener
cd Clishortener
pip install .

Installing all optional packages

pip install clishortener[full]
activate-global-python-argcomplete # This will setup argcomplete globally

Quick Start

Shorten your first url ✂️

cshorten shorten https://example.com

Set your preferred service as the default 🔧

cshorten service default <servicename>

List all available services 📜

cshorten service list

Pipe data to create a pipeline 🔗

echo "https://example.com" | cshorten shorten >> links.txt

[!IMPORTANT] The Default Shortening Service Is Tinyurl (No Api Key Is Required)


Supported Services 🌐

Service Identifier API Key Required?
TinyURL tinyurl-noauth / tinyurl-auth Optional
is.gd / v.gd isgd / vgd No
da.gd dagd No
clck.ru clckru No
ulvis.net ulvis No
CleanURI cleanuri No
Bitly bitly Yes
Cuttly cuttly Yes
Short.io shortio Yes
Rebrandly rebrandly Yes
YOURLS yourls Optional
Custom Service custom Depends on service chosen

[!IMPORTANT]
Privacy & Service Usage: Requests routed through third-party shorteners are subject to each provider's independent privacy and logging practices. Self-hosted options (YOURLS, custom) give you total control over data logging.

📜 View Provider Terms & Privacy Policies
Provider Legal & Policy Links
TinyURL Privacy Policy · Terms of Service
is.gd Terms & Privacy Policy
v.gd Terms & Privacy Policy
da.gd Source & Licensing
clck.ru Privacy Policy · Terms of Use
ulvis.net Service Terms
CleanURI Privacy Policy · Terms of Service
Bitly Privacy Policy · Terms of Service
Cuttly Privacy Policy · Terms of Service
Short.io Privacy Policy · Terms of Service
Rebrandly Privacy Policy · Terms & Conditions

Disclaimer: These legal policy links are provided for convenience only, links may change over time and as a solo developer, I can't guarantee every link stays up to date.


Requirements 📦

Package Type Purpose
requests Required Handles HTTP calls to shortening APIs
PySocks Optional Allows more types of proxying (SOCKS)
rich Optional Adds terminal colors, menus, and visual styling
argcomplete Optional Provides shell auto-completion for cshorten
keyring / keyrings.alt Optional Allows saving API keys securely for automatic authentication

[!NOTE] If you are using Termux or a terminal that doesn't support keyring use keyrings.alt instead. (pip install keyrings.alt)


Global Flags

Flag Long Flag Purpose
-b --bare Remove rich formatting and write to stdout without formatting
-h --help Shows help menu
-S --silent Silences all logging messages

Shortening Flags

Flag Long Flag Purpose
-s --service Allows specifying service for a command
-k --key Allows setting an api key for services that require it
-t --timeout Allows setting custom timeout time
--no-strip Disables automatic tracker parameter removal

Additional Commands >_

Category Command Description Usage Example
Service default Set default shortening service cshorten service default <service>
Service list List all available services cshorten service list
Security proxy edit Edit proxy configuration cshorten security proxy edit
Security proxy show Show current proxy configuration cshorten security proxy show
Security proxy reset Remove proxy configuration cshorten security proxy reset
Security keys set Add an api key for a service cshorten security keys set bitly
Security keys clear Clears ALL set api keys or just for specified service cshorten security keys clear bitly

Notes & Usage Tips 💡

  • Self-Hosted & Custom Domains: Use the full URL and set the --domain flag when using yourls or custom providers.
  • API Keys: API keys can be provided via the -k / --key flag for services requiring authentication.
  • Service Identifiers: When specifying or setting a default service, always use the service's Identifier (e.g., dagd, tinyurl-auth) rather than its display name or URL.
⚙️ Advanced Configuration
  • Custom / YOURLS: Requires full URL endpoint and the --domain flag.
  • Custom Config: Sent in key: value format.
  • Config Parameters: auth_param specifies key requirements; url_param sets the request payload variable (defaults to "url").
  • NO COLOR: We proudly support the NO_COLOR initiative. Add NO_COLOR=1 to os.environ to disable output styling
  • FORCE_COLOR: Add FORCE_COLOR=1 to your env variables to force color for use in asciinema or vhs recordings.
  • Pipes: We support piping data, when piping bare is automatically appiled ensuring no color and only url is sent allowing for more complex pipelines.
  • Advanced Proxy Networks: SOCKS proxies and TOR routing is fully supported if you install the required add-on for requests, simply add your socks proxy URL to the proxy list.

[!WARNING] Using SOCKS proxies requires pysocks, install PySocks with pip install "requests[socks]"


Adding Additional Services Examples 🔨

[!IMPORTANT] Additional services can be added By editing services.json (/.config/clishortener/usr/usrconfig.json) and adding new entries.

[!NOTE] Httpbin is not a legitimate URL shortening service and is instead intended for development purposes. (e.g seeing public IP address to confirm requests are proxied.)

Adding httpbin as a service example

"httpbin": {
    "serviceurl": "https://httpbin.org/post",
    "method": "POST",
    "auth_header": "apikey",
    "url_param": "destination",
    "params": {
        "destination": ""
    }
}

Testing httpbin example

cshorten shorten https://example.com -s httpbin -k ApiKey

No Key Service JSON Example 🔓

"0x0": {
        "serviceurl": "https://0x0.st",
        "method": "POST",
        "multifile": true,
        "url_param": "shorten",
        "json_body": false,
        "params": {}
     },

Testing 0x0 example

cshorten shorten https://example.com -s 0x0

[!WARNING] As of 2026-08-01 file hosting on the public 0x0.st instance is temporarily paused with no ETA for its return, self hosting is recommended. Self-host The Null Pointer (0x0) from The Official Git Repository.

Authenticated API JSON Example 🔐

"shortio": {
    "serviceurl": "https://api.short.io/links/public",
    "auth_header": "authorization",
    "url_param": "originalURL",
    "method": "POST",
    "json_key": "shortURL",
    "json_body": true,
    "params": {}
}

Planned Features 📌

  • Saving api keys with Keyring & automatically loading saved api keys
  • Saving links created to a file (Off by default)

Additional Links & Credits 🔗

Credits to Pyshorteners made by ellisonleao for inspiring this tool


License

This project is licensed under the MIT license, see LICENSE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

clishortener-0.2.3.tar.gz (17.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

clishortener-0.2.3-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

Details for the file clishortener-0.2.3.tar.gz.

File metadata

  • Download URL: clishortener-0.2.3.tar.gz
  • Upload date:
  • Size: 17.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for clishortener-0.2.3.tar.gz
Algorithm Hash digest
SHA256 50966b8f5edaedc4f40342ab2d5c4db8d29e9a2fa9d2d92a05c4e18a0efcd8c7
MD5 a715cb7cdfaed5a3efa3e07aee615b43
BLAKE2b-256 066d72a96d1bba6b34510e18da81dffe8a3c1fa88aaf82ad09150633b473f0e3

See more details on using hashes here.

File details

Details for the file clishortener-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: clishortener-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 15.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for clishortener-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a46533b24fc2e1cf87f38f2124875d45691063eb3d292f8e1b11d506d863ecf0
MD5 30d8ed229a4f69e9565a306f6ac7d312
BLAKE2b-256 a41380eb20b55884adb0e1cd93ef376bd3ed1d77f29fab37bb27faf0ab0bfc7e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page