Socket
Socket
Sign inDemoInstall

ideogram.js

Package Overview
Dependencies
9
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ideogram.js

A node.js module that allows you to easily generate images using the Ideogram's API.


Version published
Maintainers
1
Created

Readme

Source

Banner

Ideogram.js

A Node.js package that allows you to easily generate images from Ideogram.

This npm package is created for educational and research purposes. By using this package, you agree to do so at your own risk. This package is not affiliated, endorsed, or sponsored by Ideogram in any way.

Installation

Install ideogram.js to your project with npm:

npm install ideogram.js

Example Usage

A session cookie is required for ideogram.js to work. To get yours, follow these steps :

  • Go to ideogram.ai and login (or create an account if you don't have one).
  • Open DevTools using the F12 key (or Option + ⌘ + J for Mac users) on your keyboard.
  • Nagivate to Application -> Cookies -> https://ideogram.ai/ and copy the value of the cookie called session_cookie.

You can now send your first request to the Ideogram website!

const Ideogram = require("ideogram.js")
const ideogram = new Ideogram("SESSION_COOKIE_GOES_HERE")

ideogram.generate({
    prompt: "Abstract expressionism of Mentoring and self development , 3d render, photo, wildlife photography, dark fantasy, cinematic",
    aspect_ratio: "square"
})
.then(result =>{
    console.log(result)
    // ... do whatever you want with the result
})
.catch(error =>{
    return console.log(error)
})

Documentation

Initialization
const Ideogram = require("ideogram.js")
const ideogram = new Ideogram(session_cookie)
ParameterTypeDefaultDescription
session_cookiestringN/AYour session cookie (REQUIRED)

ideogram.generate()
 ideogram.generate(generationOptions).then(result).catch(error)

The ideogram.generate() sends a request to the Ideogram website to start a generation; It takes an Object parameter and return an Object.

Parameter (from Object)TypeDefaultDescription
promptstringN/A(REQUIRED) Description of the image(s) to generate
aspect_ratiostringN/A(REQUIRED) Aspect ratio of the images to generate (accepted values are square, portrait or landscape)
Result (Object)TypeDescription
Object.successbooleantrue if the request was successful, false otherwise
Object.messagestring or nullNot null if Object.success is false, string explaining the error
Object.user_idstringYour Ideogram user ID
Object.promptstringThe prompt used in the request
Object.request_idstringThe ID of the request. The request ID can be used to get information sata about a generation (status, images, etc)
Object.aspect_ratiostringThe aspect ratio used in the request

ideogram.getGeneration()
 ideogram.getGeneration(generationId).then(result).catch(error)

The ideogram.getGeneration() sends a request to the Ideogram website to get information about a generation; It takes a String parameter and return an Object.

ParameterTypeDefaultDescription
generationIdstringN/A(REQUIRED) Id of the generation you want to fetch
Result (Object)TypeDescription
Object.successbooleantrue if the request was successful, false otherwise
Object.messagestring or nullNot null if Object.success is false, string explaining the error
Object.request_idstringId of the generation
Object.statusstringStatus of the generation (can either be COMPLETED or GENERATING)
Object.promptstringThe prompt used for the generation
Object.aspect_ratiostringThe aspect ratio of the generation
Object.has_startedbooleanWhether the generation has started or not
Object.resolutionnumberThe current resolution of the images (1024 indicated the generation is completed)
Object.heightstringThe height of the images
Object.widthstringThe width of the images
Object.imagesArray or nullArray of Objects. If this value is null, it means the generation has started but the website it not yet returning images
Image (Object.images)TypeDescription
Image.response_idstringThe ID of the image
Object.hasLikedbooleantrue if you liked the image, false otherwise
Object.likesnumberHow many users liked your image
Object.urlstringA direct URL to the image

Support Discord Logo

If you're having issues with Ideogram.js or want to share your projects, ideas or feedbacks, you can join my support server!


Coming soon

  • Ability to apply a style when sending a generation request.
  • Function to get a list of all available styles.
  • EventEmmiters ("generationRequestSent", "generationCompleted", etc...)

FAQs

Last updated on 01 Sep 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc