Skip to main content

Clishortener

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

Python Version PyPI version PyPI Total Downloads License: MIT

Asciinema Showcase

Key Features

  • 🚀 Lightweight & Fast: Works right out of the terminal, all dependencies besides requests are 100% optional.
  • 🔌 12+ Services Pre-configured: 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.
  • 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.

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

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 🔧

# Usage: cshorten service default <servicename>
cshorten service default dagd

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)


All Services 🌐

Service Identifier Requires Key
tinyurl tinyurl-auth / tinyurl-noauth Optional
is.gd isgd No
v.gd vgd No
da.gd dagd No
cleanuri cleanuri No
ulvis ulvis No
short.io shortio Yes
clck.ru clckru No
bit.ly bitly Yes
cutt.ly cuttly Yes
0x0.st DOWN-0x0 No
YOURLS yourls Optional
Custom custom Optional

[!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.


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

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

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 Headers: 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 the httpbin example

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

Anonymous Service JSON Example 🔓

"dagd": {
    "serviceurl": "https://da.gd/s",
    "method": "GET",
    "params": {
        "url": ""
    }
}

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

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.1.0.tar.gz (14.3 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.1.0-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for clishortener-0.1.0.tar.gz
Algorithm Hash digest
SHA256 af1cc8fb0ee5fce276d7feb658f0000bd2faebaec325c262acf037fed5f0566a
MD5 2fb27fe09e36dfa64cee406d3c607c21
BLAKE2b-256 cb6f9bfa5263b79e6399f7801dc94601f95d888e6a15592b7971dcf6b1a88746

See more details on using hashes here.

File details

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

File metadata

  • Download URL: clishortener-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.8 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.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3694abebd08160d06e4cb4f577bbce18d0a2d9d8811b829954aa05649dd72205
MD5 25b4e9a98ee3788315c7e1730fdd738f
BLAKE2b-256 5e17bf2d60b2341d1b58341c584c56e579bbf03e7e3619dfeaf7b6948c491da0

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