Metadata-Version: 2.1
Name: novelai-python
Version: 0.1.1
Summary: Novelai Python Binding With Pydantic
Author-Email: sudoskys <coldlando@hotmail.com>
License: Apache 2.0
Project-URL: Repository, https://github.com/LlmKira/novelai-python/
Project-URL: Issues, https://github.com/LlmKira/novelai-python/issues
Requires-Python: >=3.8
Requires-Dist: elara>=0.5.5
Requires-Dist: loguru>=0.7.2
Requires-Dist: pydantic-settings>=2.1.0
Requires-Dist: pydantic>=2.5.3
Requires-Dist: httpx>=0.26.0
Requires-Dist: shortuuid>=1.0.11
Requires-Dist: Pillow>=10.2.0
Requires-Dist: curl-cffi>=0.5.10
Description-Content-Type: text/markdown

# novelai-python

[![PyPI version](https://badge.fury.io/py/novelai_python.svg)](https://badge.fury.io/py/novelai_gen)
[![Downloads](https://pepy.tech/badge/novelai_python)](https://pepy.tech/project/novelai_python)

The goal of this repository is to use Pydantic to build legitimate requests to access the Novelai API service.

### Roadmap 🚧

- [x] /ai/generate-image
- [ ] /ai/generate-image/suggest-tags
- [ ] /ai/annotate-image
- [ ] /ai/classify
- [ ] /ai/upscale
- [ ] /ai/generate-prompt
- [ ] /ai/generate
- [ ] /ai/generate-voice

### Usage 🖥️

```python
import asyncio
import os

from dotenv import load_dotenv
from pydantic import SecretStr

from novelai_python import GenerateImageInfer, ImageGenerateResp, JwtCredential

load_dotenv()

enhance = "year 2023,dynamic angle,  best quality, amazing quality, very aesthetic, absurdres"


async def main():
    globe_s = JwtCredential(jwt_token=SecretStr(os.getenv("NOVELAI_JWT")))
    _res = await GenerateImageInfer.build(
        prompt=f"1girl,{enhance}").generate(
        session=globe_s)
    _res: ImageGenerateResp
    print(_res.meta)
    file = _res.files[0]
    with open(file[0], "wb") as f:
        f.write(file[1])


loop = asyncio.get_event_loop()
loop.run_until_complete(main())

```

## Acknowledgements 🙏

[BackEnd](https://api.novelai.net/docs)
[novelai-api](https://github.com/Aedial/novelai-api)

