# Generate Image — Eden AI

> Generates an image from the provided description. See the documentation

- Key: `eden_ai-generate-image`
- Type: Action (Write)
- Version: 0.0.4
- App: Eden AI (`eden_ai`) — https://pipedream.com/apps/eden-ai.md
- This page (HTML): https://pipedream.com/apps/eden-ai/actions/generate-image
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/eden_ai/actions/generate-image/generate-image.mjs

## Description

Generates an image from the provided description. [See the documentation](https://docs.edenai.co/reference/image_generation_create)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `text` | `string` | Yes | Description of the desired image(s) - the maximum length is 1000 characters. |
| `resolution` | `string` | Yes | Resolution of the image. |
| `numImages` | `integer` | No | The number of images to generate. |
| `providers` | `string[]` | Yes | One or more providers that the data will be redirected to in order to get the processed results. See the documentation for available providers. |
| `fallbackProviders` | `string[]` | No | Providers to be used as fallback if the call to the first provider fails. To use this, you must input only one provider in the Providers prop, and you can input up to 5 fallbacks. They will be tried in the same order they are input, and it will stop on the first provider who doesn't fail. |
| `showOriginalResponse` | `boolean` | No | If set, the response will include the original response of the provider. |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "eden_ai",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "eden_ai-generate-image",
  arguments: {
    text: "Text",
    resolution: "Resolution",
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "eden_ai-generate-image",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    eden_ai: { authProvisionId: "apn_xxxxxxx" },
    text: "Text",
    resolution: "Resolution",
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "eden_ai-generate-image",
    "configured_props": {
      "eden_ai": { "authProvisionId": "apn_xxxxxxx" },
      "text": "Text",
      "resolution": "Resolution"
    }
  }'
```

---

- App: https://pipedream.com/apps/eden-ai.md · All apps: https://pipedream.com/apps
