Skip to content

Manage API Keys

LibreTranslate supports per-user limit quotas, e.g. you can issue API keys to users so that they can enjoy higher requests limits per minute (if you also set --req-limit). By default all users are rate-limited based on --req-limit, but passing an optional api_key parameter to the REST endpoints allows a user to enjoy higher request limits. You can also specify different character limits that bypass the default --char-limit value on a per-key basis.

To use API keys simply start LibreTranslate with the --api-keys option. If you modified the API keys database path with the option --api-keys-db-path, you must specify the path with the same argument flag when using the ltmanage keys command.

To issue a new API key with 120 requests per minute limits:

Terminal window
ltmanage keys add 120

To issue a new API key with 120 requests per minute and a maximum of 5,000 characters per request:

Terminal window
ltmanage keys add 120 --char-limit 5000

If you changed the API keys database path:

Terminal window
ltmanage keys --api-keys-db-path path/to/db/dbName.db add 120
Terminal window
ltmanage keys remove <api-key>
Terminal window
ltmanage keys