genblaze-openai 0.1.0__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.
@@ -0,0 +1,76 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+
7
+ # Distribution / packaging
8
+ dist/
9
+ build/
10
+ *.egg-info/
11
+ *.egg
12
+ wheels/
13
+ /MANIFEST
14
+
15
+ # Virtual environments
16
+ .venv/
17
+ venv/
18
+ env/
19
+ ENV/
20
+
21
+ # IDE / editors
22
+ .vscode/
23
+ .idea/
24
+ *.swp
25
+ *.swo
26
+ *~
27
+ .project
28
+ .settings/
29
+
30
+ # Testing / coverage
31
+ .pytest_cache/
32
+ .coverage
33
+ .coverage.*
34
+ htmlcov/
35
+ coverage.xml
36
+ *.cover
37
+
38
+ # Type checking
39
+ .mypy_cache/
40
+ .pytype/
41
+ .pyre/
42
+
43
+ # Linting
44
+ .ruff_cache/
45
+
46
+ # OS files
47
+ .DS_Store
48
+ Thumbs.db
49
+ ehthumbs.db
50
+
51
+ # Environment / secrets
52
+ .env
53
+ .env.*
54
+ !.env.example
55
+ *.pem
56
+ *.key
57
+ credentials.json
58
+
59
+ # Jupyter
60
+ .ipynb_checkpoints/
61
+
62
+ # MkDocs build output
63
+ site/
64
+
65
+ # Claude Code — local/ephemeral
66
+ .claude/settings.local.json
67
+ .claude/worktrees/
68
+ CLAUDE.local.md
69
+
70
+ # Hypothesis test cache
71
+ .hypothesis/
72
+
73
+ # Temp files
74
+ *.tmp
75
+ *.bak
76
+ *.log
@@ -0,0 +1,132 @@
1
+ Metadata-Version: 2.4
2
+ Name: genblaze-openai
3
+ Version: 0.1.0
4
+ Summary: OpenAI provider adapters for genblaze (Sora, DALL-E, TTS)
5
+ Project-URL: Documentation, https://github.com/backblaze-labs/genblaze
6
+ Project-URL: Repository, https://github.com/backblaze-labs/genblaze
7
+ Project-URL: Issues, https://github.com/backblaze-labs/genblaze/issues
8
+ License-Expression: MIT
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Typing :: Typed
12
+ Requires-Python: >=3.11
13
+ Requires-Dist: genblaze-core<0.2,>=0.1.0
14
+ Requires-Dist: openai>=1.0
15
+ Provides-Extra: dev
16
+ Requires-Dist: pytest>=7.0; extra == 'dev'
17
+ Description-Content-Type: text/markdown
18
+
19
+ <!-- last_verified: 2026-04-22 -->
20
+ # genblaze-openai
21
+
22
+ **OpenAI provider adapters for [genblaze](https://github.com/backblaze-labs/genblaze) — [Sora](https://openai.com/sora) text-to-video, DALL·E / gpt-image text-to-image, and TTS text-to-speech — with SHA-256 provenance manifests on every output.**
23
+
24
+ `genblaze-openai` wraps OpenAI's generative media APIs (Sora video, DALL·E 3 and gpt-image-1 images, `tts-1` / `tts-1-hd` / `gpt-4o-mini-tts` audio) as genblaze providers. Compose them into multi-step AI pipelines, persist outputs to [Backblaze B2](https://www.backblaze.com/cloud-storage?utm_source=github&utm_medium=referral&utm_campaign=ai_artifacts&utm_content=genblaze) or any S3-compatible store, and emit a tamper-evident provenance manifest for every run.
25
+
26
+ ## Why genblaze-openai
27
+
28
+ - **Three OpenAI modalities, one SDK** — video (Sora), image (DALL·E, gpt-image), audio (TTS) — same `Pipeline` API.
29
+ - **Built-in provenance** — Every Sora render / DALL·E image / TTS clip lands with a SHA-256-verified manifest.
30
+ - **Swap models without rewrites** — Same pipeline works with Runway, Luma, Flux, Veo, ElevenLabs, etc.
31
+ - **Production-ready** — Retries, timeouts, moderation hooks, step caching, streaming events.
32
+ - **Durable storage** — Plug `genblaze-s3` in for B2 / AWS S3 / R2 / MinIO persistence.
33
+
34
+ ## Providers + models
35
+
36
+ | Provider class | Modality | Models |
37
+ |---|---|---|
38
+ | `SoraProvider` | video | `sora-2`, `sora-2-pro` |
39
+ | `DalleProvider` | image | `gpt-image-1`, `dall-e-3`, `dall-e-2` (+ edits) |
40
+ | `OpenAITTSProvider` | audio | `tts-1`, `tts-1-hd`, `gpt-4o-mini-tts` |
41
+
42
+ Each is registered via entry points (`openai-sora`, `openai-dalle`, `openai-tts`).
43
+
44
+ ## Install
45
+
46
+ ```bash
47
+ pip install genblaze-openai
48
+ ```
49
+
50
+ ## Quickstart — Sora text-to-video
51
+
52
+ ```bash
53
+ export OPENAI_API_KEY="sk-..."
54
+ ```
55
+
56
+ ```python
57
+ from genblaze_core import Modality, Pipeline
58
+ from genblaze_openai import SoraProvider
59
+
60
+ run, manifest = (
61
+ Pipeline("sora-demo")
62
+ .step(SoraProvider(), model="sora-2",
63
+ prompt="A cinematic drone shot gliding over a misty mountain valley at sunrise",
64
+ modality=Modality.VIDEO, seconds=4, size="1280x720")
65
+ .run(timeout=300)
66
+ )
67
+ print(run.steps[0].assets[0].url, manifest.canonical_hash)
68
+ ```
69
+
70
+ ## Quickstart — DALL·E text-to-image
71
+
72
+ ```python
73
+ from genblaze_openai import DalleProvider
74
+
75
+ run, manifest = (
76
+ Pipeline("dalle-demo")
77
+ .step(DalleProvider(), model="dall-e-3",
78
+ prompt="A watercolor painting of a cozy bookshop on a rainy evening",
79
+ modality=Modality.IMAGE, size="1024x1024", quality="hd")
80
+ .run(timeout=120)
81
+ )
82
+ ```
83
+
84
+ ## Quickstart — OpenAI TTS
85
+
86
+ ```python
87
+ from genblaze_openai import OpenAITTSProvider
88
+
89
+ run, manifest = (
90
+ Pipeline("tts-demo")
91
+ .step(OpenAITTSProvider(output_dir="output/audio"),
92
+ model="tts-1-hd",
93
+ prompt="Welcome to Genblaze — generative media pipelines with provenance.",
94
+ modality=Modality.AUDIO, voice="nova", response_format="mp3")
95
+ .run(timeout=60)
96
+ )
97
+ ```
98
+
99
+ ## Persist to Backblaze B2
100
+
101
+ ```python
102
+ from genblaze_core import KeyStrategy, ObjectStorageSink
103
+ from genblaze_s3 import S3StorageBackend
104
+
105
+ storage = ObjectStorageSink(
106
+ S3StorageBackend.for_backblaze("my-bucket"),
107
+ key_strategy=KeyStrategy.HIERARCHICAL,
108
+ )
109
+ # …then pass sink=storage to .run(…)
110
+ ```
111
+
112
+ See [Backblaze B2](https://www.backblaze.com/cloud-storage?utm_source=github&utm_medium=referral&utm_campaign=ai_artifacts&utm_content=genblaze) — the recommended default sink for genblaze.
113
+
114
+ ## Credentials
115
+
116
+ | Env var | Where to get it |
117
+ |---|---|
118
+ | `OPENAI_API_KEY` | https://platform.openai.com/api-keys |
119
+
120
+ ## Documentation
121
+
122
+ - **Main repo**: https://github.com/backblaze-labs/genblaze
123
+ - **Examples**: [`sora_video_pipeline.py`](https://github.com/backblaze-labs/genblaze/blob/main/examples/sora_video_pipeline.py) · [`dalle_image_pipeline.py`](https://github.com/backblaze-labs/genblaze/blob/main/examples/dalle_image_pipeline.py) · [`tts_audio_pipeline.py`](https://github.com/backblaze-labs/genblaze/blob/main/examples/tts_audio_pipeline.py)
124
+
125
+ ## Related packages
126
+
127
+ - [`genblaze-core`](https://pypi.org/project/genblaze-core/) — the pipeline SDK
128
+ - [`genblaze-s3`](https://pypi.org/project/genblaze-s3/) — durable storage on Backblaze B2 and other S3-compatible backends
129
+
130
+ ## License
131
+
132
+ MIT
@@ -0,0 +1,114 @@
1
+ <!-- last_verified: 2026-04-22 -->
2
+ # genblaze-openai
3
+
4
+ **OpenAI provider adapters for [genblaze](https://github.com/backblaze-labs/genblaze) — [Sora](https://openai.com/sora) text-to-video, DALL·E / gpt-image text-to-image, and TTS text-to-speech — with SHA-256 provenance manifests on every output.**
5
+
6
+ `genblaze-openai` wraps OpenAI's generative media APIs (Sora video, DALL·E 3 and gpt-image-1 images, `tts-1` / `tts-1-hd` / `gpt-4o-mini-tts` audio) as genblaze providers. Compose them into multi-step AI pipelines, persist outputs to [Backblaze B2](https://www.backblaze.com/cloud-storage?utm_source=github&utm_medium=referral&utm_campaign=ai_artifacts&utm_content=genblaze) or any S3-compatible store, and emit a tamper-evident provenance manifest for every run.
7
+
8
+ ## Why genblaze-openai
9
+
10
+ - **Three OpenAI modalities, one SDK** — video (Sora), image (DALL·E, gpt-image), audio (TTS) — same `Pipeline` API.
11
+ - **Built-in provenance** — Every Sora render / DALL·E image / TTS clip lands with a SHA-256-verified manifest.
12
+ - **Swap models without rewrites** — Same pipeline works with Runway, Luma, Flux, Veo, ElevenLabs, etc.
13
+ - **Production-ready** — Retries, timeouts, moderation hooks, step caching, streaming events.
14
+ - **Durable storage** — Plug `genblaze-s3` in for B2 / AWS S3 / R2 / MinIO persistence.
15
+
16
+ ## Providers + models
17
+
18
+ | Provider class | Modality | Models |
19
+ |---|---|---|
20
+ | `SoraProvider` | video | `sora-2`, `sora-2-pro` |
21
+ | `DalleProvider` | image | `gpt-image-1`, `dall-e-3`, `dall-e-2` (+ edits) |
22
+ | `OpenAITTSProvider` | audio | `tts-1`, `tts-1-hd`, `gpt-4o-mini-tts` |
23
+
24
+ Each is registered via entry points (`openai-sora`, `openai-dalle`, `openai-tts`).
25
+
26
+ ## Install
27
+
28
+ ```bash
29
+ pip install genblaze-openai
30
+ ```
31
+
32
+ ## Quickstart — Sora text-to-video
33
+
34
+ ```bash
35
+ export OPENAI_API_KEY="sk-..."
36
+ ```
37
+
38
+ ```python
39
+ from genblaze_core import Modality, Pipeline
40
+ from genblaze_openai import SoraProvider
41
+
42
+ run, manifest = (
43
+ Pipeline("sora-demo")
44
+ .step(SoraProvider(), model="sora-2",
45
+ prompt="A cinematic drone shot gliding over a misty mountain valley at sunrise",
46
+ modality=Modality.VIDEO, seconds=4, size="1280x720")
47
+ .run(timeout=300)
48
+ )
49
+ print(run.steps[0].assets[0].url, manifest.canonical_hash)
50
+ ```
51
+
52
+ ## Quickstart — DALL·E text-to-image
53
+
54
+ ```python
55
+ from genblaze_openai import DalleProvider
56
+
57
+ run, manifest = (
58
+ Pipeline("dalle-demo")
59
+ .step(DalleProvider(), model="dall-e-3",
60
+ prompt="A watercolor painting of a cozy bookshop on a rainy evening",
61
+ modality=Modality.IMAGE, size="1024x1024", quality="hd")
62
+ .run(timeout=120)
63
+ )
64
+ ```
65
+
66
+ ## Quickstart — OpenAI TTS
67
+
68
+ ```python
69
+ from genblaze_openai import OpenAITTSProvider
70
+
71
+ run, manifest = (
72
+ Pipeline("tts-demo")
73
+ .step(OpenAITTSProvider(output_dir="output/audio"),
74
+ model="tts-1-hd",
75
+ prompt="Welcome to Genblaze — generative media pipelines with provenance.",
76
+ modality=Modality.AUDIO, voice="nova", response_format="mp3")
77
+ .run(timeout=60)
78
+ )
79
+ ```
80
+
81
+ ## Persist to Backblaze B2
82
+
83
+ ```python
84
+ from genblaze_core import KeyStrategy, ObjectStorageSink
85
+ from genblaze_s3 import S3StorageBackend
86
+
87
+ storage = ObjectStorageSink(
88
+ S3StorageBackend.for_backblaze("my-bucket"),
89
+ key_strategy=KeyStrategy.HIERARCHICAL,
90
+ )
91
+ # …then pass sink=storage to .run(…)
92
+ ```
93
+
94
+ See [Backblaze B2](https://www.backblaze.com/cloud-storage?utm_source=github&utm_medium=referral&utm_campaign=ai_artifacts&utm_content=genblaze) — the recommended default sink for genblaze.
95
+
96
+ ## Credentials
97
+
98
+ | Env var | Where to get it |
99
+ |---|---|
100
+ | `OPENAI_API_KEY` | https://platform.openai.com/api-keys |
101
+
102
+ ## Documentation
103
+
104
+ - **Main repo**: https://github.com/backblaze-labs/genblaze
105
+ - **Examples**: [`sora_video_pipeline.py`](https://github.com/backblaze-labs/genblaze/blob/main/examples/sora_video_pipeline.py) · [`dalle_image_pipeline.py`](https://github.com/backblaze-labs/genblaze/blob/main/examples/dalle_image_pipeline.py) · [`tts_audio_pipeline.py`](https://github.com/backblaze-labs/genblaze/blob/main/examples/tts_audio_pipeline.py)
106
+
107
+ ## Related packages
108
+
109
+ - [`genblaze-core`](https://pypi.org/project/genblaze-core/) — the pipeline SDK
110
+ - [`genblaze-s3`](https://pypi.org/project/genblaze-s3/) — durable storage on Backblaze B2 and other S3-compatible backends
111
+
112
+ ## License
113
+
114
+ MIT
@@ -0,0 +1,7 @@
1
+ """OpenAI provider adapters for genblaze (Sora video, DALL-E image, TTS audio)."""
2
+
3
+ from genblaze_openai.dalle import DalleProvider
4
+ from genblaze_openai.provider import SoraProvider
5
+ from genblaze_openai.tts import OpenAITTSProvider
6
+
7
+ __all__ = ["SoraProvider", "DalleProvider", "OpenAITTSProvider"]
@@ -0,0 +1,9 @@
1
+ """Shared OpenAI error mapping — used by dalle.py, provider.py, tts.py."""
2
+
3
+ from genblaze_core.models.enums import ProviderErrorCode
4
+ from genblaze_core.providers.base import classify_api_error
5
+
6
+
7
+ def map_openai_error(exc: Exception) -> ProviderErrorCode:
8
+ """Map an OpenAI API exception to a ProviderErrorCode."""
9
+ return classify_api_error(exc)