Skip to content

SyntaxError: The requested module 'civitai' does not provide an export named 'Civitai' #11

@thesaintcoder

Description

@thesaintcoder

Greetings! I am trying to run on Pipedream but stumbling into this error.

SyntaxError: The requested module 'civitai' does not provide an export named 'Civitai'

Here is my code:

import { Civitai } from "civitai";

const civitai = new Civitai({
  auth: "YOUR_API_TOKEN", // Replace with your Civitai API token
});

export default defineComponent({
  async run({ steps, $ }) {
    // Define the input parameters for Civitai image generation
    const input = {
      model: "urn:air:sd1:checkpoint:civitai:4201@130072",
      params: {
        prompt: "RAW photo, face portrait photo of 26 y.o woman, wearing black dress, happy face, hard shadows, cinematic shot, dramatic lighting",
        negativePrompt: "(deformed iris, deformed pupils, semi-realistic, cgi, 3d, render, sketch, cartoon, drawing, anime, mutated hands and fingers:1.4), (deformed, distorted, disfigured:1.3)",
        scheduler: "EULER_A",
        steps: 20,
        cfgScale: 7,
        width: 512,
        height: 512,
        clipSkip: 2,
      },
    };

    // Create a txt2img job
    const response = await civitai.image.fromText(input);
    
    // Fetch the result later using the response token
    const output = await civitai.jobs.get(response.token);

    // Return the output (e.g., image URL) for use in future steps
    return {
      image_url: output.results[0].url, // Adjust based on actual response structure
      job_id: response.token, // Optionally return the job ID for reference
    };
  },
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions