File size: 1,884 Bytes
337c5e2
5d1600c
 
 
 
337c5e2
 
 
 
5d1600c
7bf1603
5d1600c
7bf1603
cdc6f3e
20b00f3
 
 
d5c3e75
 
20b00f3
 
cdc6f3e
 
 
 
b6ae5f9
 
 
 
 
 
 
 
1e599c0
5d1600c
 
 
08437b7
5d1600c
 
 
 
 
 
 
 
 
b6ae5f9
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
---
title: Replicate
emoji: 🚀
colorFrom: blue
colorTo: green
sdk: static
pinned: false
---

# Run AI with an API

Replicate lets developers run, fine-tune, and deploy open models with a production-ready API. On Hugging Face, you can use Replicate as an Inference Provider for popular models across image generation, video generation, speech, and audio.

**Browse Replicate-powered models:** [Run with Replicate](https://huggingface.co/collections/replicate/run-with-replicate-6a04d0792d027edbf66c7155)

**Read the integration docs:** [Replicate on Hugging Face Inference Providers](https://huggingface.co/docs/inference-providers/providers/replicate)

**Reference examples:** [Replicate Inference Provider Examples](https://huggingface.co/spaces/replicate/inference-provider-examples)

**AI & ML interests:** text-to-image, image-to-image, text-to-video, speech, audio, inference providers, fine-tuning

## Why use Replicate on Hugging Face?

Use Replicate infrastructure through Hugging Face's standard Inference Providers interface. You can call image, video, speech, and audio models with the same `InferenceClient`, your existing `HF_TOKEN`, and a provider switch instead of wiring up a separate integration path.

## Get started in 30 seconds

Install the Hub client, set your token, generate an image, and save it locally:

```bash
pip install huggingface_hub pillow
export HF_TOKEN=hf_...
```

```python
import os
from huggingface_hub import InferenceClient

client = InferenceClient(
    provider="replicate",
    api_key=os.environ["HF_TOKEN"],
)

image = client.text_to_image(
    "A cinematic photo of an astronaut riding a horse",
    model="Tongyi-MAI/Z-Image-Turbo",
)

image.save("replicate-astronaut.png")
```

For JavaScript, cURL, and task-specific examples, see the [Replicate provider docs](https://huggingface.co/docs/inference-providers/providers/replicate).