# AI Service Integration

The SmartPasteButton requires an AI service endpoint that processes clipboard text and returns structured values for the form fields.

In the demos, the SmartPasteButton is configured with the Telerik demo AI service.

## Configuring the SmartPasteButton Service

```Razor HtmlHelper
@(Html.Kendo().SmartPasteButton()
    .Name("smartPasteButton")
    .Service("https://demos.telerik.com/service/v2/ai/smartpaste/smartpaste")
    .Text("Smart Paste")
)
```

```Razor TagHelper
@addTagHelper *, Kendo.Mvc

<kendo-smartpastebutton name="smartPasteButton"
                        text="Smart Paste">
    <service url="https://demos.telerik.com/service/v2/ai/smartpaste/smartpaste" />
</kendo-smartpastebutton>
```

## Using the Service through the Form SmartPaste Configuration

```Razor HtmlHelper
@(Html.Kendo().Form<ResponsiveFormViewModel>()
    .Name("responsiveForm")
    .Orientation("vertical")
    .ClearButton(true)
    .SmartPaste(s => s
        .Name("smartPaste")
        .Service("https://demos.telerik.com/service/v2/ai/smartpaste/smartpaste")
        .Text("Smart Paste")
        .Events(e => e.RequestStart("onRequestStart").RequestEnd("onRequestEnd").Error("onError"))
    )
)
```

```Razor TagHelper
@addTagHelper *, Kendo.Mvc

<kendo-form name="responsiveForm"
            orientation="vertical"
            clear-button="true">

    <form-smart-paste
                 text="Smart Paste"
                 on-request-start="onRequestStart"
                 on-request-end="onRequestEnd"
                 on-error="onError">
        <service url="https://demos.telerik.com/service/v2/ai/smartpaste/smartpaste" />
    </form-smart-paste>

</kendo-form>
```

> When using the SmartPaste configuration through the Form TagHelper (`form-smart-paste`), the available event handler attributes are `on-request-start` and `on-request-end`.

## See Also

* [SmartPasteButton Overview](https://www.telerik.com/aspnet-core-ui/documentation/html-helpers/navigation/smartpastebutton/overview)

* [Events of the SmartPasteButton](https://www.telerik.com/aspnet-core-ui/documentation/html-helpers/navigation/smartpastebutton/events)

* [Error Handling](https://www.telerik.com/aspnet-core-ui/documentation/html-helpers/navigation/smartpastebutton/error-handling)

* [Server-Side API of the SmartPasteButton ](https://www.telerik.com/aspnet-core-ui/documentation/api/smartpastebutton)

* [Server-Side API of the SmartPasteButton TagHelper](https://www.telerik.com/aspnet-core-ui/documentation/api/taghelpers/smartpastebutton)

* [Knowledge Base Section](https://www.telerik.com/aspnet-core-ui/documentation/knowledge-base)
