Portkey provides a robust and secure gateway to facilitate the integration of various Large Language Models (LLMs) into your applications, including Segmind APIs.

With Portkey, you can take advantage of features like fast AI gateway access, observability, prompt management, and more, all while ensuring the secure management of your LLM API keys through a virtual key system.

Provider Slug. segmind

Portkey SDK Integration with Segmind

Portkey provides a consistent API to interact with image generation models from various providers. To integrate Segmind with Portkey:

1. Install the Portkey SDK

Add the Portkey SDK to your application to interact with the Segmind API through Portkey’s gateway.

npm install --save portkey-ai

2. Initialize Portkey with the Virtual Key

To use Segmind with Portkey, get your API key from here, then add it to Portkey to create the virtual key.

import Portkey from 'portkey-ai'

const portkey = new Portkey({
    apiKey: "PORTKEY_API_KEY", // defaults to process.env["PORTKEY_API_KEY"]
    virtualKey: "VIRTUAL_KEY" // Your Segmind Virtual Key
})

3. Invoke Image Generation with Segmind

Use the Portkey instance to send requests to Stability AI. You can also override the virtual key directly in the API call if needed.

const image = await portkey.images.generate({
  model:"sdxl1.0-txt2img",
  prompt:"Lucy in the sky with diamonds",
  size:"1024x1024"
})

Notice how we’re using the OpenAI’s image generation signature to prompt Segmind’s hosted serverless endpoints allowing greater flexibility to change models and providers later if necessary.

Supported Models

The following models are supported, newer models added to Segmind should also be automatically supported.

Model StringModel NameExtra Keys (if any)
sdxl1.0-txt2imgSDXL
sd1.5-526mix526 Mix
sd1.5-allinonepixelAll In One Pixel
sd1.5-disneyBCartoon
sd1.5-colorfulColorful
sd1.5-cuterichstyleCute Rich Style
sd1.5-cyberrealisticCyber Realistic
sd1.5-deepspacediffusionDeep Spaced Diffusion
sd1.5-dreamshaperDream Shaper
sd1.5-dvarchDv Arch
sd1.5-edgeofrealismEdge of Realism
sd1.5-epicrealismEpic Realism
sd1.5-fantassifiediconsFantassified Icons
sd1.5-flat2dFlat 2D
sd1.5-fruitfusionFruit Fusion
sd1.5-icbinpIcbinp
sd1.5-juggernautJuggernaut
kandinsky2.2-txt2imgKandinsky
sd1.5-majicmixMajicmix
sd1.5-manmarumixManmarumix
sd1.5-paragonParagon
potraitsd1.5-txt2imgPotrait SD
qrsd1.5-txt2imgQR Generatorcontrol_scale, control_scale, control_scale, qr_text, invert, size
sd1.5-rcnzRCNZ
sd1.5-rpgRPG
sd1.5-realisticvisionRealistic Vision
sd1.5-reliberateReliberate
sd1.5-revanimatedRevanimated
sd1.5-samaritan-3dSamaritan
sd1.5-scifiSciFi
smallsd1.5-txt2imgSmall SD
tinysd1.5-txt2imgTiny SD

Next Steps

The complete list of features supported in the SDK are available on the link below.

SDK

You’ll find more information in the relevant sections:

  1. Add metadata to your requests
  2. Add gateway configs to your Segmind requests
  3. Tracing Segmind’s requests
  4. Setup a fallback from OpenAI to Segmind
  5. Image generation API Reference