Update: tiny bugfix, always trying to incorporate some new Civitai-Outputs and less error prone handling of de-published models...
Purpose: I like to save AI-images, to drop them later into A1111 and play with the used Loras/Styles. However, the Civitai-Generator doesn't offer Meta-Data in the format A1111 is used to, so it's quite a effort to set everything up. With help of Civitai-API I wrote a little extension, that helps with that.
Usage: Unzip the extension into your Extensions folder and restart the UI. A new Button appears. Drop an image into the prompt-area. Hit the new button (1) under "Generate". Wait a little until the prompt gets an update. Hit the good old apply-button (2), hit Generate and see (or read) what happens.

What happens:
Let's take for example: https://civarchive.com/images/8010475 (and leave a thumbs up, while you're there). If you'd save it and drop it into the prompt area, you can see, it has the following info...
[{"type":"checkpoint","modelVersionId":290640},{"type":"lora","weight":1,"modelVersionId":349887},{"type":"embed","weight":1,"modelVersionId":5637}]
... which A1111 and Forge totally ignore. The overall Prompt is used, but the Checkpoint and the Loras are lost, even if they are installed. Hitting the new translate [↔] button, my script asks the Civitai-Api for Info and converts it to a format the "Apply" button understands and adds some further infos after the #
By default A1111 ignores everything in a line after a "#" when it comes to generation, so you can just ignore the following if you don't like that info.
After the # you get a "ready to paste" URL to open the models on Civitai, in case you don't have the model installed. If my extension doesn't find the file, it puts 🔎 to the end of the line, otherwise you get an ☑(icons might look slightly differently on your computer). If it doesn't find the models, despite them being in your folders, check if the filename is correct in the <angle brackets:1>. Sometimes files get renamed and that's enough for A1111 and Forge to skip over them (sometimes this makes them ignoring all loras, even found one's).
On top it adds "RNG:CPU", to the end which seems to be what Civitai is using (this setting will appear in the overrides).
After this, hit "Apply" like usual ,and "Generate" now has a chance to find the the correct loras/models.
Limitations:
A) Sometimes, (especially if the Picture was an "inbetween" of an on-site upscale), the extension doesn't get the right size. That is indicated by a new part between negative prompt and general config "⚠ Size guessed AFTER upscale ⚠". If all guesses fail, you'll get 1024x1024, which should be enough to run a test.
B) You will not get the exact same picture, just pretty close. Differences in Hardware and Software-versions as well as Civitai's "behind the scenes magic/optimizations" will always make at least a tiny difference (You can experiment to with CFG/GFG-fix - in my experiments +1.5 or +2.5 get the results often a little closer, but that seems to be random as well, and not worth the time). However for me the important thing, is to use pictures as an archive for interesting styles, so this is only making sure, that I have the right ingredients together.
C) It will only work for Images created with the Civitai-Generator.
D) Updates/Changes in the Api might break this little script in no time.
E) If a resource is gone from Civitai, my script and the Api will be of no use.
F) If your Web UI is set to remove styles on "apply", the whole procedure will probably be useless.
Description
The former versions of the plugins suddenly stopped working, due to some CORS-Problems. Either the browsers got more sensitive or the Api-Server-Header changed a little - I can't tell.
A1111 and Forge now handle the Requests in the background. It feels a little slower then the former (pure JS) Version, but it does the job.
On the plus-side I could finally add a check, if the WebGui finds the used Loras/Models.
FAQ
Comments (16)
Is this working for anyone else? I'm getting "Nothing to translate" despite it having a lot of CivitAI metadata in the prompt area after dropping saved images onto it.
new version. give it a try. and post links to pictures where it doesn't work.
@ragnaroook Thank you for the update, all the images I was trying before are now working. Will report back if I find any that aren't.
{"resource-stack":{"class_type":"CheckpointLoaderSimple","inputs":...
Seeing more images marked with the civitai generator with the above format. Any chance for an update that can translate those?
Give me a link, and I'll give it a try.
@ragnaroook https://civitai.com/images/29507759 Here's one that come up with the format. I appreciate the attempt. The tool has been really useful.
@srfuentes99 New version, give it a try.
@ragnaroook first time returned Positive Prompt: translate_out
Updated all extensions and reloaded and returned Positive Prompt: Nothing to translate.
Backend showed the following:
Yshtola Rhul, 1girl, solo, looking at viewer, short hair, blonde hair, hair ornament, gloves, animal ears, closed mouth, cat ears, dark skin, fingerless gloves, blurry, lips, grey eyes, blurry background, facial mark, feathers, slit pupils, portrait, feather hair ornament, whisker markings, miqo'te, score_9, score_8_up, score_7_up, score_6_up, score_5_up, score_4_up,
Negative prompt:civit_nsfw,
Steps:30, Sampler: Euler a, CFG scale: 7, Seed: 4090255686, Size: 832x1216,, Civitai resources: [{"type": "checkpoint", "modelVersionId": 805005}{"type": "checkpoint", "modelVersionId": 805005}{"type": "lora", "weight": 0.8, "modelVersionId": 836545}{"type": "embedding", "weight": 0, "modelVersionId": 106916}]
{"type": "checkpoint", "modelVersionId": 805005}{"type": "checkpoint", "modelVersionId": 805005}{"type": "lora", "weight": 0.8, "modelVersionId": 836545}{"type": "embedding", "weight": 0, "modelVersionId": 106916}]
{'type': 'checkpoint', 'modelVersionId': 805005}
Traceback (most recent call last):
File "E:\Stable\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 488, in run_predict
output = await app.get_blocks().process_api(
File "E:\Stable\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1431, in process_api
result = await self.call_function(
File "E:\Stable\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 1103, in call_function
prediction = await anyio.to_thread.run_sync(
File "E:\Stable\stable-diffusion-webui\venv\lib\site-packages\anyio\to_thread.py", line 33, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File "E:\Stable\stable-diffusion-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 877, in run_sync_in_worker_thread
return await future
File "E:\Stable\stable-diffusion-webui\venv\lib\site-packages\anyio\_backends\_asyncio.py", line 807, in run
result = context.run(func, *args)
File "E:\Stable\stable-diffusion-webui\venv\lib\site-packages\gradio\utils.py", line 707, in wrapper
response = f(*args, **kwargs)
File "E:\Stable\stable-diffusion-webui\extensions\sd-webui-civitai-translator\scripts\cv_translator.py", line 201, in transl
return translate_input(input_text)
File "E:\Stable\stable-diffusion-webui\extensions\sd-webui-civitai-translator\scripts\cv_translator.py", line 130, in translate_input
model_hash = model_data['files'][0]['hashes']['AutoV2'].lower()
IndexError: list index out of range
@srfuentes99 Thanks for the error "model_hash = model_data['files'][0]['hashes']['AutoV2'].lower()" should help debugging it. Which image was this? My experiments with https://civitai.com/images/29507759 worked so far.
@ragnaroook That's the image I tested with also.
Python version info if it applies:
Python revision: 3.10.6 (tags/v3.10.6:9c7b4bd, Aug 1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
Civitai Link revision: 115cd9c35b0774c90cb9c397ad60ef6a7dac60de
SD-WebUI revision: 82a973c04367123ae98bd9abdf80d9eda9b910e2
@srfuentes99
Now, I get the error as well. Seems to be a problem with used model:
"This model has been archived and is not available for download. You can still share your creations with the community."
https://civitai.com/models/384659/virtual-diffusion-pony-xl?modelVersionId=805005
I'll publish a new version shortly - one that will not come entirely to a halt with this problem.
...and the new version is out. Give it a try, please.
@ragnaroook it worked for the test image and another image from the same post.
I tried a few additional images and all returned:
Positive Prompt: Nothing to translate
Backend: Problem with JSON-Extract, trying standard route
Tested image: https://civitai.com/images/28404226
@srfuentes99 Seems the pictures were part of on-page-upscaling, and the original size is missing. I now let the extension make a vague guess. In most cases, this will only be good to get the ratio, as I don't get the real dimensions or the scale. That is indicated by a new part between negative prompt and general config "⚠ Size guessed AFTER upscale ⚠"
If all else fails you'll get 1024x1024, which should be enough to work it for a test. New Version is out.
@ragnaroook its worked on the a few of the others I've come across. Amazing work and incredible turn around time. Thank you.
@srfuentes99 Glad to hear, it works. Thanks.
Looks like we don't have an active mirror for this file right now.
CivArchive is a community-maintained index — we catalog mirrors that volunteers upload to HuggingFace, torrents, and other public hosts. Looks like no one has uploaded a copy of this file yet.
Some files do get recovered over time through contributions. If you're looking for this one, feel free to ask in Discord, or help preserve it if you have a copy.

