novelai-api
Python API for the NovelAI REST API
This module is intended to be used by developers as a helper for using NovelAI's REST API.
| Category | Badges |
|---|---|
| Pypi | |
| Quality checking | |
| Stats | |
| Activity |
Retired versions: 3.7.2
Final commit of retired versions can be found with the tag py<version> (e.g. py3.7.2).
Usage
Download via pip:
pip install novelai-api
Using the module via Command Line
Get access key
Get the access key for your account. This key is used to login to the API through the /login endpoint.
python -m novelai_api get_access_key <username> <password>
Get access token
Login to the API and get the access token. This token is valid 30 days and is required to use most of the API. Take care to properly escape the arguments if they contain special characters.
python -m novelai_api get_access_token <username> <password>
Sanity check
Run a sanity check on your user content. It will print what content couldn't be decrypted. Take care to properly escape the arguments if they contain special characters.
python -m novelai_api sanity_check <username> <password>
Decode
Decode a b64 encoded tokenized text. This will print the tokens and the decoded text.
python -m novelai_api decode <model> <data>
Using the module in your code
A full list of examples is available in the example directory
The API works through the NovelAIAPI object. It is split in 2 groups: NovelAIAPI.low_level and NovelAIAPI.high_level
low_level
The low level interface is a strict implementation of the official API (https://api.novelai.net/docs). It only checks for input types via assert, and output schema if NovelAIAPI.low_level.is_schema_validation_enabled is True
high_level
The high level interface builds on the low level one for easier handling of complex settings. It handles many tasks from the frontend
Development
All relevant objects are in the novelai_api directory.
The Poetry package is required (pip install poetry) as the venv manager.
Contributing
You can contribute features and enhancements through PR. Any PR should pass the tests and the pre-commits before submission. The pre-commit hook can be installed via
poetry run nai-pre-commit
Testing against the API
To run against the API, you can use poetry run nai-test-api.
Testing against the mocked API
To run against the mocked API, you can use poetry run nai-test-mock.
| ⚠️ WIP, does not work yet ⚠️ |
|---|
Docs
To build the docs, run
poetry run nai-build-docs
The docs will be locally viewable at docs/build/html/index.html
Metadata
Release files for novelai-api 0.34.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| novelai_api-0.34.1.tar.gz | 6.3 MB | Without provenance | Details for novelai_api-0.34.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| novelai_api-0.34.1-py3-none-any.whl | Python 3 | none | any | Details for novelai_api-0.34.1-py3-none-any.whl |
Total release size: 12.7 MB
Release files / novelai_api-0.34.1.tar.gz
| Download URL | novelai_api-0.34.1.tar.gz |
|---|---|
| Size | 6.3 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e07fb8ff576c70c48a24f8c912e75f746ea2088f2d3628754c28b24524c023fa
|
|
BLAKE2b-256 checksum How to use checksums |
583f50cdd6fb142c8af083fdad8becdcd0fad5e229fba031795691c35eaf0001
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.12.1 Linux/6.11.0-1015-azure
|
Release files / novelai_api-0.34.1-py3-none-any.whl
| Download URL | novelai_api-0.34.1-py3-none-any.whl |
|---|---|
| Size | 6.4 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2a0ec1c240d0bbff520220129d99c5a23e6913ddaeacc355f96d28e907b04136
|
|
BLAKE2b-256 checksum How to use checksums |
c1744279ddd98496bae8c5e6a60dae8a7645e8ae8a8c4fef670eb42aa8e7a131
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.1.3 CPython/3.12.1 Linux/6.11.0-1015-azure
|
Security for novelai-api 0.34.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.