# Recraft V4 Styles Text to Vector

> Generates vector images that hold a consistent style, from either a saved style ID or reference images attached directly.


## Overview

- **Endpoint**: `https://fal.run/recraft/v4/style/text-to-vector`
- **Model ID**: `recraft/v4/style/text-to-vector`
- **Category**: text-to-image
- **Kind**: inference
**Tags**: stylized, transform, editing



## Pricing

Your request will cost **0.05** per generated image when a **style_id** is provided. If no **style_id** is provided, a new style_id will be generated from the provided images and you will be charged **0.005** extra. You will be given a style_id for such a generation.

For more details, see [fal.ai pricing](https://fal.ai/pricing).

## API Information

This model can be used via our HTTP API or more conveniently via our client libraries.
See the input and output schema below, as well as the usage examples.


### Input Schema

The API accepts the following input parameters:


- **`prompt`** (`string`, _required_)
  - Examples: "a cute character fox with cool clothes, 3d flat color, design"

- **`image_size`** (`ImageSize | Enum`, _optional_):
   Default value: `square_hd`
  - Default: `"square_hd"`
  - One of: ImageSize | Enum
  - Examples: "landscape_16_9"

- **`colors`** (`list<RGBColor>`, _optional_):
  An array of preferable colors
  - Default: `[]`
  - Array of RGBColor

- **`background_color`** (`RGBColor`, _optional_):
  The preferable background color of the generated images.

- **`enable_safety_checker`** (`boolean`, _optional_):
  If set to true, the safety checker will be enabled. Disabling it requires account authorization; unauthorized requests are always checked. Default value: `true`
  - Default: `true`

- **`style_id`** (`string`, _optional_):
  The ID of an existing V4 custom style.

- **`image_urls`** (`list<string>`, _optional_):
  The URLs of the style reference images. Supports PNG, JPG, and WEBP; provide between 1 and 10 images.
  - Array of string

- **`style_match`** (`Enum`, _optional_):
  Override how closely the generation follows the custom style.
  - Options: `"precise"`, `"flexible"`



**Required Parameters Example**:

```json
{
  "prompt": "a cute character fox with cool clothes, 3d flat color, design"
}
```

**Full Example**:

```json
{
  "prompt": "a cute character fox with cool clothes, 3d flat color, design",
  "image_size": "landscape_16_9",
  "colors": [],
  "enable_safety_checker": true
}
```


### Output Schema

The API returns the following output format:

- **`images`** (`list<File>`, _required_)
  - Array of File
  - Examples: [{"file_name":"image.svg","file_size":1722022,"content_type":"image/svg+xml","url":"https://v3b.fal.media/files/b/0a8ee4fd/sw8YD36iblpO64JeQZEDt_image.svg"}]

- **`style_id`** (`string`, _optional_):
  The custom style used or created for this generation.



**Example Response**:

```json
{
  "images": [
    {
      "file_name": "image.svg",
      "file_size": 1722022,
      "content_type": "image/svg+xml",
      "url": "https://v3b.fal.media/files/b/0a8ee4fd/sw8YD36iblpO64JeQZEDt_image.svg"
    }
  ]
}
```


## Usage Examples

### cURL

```bash
curl --request POST \
  --url https://fal.run/recraft/v4/style/text-to-vector \
  --header "Authorization: Key $FAL_KEY" \
  --header "Content-Type: application/json" \
  --data '{
     "prompt": "a cute character fox with cool clothes, 3d flat color, design"
   }'
```

### Python

Ensure you have the Python client installed:

```bash
pip install fal-client
```

Then use the API client to make requests:

```python
import fal_client

def on_queue_update(update):
    if isinstance(update, fal_client.InProgress):
        for log in update.logs:
           print(log["message"])

result = fal_client.subscribe(
    "recraft/v4/style/text-to-vector",
    arguments={
        "prompt": "a cute character fox with cool clothes, 3d flat color, design"
    },
    with_logs=True,
    on_queue_update=on_queue_update,
)
print(result)
```

### JavaScript

Ensure you have the JavaScript client installed:

```bash
npm install --save @fal-ai/client
```

Then use the API client to make requests:

```javascript
import { fal } from "@fal-ai/client";

const result = await fal.subscribe("recraft/v4/style/text-to-vector", {
  input: {
    prompt: "a cute character fox with cool clothes, 3d flat color, design"
  },
  logs: true,
  onQueueUpdate: (update) => {
    if (update.status === "IN_PROGRESS") {
      update.logs.map((log) => log.message).forEach(console.log);
    }
  },
});
console.log(result.data);
console.log(result.requestId);
```


## Additional Resources

### Documentation

- [Model Playground](https://fal.ai/models/recraft/v4/style/text-to-vector)
- [API Documentation](https://fal.ai/models/recraft/v4/style/text-to-vector/api)
- [OpenAPI Schema](https://fal.ai/api/openapi/queue/openapi.json?endpoint_id=recraft/v4/style/text-to-vector)

### fal.ai Platform

- [Platform Documentation](https://fal.ai/docs/documentation)
- [Python Client](https://fal.ai/docs/api-reference/client-libraries/python)
- [JavaScript Client](https://fal.ai/docs/api-reference/client-libraries/javascript)

### Other agent-readable surfaces

This file covers one model. To find anything else:

- [Platform overview](https://fal.ai/llms.txt): Entry points and representative endpoint IDs
- [Documentation index](https://fal.ai/docs/llms.txt): Every documentation page
- [Full documentation text](https://fal.ai/docs/llms-full.txt): The whole documentation inlined
- Any other model: `https://fal.ai/models/<endpoint-id>/llms.txt`
