Tarash Gateway
Unified Python SDK for AI video, image, and audio generation
One interface. Multiple providers. Production-ready.
Documentation · Quick Start · Providers
What is Tarash Gateway?
Tarash Gateway abstracts AI media generation across multiple providers behind a single, consistent API. Write one integration and swap providers by changing config — your request code, response handling, and error logic stay identical.
Full documentation at tarash.vertexcover.io
Installation
pip install tarash-gateway[fal]
Install only the provider extras you need:
pip install tarash-gateway[openai] # OpenAI / Azure
pip install tarash-gateway[runway] # Runway
pip install tarash-gateway[elevenlabs] # ElevenLabs TTS
pip install tarash-gateway[fal,runway] # Multiple providers
pip install tarash-gateway[all] # Everything
Requires Python 3.12+ — see the installation guide for details.
Quick Start
Video Generation
from tarash_gateway import VideoGenerationConfig, VideoGenerationRequest, generate_video
config = VideoGenerationConfig(
model="fal-ai/veo3.1/fast",
provider="fal",
api_key="YOUR_FAL_KEY",
)
request = VideoGenerationRequest(
prompt="Sunset over mountains, cinematic",
aspect_ratio="16:9",
duration_seconds=5,
)
response = generate_video(config, request)
print(response.video) # URL to generated video
Switch providers — your request code stays the same:
config = VideoGenerationConfig(
model="gen4_turbo", provider="runway", api_key="YOUR_RUNWAY_KEY",
)
response = generate_video(config, request) # Same request, same response shape
Image Generation
from tarash_gateway import ImageGenerationConfig, ImageGenerationRequest, generate_image
config = ImageGenerationConfig(
model="fal-ai/flux-2/pro",
provider="fal",
api_key="YOUR_FAL_KEY",
)
request = ImageGenerationRequest(
prompt="A futuristic cityscape at dawn, digital art",
aspect_ratio="16:9",
)
response = generate_image(config, request)
print(response.image)
Audio — TTS
from tarash_gateway import AudioGenerationConfig, TTSRequest, generate_tts
config = AudioGenerationConfig(
model="eleven_multilingual_v2",
provider="elevenlabs",
api_key="YOUR_ELEVENLABS_KEY",
)
request = TTSRequest(
text="Hello from Tarash!",
voice_id="your-voice-id",
output_format="mp3_44100_128",
)
response = generate_tts(config, request)
# response.audio — base64-encoded audio
# response.content_type — e.g. "audio/mpeg"
Async & Provider Fallback
Every function has an async variant:
from tarash_gateway import generate_video_async
response = await generate_video_async(config, request)
Set up automatic fallback across providers:
config = VideoGenerationConfig(
model="fal-ai/veo3.1/fast",
provider="fal",
api_key="YOUR_FAL_KEY",
fallback_configs=[
VideoGenerationConfig(
model="gen4_turbo",
provider="runway",
api_key="YOUR_RUNWAY_KEY",
),
],
)
# Falls back to Runway automatically if Fal fails
response = generate_video(config, request)
See the guides for more examples.
Providers
| Provider | Video | Image | Audio |
|---|---|---|---|
| Fal.ai | ✓ | ✓ | ✓ |
| OpenAI | ✓ | ✓ | — |
| ✓ | ✓ | — | |
| Runway | ✓ | — | — |
| Replicate | ✓ | — | — |
| XAI | ✓ | — | — |
| Stability AI | — | ✓ | — |
| ElevenLabs | — | — | ✓ |
| Cartesia | — | — | ✓ |
| Sarvam | — | — | ✓ |
| Hume | — | — | ✓ |
Full model list and provider details at tarash.vertexcover.io/providers
Features
| Feature | Description |
|---|---|
| Sync + Async | Every function has generate_* and generate_*_async variants |
| Provider Fallback | Automatic failover across a prioritized provider chain |
| Progress Callbacks | Real-time updates during long-running generation |
| Type-Safe | Pydantic v2 models with full IDE autocomplete |
| Rich Errors | Every exception includes provider, model, request_id, and raw response |
| Mock Provider | Deterministic fake responses for testing without API calls |
| Structured Logging | Automatic credential redaction and request tracing |
Architecture
tarash_gateway/
├── api.py # Public API
├── models.py # Request/response models
├── exceptions.py # Exception hierarchy
├── orchestrator.py # Fallback and retry orchestration
├── mock.py # Mock provider for testing
├── logging.py # Structured logging
└── providers/ # Provider implementations + field mapper registry
Key design principles:
- All providers implement the same
ProviderHandlerprotocol - Declarative parameter translation via a field mapper registry
- Immutable, thread-safe configuration with frozen Pydantic models
- Every operation available in both sync and async modes
Development
Requirements: Python 3.12+, uv
git clone https://github.com/vertexcover-io/tarash.git
cd tarash
uv sync
# Unit tests (no API keys needed)
uv run pytest packages/tarash-gateway/tests/unit/
# End-to-end tests (requires API keys)
uv run pytest packages/tarash-gateway/tests/e2e/ --e2e
License
MIT — see LICENSE for details.
Metadata
Release files for tarash-gateway 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tarash_gateway-0.1.0.tar.gz | 679.6 kB | Without provenance | Details for tarash_gateway-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tarash_gateway-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for tarash_gateway-0.1.0-py3-none-any.whl |
Total release size: 786.3 kB
Release files / tarash_gateway-0.1.0.tar.gz
| Download URL | tarash_gateway-0.1.0.tar.gz |
|---|---|
| Size | 679.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fa021d205903e223fed2552bebc6aace4b554bbeb021c48050fa6ec47f1d831f
|
|
BLAKE2b-256 checksum How to use checksums |
d019d68af8b4bbcdecadf9ff65c754d9215fc03164a84b056a8e52443a2c2c89
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / tarash_gateway-0.1.0-py3-none-any.whl
| Download URL | tarash_gateway-0.1.0-py3-none-any.whl |
|---|---|
| Size | 106.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
51cc16be879e9216cf2ff67cf0be7c3f596651f25e2396e9856c809a638c3d29
|
|
BLAKE2b-256 checksum How to use checksums |
6397a50ef668c005630260e4c134d37b7b20214ce854069defe82365d96a4cbf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.7 {"installer":{"name":"uv","version":"0.10.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for tarash-gateway 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.