rodiumai 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,9 @@
1
+ # RodiumAI — SDK Configuration
2
+ # Copy this file to .env and fill in your values
3
+
4
+ # Required: Your RodiumAI API key (starts with "rdk-")
5
+ RODIUMAI_API_KEY=rdk-your-api-key-here
6
+
7
+ # Optional: Log level (DEBUG, INFO, WARNING, ERROR)
8
+ # Default: WARNING
9
+ RODIUMAI_LOG_LEVEL=WARNING
@@ -0,0 +1,122 @@
1
+ name: Python SDK
2
+
3
+ on:
4
+ push:
5
+ branches: [main, develop]
6
+ pull_request:
7
+ branches: [main, develop]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - name: Set up Python ${{ matrix.python-version }}
20
+ uses: actions/setup-python@v5
21
+ with:
22
+ python-version: ${{ matrix.python-version }}
23
+
24
+ - name: Install dependencies
25
+ run: |
26
+ pip install --upgrade pip
27
+ pip install -e ".[dev]"
28
+
29
+ - name: Run unit tests
30
+ run: pytest tests/unit --cov=rodiumai --cov-report=xml
31
+
32
+ - name: Run integration tests
33
+ run: pytest tests/integration --cov=rodiumai --cov-report=xml --cov-append
34
+
35
+ - name: Upload coverage to Codecov
36
+ uses: codecov/codecov-action@v4
37
+ with:
38
+ file: ./coverage.xml
39
+ fail_ci_if_error: true
40
+
41
+ lint:
42
+ runs-on: ubuntu-latest
43
+ steps:
44
+ - uses: actions/checkout@v4
45
+
46
+ - name: Set up Python
47
+ uses: actions/setup-python@v5
48
+ with:
49
+ python-version: "3.12"
50
+
51
+ - name: Install dependencies
52
+ run: |
53
+ pip install --upgrade pip
54
+ pip install -e ".[dev]"
55
+
56
+ - name: flake8
57
+ run: flake8 rodiumai/ tests/
58
+
59
+ - name: black
60
+ run: black --check --diff rodiumai/ tests/
61
+
62
+ - name: isort
63
+ run: isort --check-only --diff rodiumai/ tests/
64
+
65
+ - name: mypy
66
+ run: mypy rodiumai/
67
+
68
+ security:
69
+ runs-on: ubuntu-latest
70
+ steps:
71
+ - uses: actions/checkout@v4
72
+
73
+ - name: Set up Python
74
+ uses: actions/setup-python@v5
75
+ with:
76
+ python-version: "3.12"
77
+
78
+ - name: Install dependencies
79
+ run: |
80
+ pip install --upgrade pip
81
+ pip install -e ".[dev]"
82
+
83
+ - name: bandit
84
+ run: bandit -r rodiumai/
85
+
86
+ - name: pip-audit
87
+ run: pip-audit
88
+
89
+ publish:
90
+ if: startsWith(github.ref, 'refs/tags/v')
91
+ needs: [test, lint, security]
92
+ runs-on: ubuntu-latest
93
+ permissions:
94
+ contents: write
95
+ id-token: write
96
+
97
+ steps:
98
+ - uses: actions/checkout@v4
99
+
100
+ - name: Set up Python
101
+ uses: actions/setup-python@v5
102
+ with:
103
+ python-version: "3.12"
104
+
105
+ - name: Install build dependencies
106
+ run: |
107
+ pip install --upgrade pip
108
+ pip install build twine
109
+
110
+ - name: Build package
111
+ run: python -m build
112
+
113
+ - name: Publish to PyPI
114
+ uses: pypa/gh-action-pypi-publish@release/v1
115
+ with:
116
+ password: ${{ secrets.PYPI_API_TOKEN }}
117
+
118
+ - name: Create GitHub Release
119
+ uses: softprops/action-gh-release@v1
120
+ with:
121
+ body_path: CHANGELOG.md
122
+ files: dist/*
@@ -0,0 +1,39 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.egg-info/
5
+ dist/
6
+ build/
7
+ *.egg
8
+
9
+ # Virtual environments
10
+ venv/
11
+ .venv/
12
+ .env
13
+
14
+ # IDE
15
+ .vscode/
16
+ .idea/
17
+
18
+ # Coverage
19
+ .coverage
20
+ htmlcov/
21
+ coverage.xml
22
+
23
+ # Mypy
24
+ .mypy_cache/
25
+
26
+ # Pytest
27
+ .pytest_cache/
28
+
29
+ # OS
30
+ .DS_Store
31
+ Thumbs.db
32
+
33
+ # Tests
34
+ tests/
35
+ test_reel.py
36
+
37
+ # Pip
38
+ pip-log.txt
39
+ pip-delete-failed-directory
@@ -0,0 +1,19 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0 (2026-06-01)
4
+
5
+ ### Initial Release
6
+
7
+ - Chat Completions (standard + streaming SSE)
8
+ - Embeddings (single + batch)
9
+ - Image Generation (text-to-image)
10
+ - Audio (speech-to-text + text-to-speech)
11
+ - Video stub (future-ready, NotImplementedError)
12
+ - Full error hierarchy (8 custom errors)
13
+ - Structured JSON logging with alerts
14
+ - Usage statistics per session
15
+ - Automatic retry with exponential backoff
16
+ - OpenAI drop-in replacement syntax
17
+ - HTTPS enforced, API key masked everywhere
18
+ - 98.5%+ test coverage enforced in CI
19
+ - Multi-architecture Docker support
@@ -0,0 +1,27 @@
1
+ FROM python:3.12-slim-bookworm AS builder
2
+
3
+ WORKDIR /build
4
+
5
+ COPY pyproject.toml README.md ./
6
+ COPY rodiumai/ rodiumai/
7
+
8
+ RUN pip install --no-cache-dir build && \
9
+ python -m build --wheel
10
+
11
+
12
+ FROM python:3.12-slim-bookworm AS runner
13
+
14
+ RUN groupadd -r rodiumai && \
15
+ useradd -r -g rodiumai -d /app -s /sbin/nologin rodiumai
16
+
17
+ WORKDIR /app
18
+
19
+ COPY --from=builder /build/dist/*.whl /tmp/
20
+
21
+ RUN pip install --no-cache-dir /tmp/*.whl && \
22
+ rm /tmp/*.whl && \
23
+ rm -rf /root/.cache
24
+
25
+ USER rodiumai
26
+
27
+ ENTRYPOINT ["python", "-c", "import rodiumai; print(f'RodiumAI SDK v{rodiumai.VERSION}')"]
rodiumai-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 RodiumAI
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,119 @@
1
+ Metadata-Version: 2.4
2
+ Name: rodiumai
3
+ Version: 0.1.0
4
+ Summary: RodiumAI SDK — Unified AI API for Africa
5
+ Project-URL: Homepage, https://rodiumai.io
6
+ Project-URL: Documentation, https://docs.rodiumai.io
7
+ Project-URL: Source, https://github.com/RodiumAI/rodiumai-python
8
+ Project-URL: Issues, https://github.com/RodiumAI/rodiumai-python/issues
9
+ Author-email: RodiumAI <dev@rodiumai.io>
10
+ License: MIT
11
+ License-File: LICENSE
12
+ Keywords: africa,ai,api,llm,openai-compatible
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.8
18
+ Classifier: Programming Language :: Python :: 3.9
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
23
+ Requires-Python: >=3.8
24
+ Requires-Dist: httpx>=0.25.0
25
+ Provides-Extra: dev
26
+ Requires-Dist: bandit>=1.7; extra == 'dev'
27
+ Requires-Dist: black>=23.0; extra == 'dev'
28
+ Requires-Dist: flake8>=6.0; extra == 'dev'
29
+ Requires-Dist: isort>=5.0; extra == 'dev'
30
+ Requires-Dist: mypy>=1.0; extra == 'dev'
31
+ Requires-Dist: pip-audit>=2.0; extra == 'dev'
32
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
33
+ Requires-Dist: pytest-cov>=4.0; extra == 'dev'
34
+ Requires-Dist: pytest-httpx>=0.30.0; extra == 'dev'
35
+ Requires-Dist: pytest>=7.0; extra == 'dev'
36
+ Description-Content-Type: text/markdown
37
+
38
+ # RodiumAI Python SDK
39
+
40
+ [![PyPI version](https://img.shields.io/pypi/v/rodiumai)](https://pypi.org/project/rodiumai/)
41
+ [![Python versions](https://img.shields.io/pypi/pyversions/rodiumai)](https://pypi.org/project/rodiumai/)
42
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
43
+
44
+ Unified AI API for Africa — access leading AI models through one SDK with local payment methods.
45
+
46
+ > **OpenAI drop-in replacement** — migrate by changing only `api_key` and `base_url`.
47
+
48
+ ## Installation
49
+
50
+ ```bash
51
+ pip install rodiumai
52
+ ```
53
+
54
+ ## Quick Start
55
+
56
+ ```python
57
+ from rodiumai import RodiumAI
58
+ import os
59
+
60
+ client = RodiumAI(api_key=os.getenv("RODIUMAI_API_KEY"))
61
+
62
+ # Chat completion
63
+ response = client.chat.completions.create(
64
+ model="auto",
65
+ messages=[{"role": "user", "content": "Hello!"}],
66
+ )
67
+ print(response.choices[0].message.content)
68
+
69
+ # Streaming
70
+ for chunk in client.chat.completions.create(
71
+ model="auto",
72
+ messages=[{"role": "user", "content": "Hello!"}],
73
+ stream=True,
74
+ ):
75
+ print(chunk.choices[0].delta.content or "", end="")
76
+ ```
77
+
78
+ ## Migration from OpenAI
79
+
80
+ ```python
81
+ # Before (OpenAI)
82
+ from openai import OpenAI
83
+ client = OpenAI(api_key="sk-...")
84
+
85
+ # After (RodiumAI)
86
+ from rodiumai import RodiumAI
87
+ client = RodiumAI(api_key="rdk-...")
88
+ ```
89
+
90
+ That's it. Same methods, same parameters, same response types.
91
+
92
+ ## Features
93
+
94
+ - **Chat Completions** — Standard & streaming (SSE)
95
+ - **Embeddings** — Single & batch text input
96
+ - **Image Generation** — Text-to-image with size/quality options
97
+ - **Audio** — Speech-to-text & text-to-speech
98
+ - **Video** — Future-ready stub
99
+ - **Retry Logic** — Automatic with exponential backoff
100
+ - **Error Hierarchy** — 8 typed errors with fix suggestions
101
+ - **Observability** — Structured JSON logging, usage stats, alerts
102
+ - **Security** — API key masked everywhere, HTTPS enforced
103
+
104
+ ## Documentation
105
+
106
+ Full documentation at [docs.rodiumai.io](https://docs.rodiumai.io).
107
+
108
+ ## Development
109
+
110
+ ```bash
111
+ git clone https://github.com/RodiumAI/rodiumai-python.git
112
+ cd rodiumai-python
113
+ pip install -e ".[dev]"
114
+ pytest
115
+ ```
116
+
117
+ ## License
118
+
119
+ MIT
@@ -0,0 +1,82 @@
1
+ # RodiumAI Python SDK
2
+
3
+ [![PyPI version](https://img.shields.io/pypi/v/rodiumai)](https://pypi.org/project/rodiumai/)
4
+ [![Python versions](https://img.shields.io/pypi/pyversions/rodiumai)](https://pypi.org/project/rodiumai/)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
+
7
+ Unified AI API for Africa — access leading AI models through one SDK with local payment methods.
8
+
9
+ > **OpenAI drop-in replacement** — migrate by changing only `api_key` and `base_url`.
10
+
11
+ ## Installation
12
+
13
+ ```bash
14
+ pip install rodiumai
15
+ ```
16
+
17
+ ## Quick Start
18
+
19
+ ```python
20
+ from rodiumai import RodiumAI
21
+ import os
22
+
23
+ client = RodiumAI(api_key=os.getenv("RODIUMAI_API_KEY"))
24
+
25
+ # Chat completion
26
+ response = client.chat.completions.create(
27
+ model="auto",
28
+ messages=[{"role": "user", "content": "Hello!"}],
29
+ )
30
+ print(response.choices[0].message.content)
31
+
32
+ # Streaming
33
+ for chunk in client.chat.completions.create(
34
+ model="auto",
35
+ messages=[{"role": "user", "content": "Hello!"}],
36
+ stream=True,
37
+ ):
38
+ print(chunk.choices[0].delta.content or "", end="")
39
+ ```
40
+
41
+ ## Migration from OpenAI
42
+
43
+ ```python
44
+ # Before (OpenAI)
45
+ from openai import OpenAI
46
+ client = OpenAI(api_key="sk-...")
47
+
48
+ # After (RodiumAI)
49
+ from rodiumai import RodiumAI
50
+ client = RodiumAI(api_key="rdk-...")
51
+ ```
52
+
53
+ That's it. Same methods, same parameters, same response types.
54
+
55
+ ## Features
56
+
57
+ - **Chat Completions** — Standard & streaming (SSE)
58
+ - **Embeddings** — Single & batch text input
59
+ - **Image Generation** — Text-to-image with size/quality options
60
+ - **Audio** — Speech-to-text & text-to-speech
61
+ - **Video** — Future-ready stub
62
+ - **Retry Logic** — Automatic with exponential backoff
63
+ - **Error Hierarchy** — 8 typed errors with fix suggestions
64
+ - **Observability** — Structured JSON logging, usage stats, alerts
65
+ - **Security** — API key masked everywhere, HTTPS enforced
66
+
67
+ ## Documentation
68
+
69
+ Full documentation at [docs.rodiumai.io](https://docs.rodiumai.io).
70
+
71
+ ## Development
72
+
73
+ ```bash
74
+ git clone https://github.com/RodiumAI/rodiumai-python.git
75
+ cd rodiumai-python
76
+ pip install -e ".[dev]"
77
+ pytest
78
+ ```
79
+
80
+ ## License
81
+
82
+ MIT
@@ -0,0 +1,80 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "rodiumai"
7
+ version = "0.1.0"
8
+ description = "RodiumAI SDK — Unified AI API for Africa"
9
+ readme = "README.md"
10
+ requires-python = ">=3.8"
11
+ license = { text = "MIT" }
12
+ authors = [
13
+ { name = "RodiumAI", email = "dev@rodiumai.io" },
14
+ ]
15
+ keywords = ["ai", "api", "africa", "llm", "openai-compatible"]
16
+ classifiers = [
17
+ "Development Status :: 4 - Beta",
18
+ "Intended Audience :: Developers",
19
+ "License :: OSI Approved :: MIT License",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.8",
22
+ "Programming Language :: Python :: 3.9",
23
+ "Programming Language :: Python :: 3.10",
24
+ "Programming Language :: Python :: 3.11",
25
+ "Programming Language :: Python :: 3.12",
26
+ "Topic :: Scientific/Engineering :: Artificial Intelligence",
27
+ ]
28
+
29
+ dependencies = [
30
+ "httpx>=0.25.0",
31
+ ]
32
+
33
+ [project.urls]
34
+ Homepage = "https://rodiumai.io"
35
+ Documentation = "https://docs.rodiumai.io"
36
+ Source = "https://github.com/RodiumAI/rodiumai-python"
37
+ Issues = "https://github.com/RodiumAI/rodiumai-python/issues"
38
+
39
+ [project.optional-dependencies]
40
+ dev = [
41
+ "pytest>=7.0",
42
+ "pytest-asyncio>=0.21.0",
43
+ "pytest-httpx>=0.30.0",
44
+ "pytest-cov>=4.0",
45
+ "flake8>=6.0",
46
+ "black>=23.0",
47
+ "mypy>=1.0",
48
+ "isort>=5.0",
49
+ "bandit>=1.7",
50
+ "pip-audit>=2.0",
51
+ ]
52
+
53
+ [tool.coverage.run]
54
+ branch = true
55
+ source = ["rodiumai"]
56
+
57
+ [tool.coverage.report]
58
+ fail_under = 98.5
59
+ skip_covered = true
60
+ show_missing = true
61
+
62
+ [tool.black]
63
+ line-length = 100
64
+ target-version = ["py38", "py39", "py310", "py311", "py312"]
65
+
66
+ [tool.isort]
67
+ profile = "black"
68
+ line_length = 100
69
+
70
+ [tool.mypy]
71
+ python_version = "3.8"
72
+ strict = true
73
+ ignore_missing_imports = true
74
+
75
+ [tool.pytest.ini_options]
76
+ asyncio_mode = "auto"
77
+ testpaths = ["tests"]
78
+
79
+ [tool.bandit]
80
+ exclude_dirs = ["tests"]
@@ -0,0 +1,29 @@
1
+ from .client import RodiumAI
2
+ from .errors import (
3
+ InsufficientRODIError,
4
+ InternalServerError,
5
+ InvalidAPIKeyError,
6
+ ModelNotFoundError,
7
+ NetworkError,
8
+ PermissionDeniedError,
9
+ RateLimitError,
10
+ RodiumAIError,
11
+ ServiceUnavailableError,
12
+ TimeoutError_ as TimeoutError,
13
+ )
14
+ from ._version import VERSION
15
+
16
+ __all__ = [
17
+ "RodiumAI",
18
+ "RodiumAIError",
19
+ "InvalidAPIKeyError",
20
+ "InsufficientRODIError",
21
+ "PermissionDeniedError",
22
+ "ModelNotFoundError",
23
+ "RateLimitError",
24
+ "InternalServerError",
25
+ "ServiceUnavailableError",
26
+ "TimeoutError",
27
+ "NetworkError",
28
+ "VERSION",
29
+ ]