wavespeed 0.0.2__tar.gz → 0.0.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2025 Wavespeed AI
3
+ Copyright (c) 2025 WaveSpeed AI
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wavespeed
3
- Version: 0.0.2
4
- Summary: Python client for Wavespeed
5
- Author: Wavespeed, Inc.
3
+ Version: 0.0.4
4
+ Summary: Python client for WaveSpeed AI
5
+ Author: WaveSpeed AI
6
6
  License: MIT License
7
7
 
8
- Copyright (c) 2025 Wavespeed AI
8
+ Copyright (c) 2025 WaveSpeed AI
9
9
 
10
10
  Permission is hereby granted, free of charge, to any person obtaining a copy
11
11
  of this software and associated documentation files (the "Software"), to deal
@@ -35,9 +35,9 @@ Requires-Dist: pydantic>1.10.7
35
35
  Requires-Dist: typing_extensions>=4.5.0
36
36
  Dynamic: license-file
37
37
 
38
- # Wavespeed Python Client
38
+ # WaveSpeed Python Client
39
39
 
40
- A Python client for interacting with the Wavespeed AI API.
40
+ A Python client for interacting with the WaveSpeed AI API.
41
41
 
42
42
  ## Installation
43
43
 
@@ -50,10 +50,10 @@ pip install wavespeed
50
50
  ### Synchronous Image Generation
51
51
 
52
52
  ```python
53
- from wavespeed import Wavespeed
53
+ from wavespeed import WaveSpeed
54
54
 
55
55
  # Initialize the client with your API key (or set WAVESPEED_API_KEY environment variable)
56
- client = Wavespeed(api_key="YOUR_API_KEY")
56
+ client = WaveSpeed(api_key="YOUR_API_KEY")
57
57
 
58
58
  # Generate an image and wait for the result
59
59
  prediction = client.run(
@@ -78,11 +78,11 @@ for i, img_url in enumerate(prediction.outputs):
78
78
 
79
79
  ```python
80
80
  import asyncio
81
- from wavespeed import Wavespeed
81
+ from wavespeed import WaveSpeed
82
82
 
83
83
  async def generate_image():
84
84
  # Initialize the client with your API key (or set WAVESPEED_API_KEY environment variable)
85
- client = Wavespeed(api_key="YOUR_API_KEY")
85
+ client = WaveSpeed(api_key="YOUR_API_KEY")
86
86
 
87
87
  try:
88
88
  # Generate an image and wait for the result
@@ -115,10 +115,10 @@ asyncio.run(generate_image())
115
115
  You can also create a prediction without waiting for it to complete:
116
116
 
117
117
  ```python
118
- from wavespeed import Wavespeed
118
+ from wavespeed import WaveSpeed
119
119
 
120
120
  # Initialize the client with your API key (or set WAVESPEED_API_KEY environment variable)
121
- client = Wavespeed(api_key="YOUR_API_KEY")
121
+ client = WaveSpeed(api_key="YOUR_API_KEY")
122
122
 
123
123
  # Create a prediction without waiting
124
124
  prediction = client.create(
@@ -189,15 +189,15 @@ python examples/create_generate_image.py --prompt "A futuristic cityscape with f
189
189
 
190
190
  ## API Reference
191
191
 
192
- ### Wavespeed Client
192
+ ### WaveSpeed Client
193
193
 
194
194
  ```python
195
- Wavespeed(api_key)
195
+ WaveSpeed(api_key)
196
196
  ```
197
197
 
198
198
  #### Parameters:
199
199
 
200
- - `api_key` (str): Your Wavespeed API key
200
+ - `api_key` (str): Your WaveSpeed API key
201
201
 
202
202
  ### Methods
203
203
 
@@ -241,8 +241,10 @@ The `Prediction` object contains information about an image generation job:
241
241
  prediction.id # Unique ID of the prediction
242
242
  prediction.model # Model ID used for the prediction
243
243
  prediction.status # Status of the prediction (processing, completed, failed)
244
- prediction.outputs # List of output image URLs
245
244
  prediction.input # Input parameters used for the prediction
245
+ prediction.outputs # List of output image URLs
246
+ prediction.urls.get # URL to get the prediction status
247
+ prediction.has_nsfw_contents # List of booleans indicating if each image has NSFW content
246
248
  prediction.created_at # Creation timestamp
247
249
  prediction.error # Error message (if any)
248
250
  prediction.executionTime # Time taken to execute the prediction in milliseconds
@@ -261,7 +263,7 @@ await prediction.async_reload() -> Prediction
261
263
 
262
264
  ## Environment Variables
263
265
 
264
- - `WAVESPEED_API_KEY`: Your Wavespeed API key
266
+ - `WAVESPEED_API_KEY`: Your WaveSpeed API key
265
267
  - `WAVESPEED_POLL_INTERVAL`: Interval in seconds for polling prediction status (default: 1)
266
268
  - `WAVESPEED_TIMEOUT`: Timeout in seconds for API requests (default: 60)
267
269
 
@@ -1,6 +1,6 @@
1
- # Wavespeed Python Client
1
+ # WaveSpeed Python Client
2
2
 
3
- A Python client for interacting with the Wavespeed AI API.
3
+ A Python client for interacting with the WaveSpeed AI API.
4
4
 
5
5
  ## Installation
6
6
 
@@ -13,10 +13,10 @@ pip install wavespeed
13
13
  ### Synchronous Image Generation
14
14
 
15
15
  ```python
16
- from wavespeed import Wavespeed
16
+ from wavespeed import WaveSpeed
17
17
 
18
18
  # Initialize the client with your API key (or set WAVESPEED_API_KEY environment variable)
19
- client = Wavespeed(api_key="YOUR_API_KEY")
19
+ client = WaveSpeed(api_key="YOUR_API_KEY")
20
20
 
21
21
  # Generate an image and wait for the result
22
22
  prediction = client.run(
@@ -41,11 +41,11 @@ for i, img_url in enumerate(prediction.outputs):
41
41
 
42
42
  ```python
43
43
  import asyncio
44
- from wavespeed import Wavespeed
44
+ from wavespeed import WaveSpeed
45
45
 
46
46
  async def generate_image():
47
47
  # Initialize the client with your API key (or set WAVESPEED_API_KEY environment variable)
48
- client = Wavespeed(api_key="YOUR_API_KEY")
48
+ client = WaveSpeed(api_key="YOUR_API_KEY")
49
49
 
50
50
  try:
51
51
  # Generate an image and wait for the result
@@ -78,10 +78,10 @@ asyncio.run(generate_image())
78
78
  You can also create a prediction without waiting for it to complete:
79
79
 
80
80
  ```python
81
- from wavespeed import Wavespeed
81
+ from wavespeed import WaveSpeed
82
82
 
83
83
  # Initialize the client with your API key (or set WAVESPEED_API_KEY environment variable)
84
- client = Wavespeed(api_key="YOUR_API_KEY")
84
+ client = WaveSpeed(api_key="YOUR_API_KEY")
85
85
 
86
86
  # Create a prediction without waiting
87
87
  prediction = client.create(
@@ -152,15 +152,15 @@ python examples/create_generate_image.py --prompt "A futuristic cityscape with f
152
152
 
153
153
  ## API Reference
154
154
 
155
- ### Wavespeed Client
155
+ ### WaveSpeed Client
156
156
 
157
157
  ```python
158
- Wavespeed(api_key)
158
+ WaveSpeed(api_key)
159
159
  ```
160
160
 
161
161
  #### Parameters:
162
162
 
163
- - `api_key` (str): Your Wavespeed API key
163
+ - `api_key` (str): Your WaveSpeed API key
164
164
 
165
165
  ### Methods
166
166
 
@@ -204,8 +204,10 @@ The `Prediction` object contains information about an image generation job:
204
204
  prediction.id # Unique ID of the prediction
205
205
  prediction.model # Model ID used for the prediction
206
206
  prediction.status # Status of the prediction (processing, completed, failed)
207
- prediction.outputs # List of output image URLs
208
207
  prediction.input # Input parameters used for the prediction
208
+ prediction.outputs # List of output image URLs
209
+ prediction.urls.get # URL to get the prediction status
210
+ prediction.has_nsfw_contents # List of booleans indicating if each image has NSFW content
209
211
  prediction.created_at # Creation timestamp
210
212
  prediction.error # Error message (if any)
211
213
  prediction.executionTime # Time taken to execute the prediction in milliseconds
@@ -224,7 +226,7 @@ await prediction.async_reload() -> Prediction
224
226
 
225
227
  ## Environment Variables
226
228
 
227
- - `WAVESPEED_API_KEY`: Your Wavespeed API key
229
+ - `WAVESPEED_API_KEY`: Your WaveSpeed API key
228
230
  - `WAVESPEED_POLL_INTERVAL`: Interval in seconds for polling prediction status (default: 1)
229
231
  - `WAVESPEED_TIMEOUT`: Timeout in seconds for API requests (default: 60)
230
232
 
@@ -4,11 +4,11 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "wavespeed"
7
- version = "0.0.2"
8
- description = "Python client for Wavespeed"
7
+ version = "0.0.4"
8
+ description = "Python client for WaveSpeed AI"
9
9
  readme = "README.md"
10
10
  license = { file = "LICENSE" }
11
- authors = [{ name = "Wavespeed, Inc." }]
11
+ authors = [{ name = "WaveSpeed AI" }]
12
12
  requires-python = ">=3.8"
13
13
  dependencies = [
14
14
  "httpx>=0.21.0,<1",
@@ -5,23 +5,22 @@ Tests for the Wavespeed client.
5
5
  import pytest
6
6
  import respx
7
7
  from httpx import Response
8
- import asyncio
9
8
  from datetime import datetime
10
9
 
11
- from wavespeed.client import Wavespeed
10
+ from wavespeed.client import WaveSpeed
12
11
  from wavespeed.schemas.prediction import Prediction, PredictionUrls
13
12
 
14
13
 
15
14
  @pytest.fixture
16
15
  def client():
17
16
  """Create a test client with a dummy API key."""
18
- return Wavespeed(api_key="test_api_key")
17
+ return WaveSpeed(api_key="test_api_key")
19
18
 
20
19
 
21
20
  @pytest.fixture
22
21
  async def async_client():
23
22
  """Create a test client with a dummy API key and clean up after test."""
24
- client = Wavespeed(api_key="test_api_key")
23
+ client = WaveSpeed(api_key="test_api_key")
25
24
  yield client
26
25
  await client.close()
27
26
 
@@ -6,11 +6,11 @@ A Python client for interacting with the Wavespeed AI API.
6
6
 
7
7
  __version__ = "0.1.0"
8
8
 
9
- from .client import Wavespeed
9
+ from .client import WaveSpeed
10
10
  from .schemas.prediction import Prediction, PredictionUrls, PredictionResponse
11
11
 
12
12
  __all__ = [
13
- "Wavespeed",
13
+ "WaveSpeed",
14
14
  "Prediction",
15
15
  "PredictionUrls",
16
16
  "PredictionResponse",
@@ -6,33 +6,34 @@ from urllib.parse import urljoin
6
6
  from wavespeed.schemas.prediction import Prediction
7
7
 
8
8
 
9
- class Wavespeed:
9
+ class WaveSpeed:
10
10
  """
11
11
  A client for interacting with the Wavespeed AI API.
12
12
  """
13
13
 
14
- BASE_URL = "https://api.wavespeed.ai/api/v2/"
15
-
16
- def __init__(self, api_key: str):
14
+ def __init__(self, api_key: str="", base_url: str = "https://api.wavespeed.ai/api/v2/", timeout: int | None = None):
17
15
  """
18
- Initialize the Wavespeed client.
16
+ Initialize the WaveSpeed client.
19
17
 
20
18
  Args:
21
- api_key: Your Wavespeed API key
19
+ api_key: Your WaveSpeed API key
20
+ base_url: Base URL for the API
21
+ timeout: Timeout in seconds for http client send request
22
22
  """
23
23
  self.api_key = api_key
24
- if not api_key:
25
- api_key = os.environ.get("WAVESPEED_API_KEY", '')
26
- if not api_key:
24
+ if not self.api_key:
25
+ self.api_key = os.environ.get("WAVESPEED_API_KEY", '')
26
+ if not self.api_key:
27
27
  raise ValueError("API key is required.")
28
28
  self.headers = {
29
29
  "Content-Type": "application/json",
30
- "Authorization": f"Bearer {api_key}"
30
+ "Authorization": f"Bearer {self.api_key}"
31
31
  }
32
- self.async_client = httpx.AsyncClient(headers=self.headers)
33
- self.client = httpx.Client(headers=self.headers)
34
- self.poll_interval = float(os.environ.get("WAVESPEED_POLL_INTERVAL", 1)) # seconds
35
- self.timeout = int(os.environ.get("WAVESPEED_TIMEOUT", 60)) # seconds
32
+ self.async_client = httpx.AsyncClient(headers=self.headers, timeout=timeout)
33
+ self.client = httpx.Client(headers=self.headers, timeout=timeout)
34
+ self.base_url = base_url
35
+ self.timeout = timeout
36
+ self.poll_interval = float(os.environ.get("WAVESPEED_POLL_INTERVAL", 1))
36
37
 
37
38
  async def async_run(
38
39
  self,
@@ -51,7 +52,7 @@ class Wavespeed:
51
52
  Returns:
52
53
  The API response as a dictionary
53
54
  """
54
- url = urljoin(self.BASE_URL, modelId)
55
+ url = urljoin(self.base_url, modelId)
55
56
 
56
57
  payload = input
57
58
 
@@ -63,7 +64,6 @@ class Wavespeed:
63
64
  url,
64
65
  headers=self.headers,
65
66
  json=payload,
66
- timeout=self.timeout
67
67
  )
68
68
 
69
69
  # Raise an exception for HTTP errors
@@ -90,7 +90,7 @@ class Wavespeed:
90
90
  Returns:
91
91
  The API response as a dictionary
92
92
  """
93
- url = urljoin(self.BASE_URL, modelId)
93
+ url = urljoin(self.base_url, modelId)
94
94
 
95
95
  payload = input
96
96
 
@@ -98,7 +98,6 @@ class Wavespeed:
98
98
  url,
99
99
  headers=self.headers,
100
100
  json=payload,
101
- timeout=self.timeout
102
101
  )
103
102
 
104
103
  # Raise an exception for HTTP errors
@@ -109,13 +108,12 @@ class Wavespeed:
109
108
  return prediction.wait()
110
109
 
111
110
  async def async_create(self, modelId: str, input: Dict[str, Any], **kwargs) -> Prediction:
112
- url = urljoin(self.BASE_URL, modelId)
111
+ url = urljoin(self.base_url, modelId)
113
112
  payload = input
114
113
  response = await self.async_client.post(
115
114
  url,
116
115
  headers=self.headers,
117
116
  json=payload,
118
- timeout=self.timeout
119
117
  )
120
118
  # Raise an exception for HTTP errors
121
119
  response.raise_for_status()
@@ -125,13 +123,12 @@ class Wavespeed:
125
123
  return prediction
126
124
 
127
125
  def create(self, modelId: str, input: Dict[str, Any], **kwargs) -> Prediction:
128
- url = urljoin(self.BASE_URL, modelId)
126
+ url = urljoin(self.base_url, modelId)
129
127
  payload = input
130
128
  response = self.client.post(
131
129
  url,
132
130
  headers=self.headers,
133
131
  json=payload,
134
- timeout=self.timeout
135
132
  )
136
133
  # Raise an exception for HTTP errors
137
134
  response.raise_for_status()
@@ -147,4 +144,4 @@ class Wavespeed:
147
144
 
148
145
  def __str__(self) -> str:
149
146
  """String representation of the client."""
150
- return f"WavespeedClient()"
147
+ return f"WaveSpeed()"
@@ -7,7 +7,7 @@ from pydantic import BaseModel, Field
7
7
  import pydantic
8
8
  from typing import TYPE_CHECKING
9
9
  if TYPE_CHECKING:
10
- from wavespeed.client import Wavespeed
10
+ from wavespeed.client import WaveSpeed
11
11
 
12
12
  class PredictionUrls(BaseModel):
13
13
  """URLs associated with a prediction."""
@@ -16,7 +16,7 @@ class PredictionUrls(BaseModel):
16
16
 
17
17
  class Prediction(BaseModel):
18
18
  """Response from a prediction API call."""
19
- _client: "Wavespeed" = pydantic.PrivateAttr()
19
+ _client: "WaveSpeed" = pydantic.PrivateAttr()
20
20
 
21
21
  id: str
22
22
  model: str
@@ -1,11 +1,11 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: wavespeed
3
- Version: 0.0.2
4
- Summary: Python client for Wavespeed
5
- Author: Wavespeed, Inc.
3
+ Version: 0.0.4
4
+ Summary: Python client for WaveSpeed AI
5
+ Author: WaveSpeed AI
6
6
  License: MIT License
7
7
 
8
- Copyright (c) 2025 Wavespeed AI
8
+ Copyright (c) 2025 WaveSpeed AI
9
9
 
10
10
  Permission is hereby granted, free of charge, to any person obtaining a copy
11
11
  of this software and associated documentation files (the "Software"), to deal
@@ -35,9 +35,9 @@ Requires-Dist: pydantic>1.10.7
35
35
  Requires-Dist: typing_extensions>=4.5.0
36
36
  Dynamic: license-file
37
37
 
38
- # Wavespeed Python Client
38
+ # WaveSpeed Python Client
39
39
 
40
- A Python client for interacting with the Wavespeed AI API.
40
+ A Python client for interacting with the WaveSpeed AI API.
41
41
 
42
42
  ## Installation
43
43
 
@@ -50,10 +50,10 @@ pip install wavespeed
50
50
  ### Synchronous Image Generation
51
51
 
52
52
  ```python
53
- from wavespeed import Wavespeed
53
+ from wavespeed import WaveSpeed
54
54
 
55
55
  # Initialize the client with your API key (or set WAVESPEED_API_KEY environment variable)
56
- client = Wavespeed(api_key="YOUR_API_KEY")
56
+ client = WaveSpeed(api_key="YOUR_API_KEY")
57
57
 
58
58
  # Generate an image and wait for the result
59
59
  prediction = client.run(
@@ -78,11 +78,11 @@ for i, img_url in enumerate(prediction.outputs):
78
78
 
79
79
  ```python
80
80
  import asyncio
81
- from wavespeed import Wavespeed
81
+ from wavespeed import WaveSpeed
82
82
 
83
83
  async def generate_image():
84
84
  # Initialize the client with your API key (or set WAVESPEED_API_KEY environment variable)
85
- client = Wavespeed(api_key="YOUR_API_KEY")
85
+ client = WaveSpeed(api_key="YOUR_API_KEY")
86
86
 
87
87
  try:
88
88
  # Generate an image and wait for the result
@@ -115,10 +115,10 @@ asyncio.run(generate_image())
115
115
  You can also create a prediction without waiting for it to complete:
116
116
 
117
117
  ```python
118
- from wavespeed import Wavespeed
118
+ from wavespeed import WaveSpeed
119
119
 
120
120
  # Initialize the client with your API key (or set WAVESPEED_API_KEY environment variable)
121
- client = Wavespeed(api_key="YOUR_API_KEY")
121
+ client = WaveSpeed(api_key="YOUR_API_KEY")
122
122
 
123
123
  # Create a prediction without waiting
124
124
  prediction = client.create(
@@ -189,15 +189,15 @@ python examples/create_generate_image.py --prompt "A futuristic cityscape with f
189
189
 
190
190
  ## API Reference
191
191
 
192
- ### Wavespeed Client
192
+ ### WaveSpeed Client
193
193
 
194
194
  ```python
195
- Wavespeed(api_key)
195
+ WaveSpeed(api_key)
196
196
  ```
197
197
 
198
198
  #### Parameters:
199
199
 
200
- - `api_key` (str): Your Wavespeed API key
200
+ - `api_key` (str): Your WaveSpeed API key
201
201
 
202
202
  ### Methods
203
203
 
@@ -241,8 +241,10 @@ The `Prediction` object contains information about an image generation job:
241
241
  prediction.id # Unique ID of the prediction
242
242
  prediction.model # Model ID used for the prediction
243
243
  prediction.status # Status of the prediction (processing, completed, failed)
244
- prediction.outputs # List of output image URLs
245
244
  prediction.input # Input parameters used for the prediction
245
+ prediction.outputs # List of output image URLs
246
+ prediction.urls.get # URL to get the prediction status
247
+ prediction.has_nsfw_contents # List of booleans indicating if each image has NSFW content
246
248
  prediction.created_at # Creation timestamp
247
249
  prediction.error # Error message (if any)
248
250
  prediction.executionTime # Time taken to execute the prediction in milliseconds
@@ -261,7 +263,7 @@ await prediction.async_reload() -> Prediction
261
263
 
262
264
  ## Environment Variables
263
265
 
264
- - `WAVESPEED_API_KEY`: Your Wavespeed API key
266
+ - `WAVESPEED_API_KEY`: Your WaveSpeed API key
265
267
  - `WAVESPEED_POLL_INTERVAL`: Interval in seconds for polling prediction status (default: 1)
266
268
  - `WAVESPEED_TIMEOUT`: Timeout in seconds for API requests (default: 60)
267
269
 
File without changes