They have pretty straightforward API.
Can be used without an API key, though any kind of NSFW content won't be returned.
I have no idea about Rust, completely different language to what I've been working with so far so I won't even attempt at PRing or vibecoding it.
These are what I'm using in my bot:
Regex: civitai\.(?:com|red)/(?P<type>posts|images)/(?P<id>\d+)
Endpoint: GET https://civitai.com/api/v1/images (handles both civitai.com and civitai.red)
Auth header: Authorization: Bearer <API KEY>
Query parameters:
limit - default is 50, I've set it to 200 but I doubt you will ever see that many results
page if you decide to fetch more than 200
browsingLevel - filtering bitmask, use 16 to be able to view everything (equivalent to deprecated nsfwLevel=X)
postId if requesting images of a post (type=posts)
imageId if requesting single image (type=images)
Results will be at json.items[] array.
Each result has url, type (image, video), username fields, no thumbnails.
Linking to author - probably a good idea to link https://civitai.red/user/<username> for NSFW images and https://civitai.com/user/<username> for non-NSFW images as they are a different gallery listings.
Video results - I guess they must be skipped because Civitai does not provide any thumbnail for them.
Full endpoint docs: https://developer.civitai.com/site/reference/images
Potential issues:
Regex might conflict with e621/e926/e6ai as they both have /posts/ in URL path.
They have pretty straightforward API.
Can be used without an API key, though any kind of NSFW content won't be returned.
I have no idea about Rust, completely different language to what I've been working with so far so I won't even attempt at PRing or vibecoding it.
These are what I'm using in my bot:
Regex:
civitai\.(?:com|red)/(?P<type>posts|images)/(?P<id>\d+)Endpoint:
GET https://civitai.com/api/v1/images(handles both civitai.com and civitai.red)Auth header:
Authorization: Bearer <API KEY>Query parameters:
limit- default is 50, I've set it to 200 but I doubt you will ever see that many resultspageif you decide to fetch more than 200browsingLevel- filtering bitmask, use16to be able to view everything (equivalent to deprecatednsfwLevel=X)postIdif requesting images of a post (type=posts)imageIdif requesting single image (type=images)Results will be at
json.items[]array.Each result has
url,type(image, video),usernamefields, no thumbnails.Linking to author - probably a good idea to link
https://civitai.red/user/<username>for NSFW images andhttps://civitai.com/user/<username>for non-NSFW images as they are a different gallery listings.Video results - I guess they must be skipped because Civitai does not provide any thumbnail for them.
Full endpoint docs: https://developer.civitai.com/site/reference/images
Potential issues:
Regex might conflict with e621/e926/e6ai as they both have
/posts/in URL path.