Manage API Keys
Manage API Keys
Section titled “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.
Add New Key
Section titled “Add New Key”To issue a new API key with 120 requests per minute limits:
ltmanage keys add 120To issue a new API key with 120 requests per minute and a maximum of 5,000 characters per request:
ltmanage keys add 120 --char-limit 5000If you changed the API keys database path:
ltmanage keys --api-keys-db-path path/to/db/dbName.db add 120Remove Keys
Section titled “Remove Keys”ltmanage keys remove <api-key>View Keys
Section titled “View Keys”ltmanage keys