> ## Documentation Index
> Fetch the complete documentation index at: https://docs.portkey.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Recraft AI

Portkey provides a robust and secure gateway to facilitate the integration of various Large Language Models (LLMs) into your applications, including [Recraft AI APIs](https://www.recraft.ai/docs).

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](/product/ai-gateway/virtual-keys) system.

<Note>
  Provider Slug. `recraft-ai`
</Note>

## Portkey SDK Integration with Recraft AI Models

Portkey provides a consistent API to interact with models from various providers. Recraft AI currently has
the following models available for integration:

* `recraftv3`
* `recraftv2`

## Image Generation on Recraft AI using Portkey

Portkey supports the OpenAI signature to make text-to-image requests.

<Tabs>
  <Tab title="NodeJS">
    ```js theme={"system"}
    import Portkey from 'portkey-ai';

    // Initialize the Portkey client
    const portkey = new Portkey({
        apiKey: "PORTKEY_API_KEY",  // Replace with your Portkey API key
        provider: "recraft-ai",
        Authorization: "RECRAFT_API_KEY"
    });

    async function main() {
      const image = await portkey.images.generate({
        model: "recraftv3",
        prompt: "Lucy in the sky with diamonds",
        style: 'digital_illustration',
      });

      console.log(image.data);
    }

    main();
    ```
  </Tab>

  <Tab title="Python">
    ```py theme={"system"}
    from portkey_ai import Portkey
    from IPython.display import display, Image

    # Initialize the Portkey client
    portkey = Portkey(
        api_key="PORTKEY_API_KEY",  # Replace with your Portkey API key
        provider= "recraft-ai",
        Authorization= "RECRAFT_API_KEY"
    )

    response = client.images.generate(
        model="recraftv3",
        prompt='race car on a track',
        style='digital_illustration',
    )
    print(response.data[0].url)

    ```
  </Tab>

  <Tab title="OpenAI NodeJS">
    ```js theme={"system"}
    import OpenAI from 'openai'; // We're using the v4 SDK
    import { PORTKEY_GATEWAY_URL, createHeaders } from 'portkey-ai'

    const client = new OpenAI({
      apiKey: 'RECRAFT_API_KEY', // defaults to process.env["OPENAI_API_KEY"],
      baseURL: PORTKEY_GATEWAY_URL,
      defaultHeaders: createHeaders({
        provider: "recraft-ai",
        apiKey: "PORTKEY_API_KEY" // defaults to process.env["PORTKEY_API_KEY"]
      })
    });

    async function main() {
      const image = await openai.images.generate({
        model: "recraftv3",
        prompt: 'race car on a track',
        style: 'digital_illustration',
      });

      console.log(image.data);
    }

    main();
    ```
  </Tab>

  <Tab title="OpenAI Python">
    ```py theme={"system"}
    from openai import OpenAI
    from portkey_ai import PORTKEY_GATEWAY_URL, createHeaders
    from IPython.display import display, Image

    client = OpenAI(
        api_key='RECRAFT_API_KEY',
        base_url=PORTKEY_GATEWAY_URL,
        default_headers=createHeaders(
            provider="recraft-ai",
            api_key="PORTKEY_API_KEY"
        )
    )

    response = client.images.generate(
        model="recraftv3",
        prompt='race car on a track',
        style='digital_illustration',
    )
    print(response.data[0].url)

    )

    # Display the image
    display(Image(url=image.data[0].url))
    ```
  </Tab>

  <Tab title="cURL">
    ```sh theme={"system"}
    curl "https://api.portkey.ai/v1/images/generations" \
      -H "Content-Type: application/json" \
      -H "x-portkey-api-key: $PORTKEY_API_KEY" \
      -H "x-portkey-provider: recraft-ai" \
      -H "Authorization: Bearer $RECRAFT_API_KEY" \
      -d '{
        "prompt": "Lucy in the sky with diamonds",
        "style": "digital_illustration"
      }'
    ```
  </Tab>
</Tabs>

You'll find more information in the relevant sections:

1. [Add metadata to your requests](/product/observability/metadata)
2. [Add gateway configs to your Recraft AI](/product/ai-gateway/configs)[ requests](/product/ai-gateway/configs)
3. [Tracing Recraft AI requests](/product/observability/traces)
4. [Setup a fallback from OpenAI to Recraft AI APIs](/product/ai-gateway/fallbacks)
