66pip install replicate
77```
88
9- ## Quick Start
9+ ## Quick start
1010
1111``` python
1212import replicate
@@ -24,7 +24,7 @@ text = claude(prompt="Write a haiku about Python")
2424print (text) # "Code flows like water..."
2525```
2626
27- ## Client Initialization
27+ ## Client initialization
2828
2929By default, the SDK uses the ` REPLICATE_API_TOKEN ` environment variable:
3030
@@ -35,7 +35,7 @@ import replicate
3535image_url = replicate.run(" google/nano-banana" , input = {" prompt" : " hello" })
3636```
3737
38- ### Custom Client Configuration
38+ ### Custom client configuration
3939
4040For advanced use cases, you can create an explicit client instance:
4141
@@ -55,7 +55,7 @@ replicate = Replicate(
5555image_url = replicate.run(" google/nano-banana" , input = {" prompt" : " hello" })
5656```
5757
58- ### Asynchronous Client
58+ ### Asynchronous client
5959
6060``` python
6161from replicate import AsyncReplicate
@@ -74,9 +74,9 @@ async def main():
7474asyncio.run(main())
7575```
7676
77- ## High-Level Methods
77+ ## High-level methods
7878
79- ### use() - Create a Reusable Model Function (Recommended )
79+ ### use() - Create a reusable model function (recommended )
8080
8181The most Pythonic way to interact with models. Creates a callable function for any model.
8282
@@ -110,7 +110,7 @@ model = replicate.use("owner/name") # Latest version
110110model = replicate.use(" 5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa" ) # Version ID
111111```
112112
113- ### run() - Run a Model Once
113+ ### run() - Run a model once
114114
115115Direct method to run a model and get output. Good for one-off predictions.
116116
@@ -135,7 +135,7 @@ replicate.run("owner/name", input={}) # Latest version
135135replicate.run(" 5c7d5dc6dd8bf75c1acaa8565735e7986bc5b66206b55cca93cb72c9bf15ccaa" , input = {}) # Version ID
136136```
137137
138- ### stream() - Stream Model Output
138+ ### stream() - Stream model output
139139
140140For models that support streaming (like language models). Returns an iterator of output chunks.
141141
@@ -155,7 +155,7 @@ async for chunk in async_replicate.stream(
155155 print (chunk, end = " " )
156156```
157157
158- ### search() - Search Models
158+ ### search() - Search models
159159
160160Find models by keyword or description.
161161
@@ -167,7 +167,7 @@ for model in results:
167167 print (f " { model.owner} / { model.name} : { model.description} " )
168168```
169169
170- ## Core Resources
170+ ## Core resources
171171
172172### Predictions
173173
@@ -236,7 +236,7 @@ model = replicate.models.create(
236236replicate.models.delete(model_owner = " your-username" , model_name = " my-model" )
237237```
238238
239- #### Model Versions
239+ #### Model versions
240240
241241``` python
242242# List model versions
@@ -261,7 +261,7 @@ replicate.models.versions.delete(
261261)
262262```
263263
264- #### Model Predictions
264+ #### Model predictions
265265
266266Run predictions directly through a model.
267267
@@ -275,7 +275,7 @@ prediction = replicate.models.predictions.create(
275275# prediction.output will be an image URL when complete
276276```
277277
278- #### Model Examples
278+ #### Model examples
279279
280280``` python
281281# Get example predictions for a model
@@ -432,9 +432,9 @@ webhook_secret = replicate.webhooks.default.secret.get()
432432print (f " Webhook signing secret: { webhook_secret.key} " )
433433```
434434
435- ## File Handling
435+ ## File handling
436436
437- ### Input Files
437+ ### Input files
438438
439439The SDK supports multiple ways to provide file inputs:
440440
@@ -459,7 +459,7 @@ text = replicate.run("anthropic/claude-4-sonnet", input={
459459})
460460```
461461
462- ### Output Files
462+ ### Output files
463463
464464File outputs are automatically converted to ` FileOutput ` objects:
465465
@@ -486,7 +486,7 @@ if isinstance(image_url, FileOutput):
486486 f.write(chunk)
487487```
488488
489- ## Error Handling
489+ ## Error handling
490490
491491The SDK provides detailed exception types for error handling:
492492
@@ -541,9 +541,9 @@ if first_page.has_next_page():
541541all_models = list (replicate.models.list())
542542```
543543
544- ## Advanced Features
544+ ## Advanced features
545545
546- ### Raw Response Access
546+ ### Raw response access
547547
548548Access the underlying HTTP response:
549549
@@ -562,7 +562,7 @@ print(f"Headers: {response.headers}")
562562prediction = response.parse()
563563```
564564
565- ### Custom HTTP Client
565+ ### Custom HTTP client
566566
567567Configure a custom HTTP client for Replicate:
568568
@@ -585,7 +585,7 @@ replicate = Replicate(
585585)
586586```
587587
588- ### Retries and Timeouts
588+ ### Retries and timeouts
589589
590590Configure retry behavior and timeouts:
591591
@@ -603,7 +603,7 @@ image_url = replicate.run(
603603)
604604```
605605
606- ### Client Copying
606+ ### Client copying
607607
608608Create a new Replicate instance with modified settings:
609609
@@ -616,7 +616,7 @@ new_replicate = replicate.copy(
616616)
617617```
618618
619- ## Async/Await Support
619+ ## Async/await support
620620
621621All methods have async equivalents when using ` AsyncReplicate ` :
622622
@@ -656,14 +656,14 @@ async def main():
656656asyncio.run(main())
657657```
658658
659- ## Environment Variables
659+ ## Environment variables
660660
661661The SDK respects these environment variables:
662662
663663- ` REPLICATE_API_TOKEN ` - API authentication token
664664- ` REPLICATE_BASE_URL ` - Override the API base URL (default: ` https://api.replicate.com/v1 ` )
665665
666- ## Type Hints
666+ ## Type hints
667667
668668The SDK is fully typed with comprehensive type hints:
669669
@@ -680,9 +680,9 @@ status: PredictionStatus = prediction.status
680680page: SyncCursorURLPage[Prediction] = replicate.predictions.list()
681681```
682682
683- ## Common Patterns
683+ ## Common patterns
684684
685- ### Wait for Completion with Polling
685+ ### Wait for completion with polling
686686
687687``` python
688688import time
@@ -702,7 +702,7 @@ prediction = replicate.predictions.create(model="model:version", input={})
702702result = wait_for_prediction(replicate, prediction.id)
703703```
704704
705- ### Batch Processing
705+ ### Batch processing
706706
707707``` python
708708import asyncio
@@ -723,7 +723,7 @@ prompts = ["prompt 1", "prompt 2", "prompt 3"]
723723results = asyncio.run(batch_process(prompts))
724724```
725725
726- ### Webhook Handling
726+ ### Webhook handling
727727
728728``` python
729729from flask import Flask, request
@@ -761,7 +761,7 @@ def webhook():
761761 return " OK" , 200
762762```
763763
764- ## Migration Guide
764+ ## Migration guide
765765
766766### From v0.x to v1.0+
767767
@@ -798,7 +798,7 @@ model = replicate.models.get(
798798)
799799```
800800
801- ### Using Legacy Authentication
801+ ### Using legacy authentication
802802
803803For compatibility with older code:
804804
0 commit comments