Generate Image

Generates images based on text descriptions using vision models.

POST /v1/vision/generate

Request Body

Les paramètres suivants peuvent être inclus dans le corps de la requête :

Paramètres

model
string
Required
Default Value: alphaedge-vision-3-1-2505

ID of the vision model to use.

prompt
string
Required

A text description of the desired image.

size
string
Default Value: 1024x1024

The size of the generated image.

n
integer
Default Value: 1

The number of images to generate.

Successful Response

Les champs suivants sont retournés dans une réponse réussie :

Champs de réponse

id
string
Required

A unique identifier for the generated image.

object
string
Required

The object type, which is always "vision.image".

created
integer
Required

The Unix timestamp when the image was created.

data
array<ImageData>
Required

The list of generated images.

Examples

Exemples de code pour utiliser cet endpoint :

typescript
import { AlphaEdge } from '@alphaedge/alphaedge';

const alphaedge = new AlphaEdge({
  apiKey: process.env.ALPHAEDGE_API_KEY,
});

const image = await alphaedge.vision.generate({
  model: 'alphaedge-vision-3-1-2505',
  prompt: 'A beautiful sunset over the ocean',
  size: '1024x1024'
});
python
from alphaedge import AlphaEdge

alphaedge = AlphaEdge(api_key="your-api-key")

image = alphaedge.vision.generate(
    model="alphaedge-vision-3-1-2505",
    prompt="A beautiful sunset over the ocean",
    size="1024x1024"
)
curl
curl https://api.alphaedge-ai.com/v1/vision/generate \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $ALPHAEDGE_API_KEY" \
  -d '{
    "model": "alphaedge-vision-3-1-2505",
    "prompt": "A beautiful sunset over the ocean",
    "size": "1024x1024"
  }' 

Response

Exemple de réponse de l'API :

json
{
  "id": "img-abc123",
  "object": "vision.image",
  "created": 1234567890,
  "data": [
    {
      "url": "https://api.alphaedge-ai.com/files/img-abc123.png",
      "b64_json": "iVBORw0KGgoAAAANSUhEUgAA..."
    }
  ]
}