omni-reason-client 1.0.2__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,96 @@
1
+ # Omni-Reason client
2
+
3
+ Use Omni-Reason from your terminal or agent: sign in to Platform, submit a video
4
+ task, follow progress and download the result. The lightweight client requires
5
+ Python 3.11 or newer and has no third-party runtime dependencies.
6
+
7
+ ## Install and run
8
+
9
+ Create a Python environment and install the client:
10
+
11
+ ```sh
12
+ python3 -m venv .omni-venv
13
+ source .omni-venv/bin/activate
14
+ python -m pip install omni-reason-client
15
+ omni-reason --version
16
+ omni-reason login
17
+ omni-reason doctor
18
+ omni-reason example robot --output robot-result.mp4
19
+ ```
20
+
21
+ The activation command above is for macOS/Linux. On Windows PowerShell, use
22
+ `.omni-venv\Scripts\Activate.ps1`. Approve the login code in your browser.
23
+ The example command downloads the official small input, submits its instruction
24
+ and saves your result. Hosted access is invitation-only, free and non-commercial.
25
+ [Request access](https://platform.omni-reason.com/request-access) before signing
26
+ up. Package installation does not grant an account or generation allowance.
27
+
28
+ The same release can also be installed from its official wheel file with
29
+ `python -m pip install /path/to/omni_reason_client-1.0.2-py3-none-any.whl`.
30
+
31
+ ## Commands
32
+
33
+ `login`, `whoami`, `doctor`, `example`, `tv2v`, `jobs` and `logout` use Platform.
34
+ Use `omni-reason --help` or a command's `--help` for arguments. `--json` provides
35
+ structured output for scripts; place it before the hosted command.
36
+
37
+ | Command | Purpose |
38
+ | --- | --- |
39
+ | `login`, `whoami`, `logout` | Connect with browser approval, inspect your account, or revoke the current credential |
40
+ | `doctor` | Check account permissions, allowance and generation availability without creating a task |
41
+ | `example robot`, `example colorization` | Download a verified official example, generate and save the result |
42
+ | `tv2v` | Submit your own video, instruction and optional image or video reference |
43
+ | `jobs get`, `jobs watch` | Inspect a known task or wait for it to finish |
44
+ | `jobs download`, `jobs cancel` | Download a completed result or cancel a queued task |
45
+
46
+ ```sh
47
+ omni-reason tv2v "Highlight the moving robot." --input input.mp4 --output result.mp4
48
+ omni-reason --json jobs get JOB_ID
49
+ ```
50
+
51
+ Use `--start` and `--input-seconds` to select an input segment, and
52
+ `--output-seconds match` or a duration to control the output. `--reference`
53
+ accepts a supported image or video; video references also have
54
+ `--reference-start` and `--reference-seconds`. See the live documentation for
55
+ current duration, combined-capacity and account limits. `--dry-run` checks
56
+ local parameters without submitting; the server performs media validation.
57
+
58
+ The client writes an `.omni.json` receipt next to the chosen output path.
59
+ Keep it and repeat the same command to recover an interrupted submission.
60
+ `--no-wait` returns after submission; `jobs watch` and `jobs download` resume
61
+ later. Accepted jobs continue when the terminal closes. An existing output is
62
+ never overwritten; choose a new output path to intentionally start another task.
63
+
64
+ Successful status queries and cancellations exit with code 0. Waiting for a
65
+ failed or canceled task exits with code 2, as do input, authentication and
66
+ connection errors. A failed `doctor` readiness check also exits with code 2.
67
+
68
+ ## Optional local components
69
+
70
+ The client discovers optional commands from separately installed packages:
71
+
72
+ | Commands | Package | Guide |
73
+ | --- | --- | --- |
74
+ | `model` | `omni-reason` | [Model](https://huggingface.co/Omni-Reason/Omni-Reason-1) |
75
+ | `data` | `omni-reason-tools` | [Data](https://huggingface.co/datasets/Omni-Reason/Omni-Reason-Data) |
76
+ | `benchmark` | `omni-reason-tools` | [Benchmark](https://huggingface.co/datasets/Omni-Reason/Omni-Reason-Bench) |
77
+
78
+ Install the components you need into the same Python environment and follow
79
+ their guides. Local inference uses your own hardware and separately obtained
80
+ model weights. Data access and component licenses apply independently of a
81
+ Platform account. Installing the client alone downloads no weights or PyTorch.
82
+ Server deployment and training use their separate component workflows.
83
+
84
+ For unattended hosted calls, provide `OMNI_REASON_API_KEY` through a protected
85
+ environment and select the intended origin with `--server`. Browser login
86
+ credentials are stored privately on your machine. Use `logout` or Console to
87
+ revoke a credential. Never put keys in source code or shared command logs.
88
+
89
+ ## License and support
90
+
91
+ This client is licensed under Apache-2.0; the license text is included in the
92
+ package. Optional components, model weights and datasets retain their own
93
+ terms. The client license does not change the hosted service's access terms.
94
+ See the [documentation](https://platform.omni-reason.com/docs) for API usage,
95
+ authentication, task limits and troubleshooting. Contact:
96
+ [hokind@andrew.cmu.edu](mailto:hokind@andrew.cmu.edu).
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,109 @@
1
+ Metadata-Version: 2.4
2
+ Name: omni-reason-client
3
+ Version: 1.0.2
4
+ Summary: Omni-Reason hosted API client with optional local model, data and benchmark commands
5
+ License-Expression: Apache-2.0
6
+ Project-URL: Homepage, https://omni-reason.com/
7
+ Project-URL: Documentation, https://platform.omni-reason.com/docs
8
+ Project-URL: Support, https://platform.omni-reason.com/request-access
9
+ Requires-Python: >=3.11
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Dynamic: license-file
13
+
14
+ # Omni-Reason client
15
+
16
+ Use Omni-Reason from your terminal or agent: sign in to Platform, submit a video
17
+ task, follow progress and download the result. The lightweight client requires
18
+ Python 3.11 or newer and has no third-party runtime dependencies.
19
+
20
+ ## Install and run
21
+
22
+ Create a Python environment and install the client:
23
+
24
+ ```sh
25
+ python3 -m venv .omni-venv
26
+ source .omni-venv/bin/activate
27
+ python -m pip install omni-reason-client
28
+ omni-reason --version
29
+ omni-reason login
30
+ omni-reason doctor
31
+ omni-reason example robot --output robot-result.mp4
32
+ ```
33
+
34
+ The activation command above is for macOS/Linux. On Windows PowerShell, use
35
+ `.omni-venv\Scripts\Activate.ps1`. Approve the login code in your browser.
36
+ The example command downloads the official small input, submits its instruction
37
+ and saves your result. Hosted access is invitation-only, free and non-commercial.
38
+ [Request access](https://platform.omni-reason.com/request-access) before signing
39
+ up. Package installation does not grant an account or generation allowance.
40
+
41
+ The same release can also be installed from its official wheel file with
42
+ `python -m pip install /path/to/omni_reason_client-1.0.2-py3-none-any.whl`.
43
+
44
+ ## Commands
45
+
46
+ `login`, `whoami`, `doctor`, `example`, `tv2v`, `jobs` and `logout` use Platform.
47
+ Use `omni-reason --help` or a command's `--help` for arguments. `--json` provides
48
+ structured output for scripts; place it before the hosted command.
49
+
50
+ | Command | Purpose |
51
+ | --- | --- |
52
+ | `login`, `whoami`, `logout` | Connect with browser approval, inspect your account, or revoke the current credential |
53
+ | `doctor` | Check account permissions, allowance and generation availability without creating a task |
54
+ | `example robot`, `example colorization` | Download a verified official example, generate and save the result |
55
+ | `tv2v` | Submit your own video, instruction and optional image or video reference |
56
+ | `jobs get`, `jobs watch` | Inspect a known task or wait for it to finish |
57
+ | `jobs download`, `jobs cancel` | Download a completed result or cancel a queued task |
58
+
59
+ ```sh
60
+ omni-reason tv2v "Highlight the moving robot." --input input.mp4 --output result.mp4
61
+ omni-reason --json jobs get JOB_ID
62
+ ```
63
+
64
+ Use `--start` and `--input-seconds` to select an input segment, and
65
+ `--output-seconds match` or a duration to control the output. `--reference`
66
+ accepts a supported image or video; video references also have
67
+ `--reference-start` and `--reference-seconds`. See the live documentation for
68
+ current duration, combined-capacity and account limits. `--dry-run` checks
69
+ local parameters without submitting; the server performs media validation.
70
+
71
+ The client writes an `.omni.json` receipt next to the chosen output path.
72
+ Keep it and repeat the same command to recover an interrupted submission.
73
+ `--no-wait` returns after submission; `jobs watch` and `jobs download` resume
74
+ later. Accepted jobs continue when the terminal closes. An existing output is
75
+ never overwritten; choose a new output path to intentionally start another task.
76
+
77
+ Successful status queries and cancellations exit with code 0. Waiting for a
78
+ failed or canceled task exits with code 2, as do input, authentication and
79
+ connection errors. A failed `doctor` readiness check also exits with code 2.
80
+
81
+ ## Optional local components
82
+
83
+ The client discovers optional commands from separately installed packages:
84
+
85
+ | Commands | Package | Guide |
86
+ | --- | --- | --- |
87
+ | `model` | `omni-reason` | [Model](https://huggingface.co/Omni-Reason/Omni-Reason-1) |
88
+ | `data` | `omni-reason-tools` | [Data](https://huggingface.co/datasets/Omni-Reason/Omni-Reason-Data) |
89
+ | `benchmark` | `omni-reason-tools` | [Benchmark](https://huggingface.co/datasets/Omni-Reason/Omni-Reason-Bench) |
90
+
91
+ Install the components you need into the same Python environment and follow
92
+ their guides. Local inference uses your own hardware and separately obtained
93
+ model weights. Data access and component licenses apply independently of a
94
+ Platform account. Installing the client alone downloads no weights or PyTorch.
95
+ Server deployment and training use their separate component workflows.
96
+
97
+ For unattended hosted calls, provide `OMNI_REASON_API_KEY` through a protected
98
+ environment and select the intended origin with `--server`. Browser login
99
+ credentials are stored privately on your machine. Use `logout` or Console to
100
+ revoke a credential. Never put keys in source code or shared command logs.
101
+
102
+ ## License and support
103
+
104
+ This client is licensed under Apache-2.0; the license text is included in the
105
+ package. Optional components, model weights and datasets retain their own
106
+ terms. The client license does not change the hosted service's access terms.
107
+ See the [documentation](https://platform.omni-reason.com/docs) for API usage,
108
+ authentication, task limits and troubleshooting. Contact:
109
+ [hokind@andrew.cmu.edu](mailto:hokind@andrew.cmu.edu).
@@ -0,0 +1,109 @@
1
+ Metadata-Version: 2.4
2
+ Name: omni-reason-client
3
+ Version: 1.0.2
4
+ Summary: Omni-Reason hosted API client with optional local model, data and benchmark commands
5
+ License-Expression: Apache-2.0
6
+ Project-URL: Homepage, https://omni-reason.com/
7
+ Project-URL: Documentation, https://platform.omni-reason.com/docs
8
+ Project-URL: Support, https://platform.omni-reason.com/request-access
9
+ Requires-Python: >=3.11
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ Dynamic: license-file
13
+
14
+ # Omni-Reason client
15
+
16
+ Use Omni-Reason from your terminal or agent: sign in to Platform, submit a video
17
+ task, follow progress and download the result. The lightweight client requires
18
+ Python 3.11 or newer and has no third-party runtime dependencies.
19
+
20
+ ## Install and run
21
+
22
+ Create a Python environment and install the client:
23
+
24
+ ```sh
25
+ python3 -m venv .omni-venv
26
+ source .omni-venv/bin/activate
27
+ python -m pip install omni-reason-client
28
+ omni-reason --version
29
+ omni-reason login
30
+ omni-reason doctor
31
+ omni-reason example robot --output robot-result.mp4
32
+ ```
33
+
34
+ The activation command above is for macOS/Linux. On Windows PowerShell, use
35
+ `.omni-venv\Scripts\Activate.ps1`. Approve the login code in your browser.
36
+ The example command downloads the official small input, submits its instruction
37
+ and saves your result. Hosted access is invitation-only, free and non-commercial.
38
+ [Request access](https://platform.omni-reason.com/request-access) before signing
39
+ up. Package installation does not grant an account or generation allowance.
40
+
41
+ The same release can also be installed from its official wheel file with
42
+ `python -m pip install /path/to/omni_reason_client-1.0.2-py3-none-any.whl`.
43
+
44
+ ## Commands
45
+
46
+ `login`, `whoami`, `doctor`, `example`, `tv2v`, `jobs` and `logout` use Platform.
47
+ Use `omni-reason --help` or a command's `--help` for arguments. `--json` provides
48
+ structured output for scripts; place it before the hosted command.
49
+
50
+ | Command | Purpose |
51
+ | --- | --- |
52
+ | `login`, `whoami`, `logout` | Connect with browser approval, inspect your account, or revoke the current credential |
53
+ | `doctor` | Check account permissions, allowance and generation availability without creating a task |
54
+ | `example robot`, `example colorization` | Download a verified official example, generate and save the result |
55
+ | `tv2v` | Submit your own video, instruction and optional image or video reference |
56
+ | `jobs get`, `jobs watch` | Inspect a known task or wait for it to finish |
57
+ | `jobs download`, `jobs cancel` | Download a completed result or cancel a queued task |
58
+
59
+ ```sh
60
+ omni-reason tv2v "Highlight the moving robot." --input input.mp4 --output result.mp4
61
+ omni-reason --json jobs get JOB_ID
62
+ ```
63
+
64
+ Use `--start` and `--input-seconds` to select an input segment, and
65
+ `--output-seconds match` or a duration to control the output. `--reference`
66
+ accepts a supported image or video; video references also have
67
+ `--reference-start` and `--reference-seconds`. See the live documentation for
68
+ current duration, combined-capacity and account limits. `--dry-run` checks
69
+ local parameters without submitting; the server performs media validation.
70
+
71
+ The client writes an `.omni.json` receipt next to the chosen output path.
72
+ Keep it and repeat the same command to recover an interrupted submission.
73
+ `--no-wait` returns after submission; `jobs watch` and `jobs download` resume
74
+ later. Accepted jobs continue when the terminal closes. An existing output is
75
+ never overwritten; choose a new output path to intentionally start another task.
76
+
77
+ Successful status queries and cancellations exit with code 0. Waiting for a
78
+ failed or canceled task exits with code 2, as do input, authentication and
79
+ connection errors. A failed `doctor` readiness check also exits with code 2.
80
+
81
+ ## Optional local components
82
+
83
+ The client discovers optional commands from separately installed packages:
84
+
85
+ | Commands | Package | Guide |
86
+ | --- | --- | --- |
87
+ | `model` | `omni-reason` | [Model](https://huggingface.co/Omni-Reason/Omni-Reason-1) |
88
+ | `data` | `omni-reason-tools` | [Data](https://huggingface.co/datasets/Omni-Reason/Omni-Reason-Data) |
89
+ | `benchmark` | `omni-reason-tools` | [Benchmark](https://huggingface.co/datasets/Omni-Reason/Omni-Reason-Bench) |
90
+
91
+ Install the components you need into the same Python environment and follow
92
+ their guides. Local inference uses your own hardware and separately obtained
93
+ model weights. Data access and component licenses apply independently of a
94
+ Platform account. Installing the client alone downloads no weights or PyTorch.
95
+ Server deployment and training use their separate component workflows.
96
+
97
+ For unattended hosted calls, provide `OMNI_REASON_API_KEY` through a protected
98
+ environment and select the intended origin with `--server`. Browser login
99
+ credentials are stored privately on your machine. Use `logout` or Console to
100
+ revoke a credential. Never put keys in source code or shared command logs.
101
+
102
+ ## License and support
103
+
104
+ This client is licensed under Apache-2.0; the license text is included in the
105
+ package. Optional components, model weights and datasets retain their own
106
+ terms. The client license does not change the hosted service's access terms.
107
+ See the [documentation](https://platform.omni-reason.com/docs) for API usage,
108
+ authentication, task limits and troubleshooting. Contact:
109
+ [hokind@andrew.cmu.edu](mailto:hokind@andrew.cmu.edu).
@@ -0,0 +1,9 @@
1
+ 2026-11-20-package-description.md
2
+ LICENSE
3
+ omni_reason_client.py
4
+ pyproject.toml
5
+ omni_reason_client.egg-info/PKG-INFO
6
+ omni_reason_client.egg-info/SOURCES.txt
7
+ omni_reason_client.egg-info/dependency_links.txt
8
+ omni_reason_client.egg-info/entry_points.txt
9
+ omni_reason_client.egg-info/top_level.txt
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ omni-reason = omni_reason_client:main
@@ -0,0 +1 @@
1
+ omni_reason_client
@@ -0,0 +1,412 @@
1
+ """Lightweight hosted client and lazy dispatch to optional local commands."""
2
+ import argparse
3
+ import hashlib
4
+ import http.client
5
+ import json
6
+ import math
7
+ import os
8
+ from pathlib import Path
9
+ import secrets
10
+ import sys
11
+ import tempfile
12
+ import time
13
+ import urllib.error
14
+ import urllib.parse
15
+ import urllib.request
16
+ import webbrowser
17
+
18
+ DEFAULT_SERVER="https://platform.omni-reason.com"
19
+ CLIENT_BUILD="20261120-pypi-client-01"
20
+ CLIENT_VERSION="1.0.2"
21
+ LOCAL_COMMANDS={
22
+ "model":"Run the model on your own hardware",
23
+ "data":"Find, download and check data",
24
+ "benchmark":"Download benchmarks and evaluate your outputs",
25
+ }
26
+ LOCAL_PACKAGES={
27
+ "model":("omni-reason","https://huggingface.co/Omni-Reason/Omni-Reason-1"),
28
+ "data":("omni-reason-tools","https://huggingface.co/datasets/Omni-Reason/Omni-Reason-Data"),
29
+ "benchmark":("omni-reason-tools","https://huggingface.co/datasets/Omni-Reason/Omni-Reason-Bench"),
30
+ }
31
+ PLUGIN_GROUP="omni_reason.commands"
32
+
33
+ def local_plugins():
34
+ """Inspect installed metadata without importing a plugin or its dependencies."""
35
+ from importlib.metadata import entry_points
36
+ return entry_points(group=PLUGIN_GROUP)
37
+
38
+ def run_local(name,argv):
39
+ plugins=[entry for entry in local_plugins() if entry.name==name]
40
+ if not plugins:
41
+ package,guide=LOCAL_PACKAGES[name]
42
+ raise ClientError(
43
+ f"The optional '{name}' command is not installed. Install the official "
44
+ f"'{package}' package in this Python environment. Component guide: {guide}. "
45
+ "Hosted commands remain available without local model dependencies.")
46
+ if len(plugins)!=1:
47
+ raise ClientError(f"Multiple installed plugins provide '{name}'. Use an environment "
48
+ "with exactly one provider for this command; nothing was executed.")
49
+ handler=plugins[0].load()
50
+ if not callable(handler):raise ClientError(f"The '{name}' plugin has no callable entry point.")
51
+ result=handler(list(argv))
52
+ if result is None:return 0
53
+ if type(result) is not int or not 0<=result<=255:
54
+ raise ClientError(f"The '{name}' plugin returned an invalid exit status.")
55
+ return result
56
+
57
+ class ClientError(Exception):
58
+ def __init__(self, message, status=0, data=None):
59
+ super().__init__(message); self.status=status; self.data=data
60
+
61
+ def private_json(path, value, exclusive=False):
62
+ path=Path(path); path.parent.mkdir(parents=True, exist_ok=True, mode=0o700)
63
+ if path.is_symlink():raise ClientError("Refusing a symlink at a client-state path.")
64
+ fd,name=tempfile.mkstemp(prefix=".omni-state-",dir=path.parent)
65
+ temporary=Path(name)
66
+ try:
67
+ with os.fdopen(fd,"w") as f:
68
+ os.fchmod(f.fileno(),0o600); json.dump(value,f,indent=2); f.flush(); os.fsync(f.fileno())
69
+ if exclusive:os.link(temporary,path)
70
+ else:os.replace(temporary,path)
71
+ finally:
72
+ if temporary.exists():temporary.unlink()
73
+
74
+ def read_json(path):
75
+ try:return json.loads(Path(path).read_text())
76
+ except FileNotFoundError:return {}
77
+ except (ValueError, OSError):raise ClientError("Cannot read the saved client state: "+str(path))
78
+
79
+ def origin(value):
80
+ u=urllib.parse.urlsplit(value or "")
81
+ if u.username or u.password or u.query or u.fragment or u.path not in ("", "/"):
82
+ raise ClientError("Use the Platform origin, without a path or credentials.")
83
+ if not u.hostname or (u.scheme!="https" and not (u.scheme=="http" and u.hostname in ("127.0.0.1","localhost","::1"))):
84
+ raise ClientError("Use HTTPS (HTTP is allowed only for a loopback test server).")
85
+ return value.rstrip("/")
86
+
87
+ class NoRedirect(urllib.request.HTTPRedirectHandler):
88
+ def redirect_request(self, *args, **kw):raise ClientError("Unexpected redirect; no credential was forwarded.")
89
+
90
+ class Client:
91
+ def __init__(self, server, token=None):
92
+ self.server=origin(server); self.token=token
93
+ self.opener=urllib.request.build_opener(NoRedirect())
94
+
95
+ def request(self, method, path, data=None, headers=None, raw=False):
96
+ if not path.startswith("/api/v1/") or ".." in path:raise ClientError("Invalid API path.")
97
+ h={"Accept":"application/json",**(headers or {})}
98
+ if self.token:h["Authorization"]="Bearer "+self.token
99
+ if isinstance(data,dict):data=json.dumps(data).encode();h["Content-Type"]="application/json"
100
+ if data is None and method=="POST":data=b""
101
+ req=urllib.request.Request(self.server+path,data=data,headers=h,method=method)
102
+ try:
103
+ response=self.opener.open(req,timeout=150)
104
+ if raw:return response
105
+ with response:return json.load(response)
106
+ except urllib.error.HTTPError as exc:
107
+ try:payload=json.loads(exc.read(65536))
108
+ except ValueError:payload={}
109
+ raise ClientError(payload.get("detail","The server returned HTTP "+str(exc.code)),exc.code,payload) from None
110
+ except (urllib.error.URLError,TimeoutError,ConnectionError,OSError) as exc:
111
+ raise ClientError("Connection interrupted. Resume with the same command or job ID; the task may still be running.") from exc
112
+
113
+ def job(self,jid):return self.request("GET","/api/v1/jobs/"+urllib.parse.quote(jid,safe=""))
114
+
115
+ def sha(path):
116
+ with Path(path).open("rb") as f:return hashlib.file_digest(f,"sha256").hexdigest()
117
+
118
+ def example_files(client,name,example,cache):
119
+ """Only fixed same-origin examples; verify size and SHA before use."""
120
+ rows=example.get("files",[])
121
+ required={"input","reference"} if name=="colorization" else {"input"}
122
+ if len(rows)!=len(required) or {f.get("role") for f in rows}!=required:
123
+ raise ClientError("Unexpected example files. Nothing submitted.")
124
+ paths={}
125
+ for row in rows:
126
+ role=row["role"];size=row.get("bytes");checksum=row.get("sha256","")
127
+ if row.get("url")!=f"/api/v1/examples/{name}/{role}" or type(size)!=int or not 0<size<=50*1024**2 or len(checksum)!=64 or any(c not in "0123456789abcdef" for c in checksum):
128
+ raise ClientError("Invalid example metadata. Nothing submitted.")
129
+ cache.mkdir(parents=True,exist_ok=True,mode=0o700)
130
+ if cache.is_symlink():raise ClientError("Refusing a symlink at the example cache.")
131
+ target=cache/(checksum+(".mp4" if role=="input" else ".png"))
132
+ if target.is_symlink():raise ClientError("Refusing a symlink at the example path.")
133
+ if target.exists():
134
+ if target.stat().st_size!=size or sha(target)!=checksum:raise ClientError("Cached example is damaged. Choose a new OMNI_REASON_CONFIG_DIR or contact support.")
135
+ else:
136
+ fd,tmp=tempfile.mkstemp(prefix=".example-",dir=cache);temporary=Path(tmp)
137
+ try:
138
+ with os.fdopen(fd,"wb") as f,client.request("GET",row["url"],raw=True) as response:
139
+ os.fchmod(f.fileno(),0o600);total=0;hasher=hashlib.sha256()
140
+ while chunk:=response.read(min(1024*1024,size-total+1)):
141
+ total+=len(chunk)
142
+ if total>size:raise ClientError("Example exceeds its recorded size. Nothing submitted.")
143
+ f.write(chunk);hasher.update(chunk)
144
+ if total!=size or hasher.hexdigest()!=checksum:raise ClientError("Example checksum mismatch. Nothing submitted.")
145
+ f.flush();os.fsync(f.fileno())
146
+ try:os.link(temporary,target)
147
+ except FileExistsError:
148
+ if target.is_symlink() or target.stat().st_size!=size or sha(target)!=checksum:raise ClientError("Example cache changed during download.")
149
+ finally:temporary.unlink(missing_ok=True)
150
+ paths[role]=str(target)
151
+ return paths
152
+
153
+ def doctor(client,frames=25,upload_bytes=0):
154
+ # Authenticate first for clear login errors; no task or upload is created.
155
+ me=client.request("GET","/api/v1/me")
156
+ status=client.request("GET",f"/api/v1/status?frames={frames}&upload_bytes={upload_bytes}")
157
+ return {**status,"server":client.server,"username":me["username"]}
158
+
159
+ class Multipart:
160
+ def __init__(self, fields, files, boundary):
161
+ self.parts=[];self.length=0;self.boundary=boundary
162
+ for name,value in fields.items():self.parts.append((f'--{boundary}\r\nContent-Disposition: form-data; name="{name}"\r\n\r\n{value}\r\n').encode())
163
+ for name,path,kind in files:
164
+ self.parts.extend([(f'--{boundary}\r\nContent-Disposition: form-data; name="{name}"; filename="upload"\r\nContent-Type: {kind}\r\n\r\n').encode(),Path(path),b"\r\n"])
165
+ self.parts.append(f"--{boundary}--\r\n".encode())
166
+ self.length=sum(p.stat().st_size if isinstance(p,Path) else len(p) for p in self.parts)
167
+ def __iter__(self):
168
+ for part in self.parts:
169
+ if isinstance(part,Path):
170
+ with part.open("rb") as f:
171
+ while chunk:=f.read(1024*1024):yield chunk
172
+ else:yield part
173
+
174
+ def watch(client,jid,timeout):
175
+ end=time.monotonic()+timeout;previous=None
176
+ while True:
177
+ job=client.job(jid)
178
+ if job["state"]!=previous:
179
+ print(f'{jid}: {job["state"]} · {job["frames"]} frames from {job["start_seconds"]}s',file=sys.stderr);previous=job["state"]
180
+ if job["state"] in ("completed","failed","canceled"):return job
181
+ if time.monotonic()>=end:raise ClientError("Stopped waiting. Resume with jobs watch "+jid)
182
+ time.sleep(5)
183
+
184
+ def download(client,jid,output):
185
+ output=Path(output)
186
+ if output.exists() or output.is_symlink():raise ClientError("Output already exists; choose another path.")
187
+ if not output.parent.is_dir():raise ClientError("The output directory does not exist.")
188
+ part=Path(str(output)+".part");meta=Path(str(part)+".json")
189
+ expected={"server":client.server,"job_id":jid}
190
+ previous=read_json(meta)
191
+ if part.exists() and any(previous.get(k)!=v for k,v in expected.items()):raise ClientError("This partial file belongs to another task.")
192
+ if part.is_symlink():raise ClientError("Refusing a symlink at the partial output path.")
193
+ offset=part.stat().st_size if part.exists() else 0
194
+ headers={}
195
+ if offset and previous.get("etag") and offset<previous.get("size",offset+1):headers={"Range":f"bytes={offset}-","If-Range":previous["etag"]}
196
+ with client.request("GET",f"/api/v1/jobs/{urllib.parse.quote(jid,safe='')}/output",headers=headers,raw=True) as response:
197
+ if response.status==206:
198
+ content_range=response.headers.get("Content-Range","")
199
+ if not content_range.startswith(f"bytes {offset}-"):raise ClientError("Unexpected download range; partial file retained.")
200
+ total=int(content_range.split("/")[-1]); mode="ab"
201
+ else:offset=0;total=int(response.headers["Content-Length"]);mode="wb"
202
+ private_json(meta,{**expected,"etag":response.headers.get("ETag"),"size":total})
203
+ with part.open(mode) as f:
204
+ os.fchmod(f.fileno(),0o600)
205
+ while chunk:=response.read(1024*1024):f.write(chunk)
206
+ f.flush();os.fsync(f.fileno())
207
+ if part.stat().st_size!=total:raise ClientError("Incomplete download. Run jobs download again to resume.")
208
+ # Link is atomic and never replaces a file another process created meanwhile.
209
+ os.link(part,output);part.unlink()
210
+ return {"job_id":jid,"output":str(output.resolve()),"bytes":total,"sha256":sha(output)}
211
+
212
+ def parser():
213
+ p=argparse.ArgumentParser(prog="omni-reason",description="Use hosted video reasoning, or install optional commands for your own model and data workflows.",epilog="Hosted service: Research Invitation Only, free and non-commercial. Request access: hokind@andrew.cmu.edu. Local model/data components follow their own licenses. Put local options after model, data or benchmark; --server and the root --json flag apply to hosted commands.")
214
+ p.add_argument("--server",help="Platform HTTPS origin (default: official Platform or saved login)")
215
+ p.add_argument("--version",action="version",version="%(prog)s "+CLIENT_VERSION+" ("+CLIENT_BUILD+")")
216
+ p.add_argument("--json",action="store_true",help="Machine-readable stdout; progress goes to stderr")
217
+ sub=p.add_subparsers(dest="command",required=True)
218
+ try:installed=list(local_plugins())
219
+ except (OSError,ValueError):installed=[]
220
+ for name,description in LOCAL_COMMANDS.items():
221
+ count=sum(entry.name==name for entry in installed)
222
+ status="installed" if count==1 else "conflicting plugins" if count>1 else "optional; not installed"
223
+ sub.add_parser(name,help=f"{description} ({status})",add_help=False)
224
+ sub.add_parser("login");sub.add_parser("whoami");sub.add_parser("logout")
225
+ d=sub.add_parser("doctor",help="Check account, allowance and compute without submitting")
226
+ d.add_argument("--frames",type=int,choices=range(9,98,8),default=25)
227
+ d.add_argument("--json",action="store_true",default=argparse.SUPPRESS)
228
+ e=sub.add_parser("example",help="Fetch a checked official example, generate and download")
229
+ e.add_argument("name",choices=("robot","colorization"));e.add_argument("--output")
230
+ e.add_argument("--no-wait",action="store_true");e.add_argument("--timeout",type=float,default=1800)
231
+ e.add_argument("--json",action="store_true",default=argparse.SUPPRESS)
232
+ t=sub.add_parser("tv2v",help="Upload, generate, wait and download")
233
+ t.add_argument("instruction");t.add_argument("--input",required=True);t.add_argument("--output",required=True)
234
+ t.add_argument("--reference");t.add_argument("--frames",default="auto");t.add_argument("--start",type=float,default=0)
235
+ t.add_argument("--input-seconds",type=float,help="Selected input span, up to 4 seconds")
236
+ t.add_argument("--output-seconds",default=None,help="match (default), or a custom output duration")
237
+ t.add_argument("--reference-seconds",type=float,help="Video reference span, up to 4 seconds")
238
+ t.add_argument("--reference-start",type=float,default=0,help="Video reference start in seconds")
239
+ t.add_argument("--no-wait",action="store_true");t.add_argument("--dry-run",action="store_true")
240
+ t.add_argument("--timeout",type=float,default=1800)
241
+ # Accept common script flags after the main command too.
242
+ t.add_argument("--json",action="store_true",default=argparse.SUPPRESS)
243
+ jobs=sub.add_parser("jobs").add_subparsers(dest="action",required=True)
244
+ for name in ("get","watch","download","cancel"):
245
+ j=jobs.add_parser(name);j.add_argument("id");j.add_argument("--json",action="store_true",default=argparse.SUPPRESS)
246
+ if name=="download":j.add_argument("--output",required=True)
247
+ if name=="watch":j.add_argument("--timeout",type=float,default=1800)
248
+ return p
249
+
250
+ def execute(args):
251
+ config=Path(os.environ.get("OMNI_REASON_CONFIG_DIR",Path.home()/".config/omni-reason"))/"credentials.json"
252
+ if hasattr(args,"timeout") and (not math.isfinite(args.timeout) or not 0<args.timeout<=86400):
253
+ raise ClientError("Waiting time must be between 0 and 86,400 seconds.")
254
+ if args.command=="tv2v":
255
+ if not 1<=len(args.instruction.strip())<=4000:raise ClientError("Use an instruction of 1–4,000 characters.")
256
+ if not math.isfinite(args.start) or args.start<0:raise ClientError("Start must be a nonnegative number.")
257
+ if args.frames!="auto" and args.frames not in [str(n) for n in range(9,98,8)]:raise ClientError("Frames must be auto or 9..97 in steps of 8.")
258
+ files=[("source",args.input,"video/mp4")]
259
+ if args.reference:
260
+ import mimetypes
261
+ files.append(("reference",args.reference,mimetypes.guess_type(args.reference)[0] or "application/octet-stream"))
262
+ for _,path,_ in files:
263
+ if not Path(path).is_file() or not 0<Path(path).stat().st_size<=50*1024**2:raise ClientError("Each input must be a file between 1 byte and 50 MiB.")
264
+ if Path(args.output).exists():raise ClientError("Output already exists; choose another path.")
265
+ if not Path(args.output).parent.is_dir():raise ClientError("The output directory does not exist.")
266
+ fields={"prompt":args.instruction.strip(),"frames":args.frames,"start_seconds":args.start}
267
+ timing={key:getattr(args,attribute,None) for key,attribute in
268
+ (("input_seconds","input_seconds"),("output_seconds","output_seconds"),
269
+ ("reference_seconds","reference_seconds"),("reference_start_seconds","reference_start"))}
270
+ use_timing=args.frames=="auto" or any(value not in (None,0) for value in timing.values())
271
+ if use_timing:
272
+ if args.frames!="auto":raise ClientError("Use --output-seconds or legacy --frames, not both.")
273
+ fields.pop("frames")
274
+ fields["output_seconds"]=timing.pop("output_seconds") or "match"
275
+ for name,value in timing.items():
276
+ if value is not None:
277
+ if not math.isfinite(value) or value<0 or (name.endswith("_seconds") and "start" not in name and not 0<value<=4):
278
+ raise ClientError("Select input/reference spans up to 4 seconds and nonnegative start positions.")
279
+ fields[name]=value
280
+ if fields["output_seconds"]!="match":
281
+ try:seconds=float(fields["output_seconds"])
282
+ except (ValueError,TypeError):raise ClientError("Output seconds must be match or a number.")
283
+ if not math.isfinite(seconds) or not 9/24<=seconds<=4.042:
284
+ raise ClientError("Output seconds must be between 0.375 and 4.042.")
285
+ fingerprint={"fields":fields,"files":{name:sha(path) for name,path,_ in files}}
286
+ if args.dry_run:return {"valid":True,"submitted":False,"frames":args.frames,"start_seconds":args.start,
287
+ "parameters":fields,"note":"The server validates media and returns normalized windows; no task was submitted."}
288
+ saved=read_json(config);server=origin(args.server or saved.get("server") or DEFAULT_SERVER)
289
+ if args.server and saved.get("server") not in (None,server) and not os.environ.get("OMNI_REASON_API_KEY"):
290
+ saved={} # Never send one server's saved credential to another server.
291
+ client=Client(server,os.environ.get("OMNI_REASON_API_KEY") or saved.get("token"))
292
+ if args.command=="login":
293
+ if saved.get("token") and saved.get("server")==server:
294
+ try:Client(server,saved["token"]).request("GET","/api/v1/me")
295
+ except ClientError as exc:
296
+ if exc.status!=401:raise
297
+ else:raise ClientError("Already signed in. Use whoami or logout first.")
298
+ client.token=None
299
+ flow=client.request("POST","/api/v1/auth/device",{"label":"Omni-Reason CLI"})
300
+ url=server+"/connect"
301
+ print("Open "+url+" and enter code "+flow["user_code"]+". Approve only this login.",file=sys.stderr)
302
+ webbrowser.open(url)
303
+ end=time.monotonic()+flow["expires_in"]
304
+ while time.monotonic()<end:
305
+ time.sleep(flow["interval"])
306
+ try:result=client.request("POST","/api/v1/auth/token",{"device_code":flow["device_code"]})
307
+ except ClientError as exc:
308
+ if exc.status==429:continue
309
+ raise
310
+ if result.get("access_token"):
311
+ private_json(config,{"server":server,"token":result["access_token"],"expires_at":time.time()+result["expires_in"]})
312
+ return {"signed_in":True,"server":server,"expires_in":result["expires_in"]}
313
+ raise ClientError("Login expired. Start login again.")
314
+ if not client.token:raise ClientError("Sign in with omni-reason login first (use --server for a custom Platform).")
315
+ if args.command=="whoami":return client.request("GET","/api/v1/me")
316
+ if args.command=="doctor":return doctor(client,args.frames)
317
+ if args.command=="example":
318
+ args.output=args.output or "omni-"+args.name+"-result.mp4"
319
+ output=Path(args.output)
320
+ if output.exists() or output.is_symlink():raise ClientError("Output already exists; choose another path.")
321
+ if not output.parent.is_dir():raise ClientError("The output directory does not exist.")
322
+ example=client.request("GET","/api/v1/examples")["examples"][args.name]
323
+ # A saved request must still be resumable when allowance or compute changes.
324
+ if not Path(str(output)+".omni.json").exists():
325
+ check=doctor(client,example["frames"],sum(f["bytes"] for f in example["files"])+65536)
326
+ if not check["ready"]:raise ClientError("Preflight: "+" ".join(c["message"] for c in check["checks"] if not c["ready"]),data=check)
327
+ paths=example_files(client,args.name,example,config.parent/"examples")
328
+ converted=argparse.Namespace(**vars(args))
329
+ converted.command="tv2v";converted.instruction=example["prompt"]
330
+ converted.input=paths["input"];converted.reference=paths.get("reference")
331
+ converted.frames=str(example["frames"]);converted.start=0;converted.dry_run=False
332
+ return execute(converted)
333
+ if args.command=="logout":
334
+ revoked=True
335
+ try:client.request("POST","/api/v1/auth/revoke",{})
336
+ except ClientError as exc:
337
+ if exc.status!=401:raise
338
+ revoked=False
339
+ if saved.get("token")==client.token:private_json(config,{"server":server})
340
+ return {"signed_out":True,"revoked":revoked}
341
+ if args.command=="jobs":
342
+ if args.action=="get":return client.job(args.id)
343
+ if args.action=="watch":return watch(client,args.id,args.timeout)
344
+ if args.action=="cancel":return client.request("POST",f"/api/v1/jobs/{urllib.parse.quote(args.id,safe='')}/cancel",{})
345
+ return download(client,args.id,args.output)
346
+ me=client.request("GET","/api/v1/me")
347
+ manifest=Path(str(args.output)+".omni.json")
348
+ spec={"server":server,"account":me["id"],"request":fingerprint}
349
+ state=read_json(manifest)
350
+ if state:
351
+ if any(state.get(k)!=v for k,v in spec.items()):raise ClientError("The saved request differs. Use another output path for a new task.")
352
+ else:
353
+ state={**spec,"request_key":secrets.token_hex(24)};private_json(manifest,state,exclusive=True)
354
+ jid=state.get("job_id")
355
+ if not jid:
356
+ try:jid=client.request("GET","/api/v1/jobs/by-request/"+state["request_key"])["id"]
357
+ except ClientError as exc:
358
+ if exc.status!=404:raise
359
+ if not jid:
360
+ multipart=Multipart(fields,files,"omni-"+state["request_key"])
361
+ headers={"Content-Type":"multipart/form-data; boundary="+multipart.boundary,"Content-Length":str(multipart.length),"Idempotency-Key":state["request_key"],"X-Output-Frames":args.frames if args.frames!="auto" else "9"}
362
+ try:jid=client.request("POST","/api/v1/jobs",multipart,headers)["id"]
363
+ except ClientError as exc:
364
+ if exc.data and exc.data.get("job_id"):state["job_id"]=exc.data["job_id"];private_json(manifest,state)
365
+ raise
366
+ state["job_id"]=jid;private_json(manifest,state)
367
+ print("Task "+jid+" · resume with jobs watch "+jid,file=sys.stderr)
368
+ job=client.job(jid) if args.no_wait else watch(client,jid,args.timeout)
369
+ if args.no_wait:return job
370
+ if job["state"]!="completed":raise ClientError(job.get("error") or "Task "+job["state"],data={"job_id":jid,"state":job["state"]})
371
+ return {**download(client,jid,args.output),"parameters":job["parameters"],"state":"completed"}
372
+
373
+ def main(argv=None):
374
+ argv=list(sys.argv[1:] if argv is None else argv)
375
+ if argv and argv[0] in LOCAL_COMMANDS:
376
+ try:return run_local(argv[0],argv[1:])
377
+ except KeyboardInterrupt:return 130
378
+ except (ClientError,ImportError,OSError,ValueError) as exc:
379
+ print(str(exc),file=sys.stderr);return 2
380
+ args=parser().parse_args(argv)
381
+ if args.command in LOCAL_COMMANDS:
382
+ print("Put local commands first, for example: omni-reason model --help. "
383
+ "The root --server and --json options apply to hosted commands.",file=sys.stderr)
384
+ return 2
385
+ try:
386
+ result=execute(args)
387
+ if args.json:print(json.dumps(result,ensure_ascii=False))
388
+ elif result.get("output"):print("Saved "+result["output"]+"\nTask "+result["job_id"])
389
+ elif result.get("id") and result.get("state"):
390
+ print("Task "+result["id"]+": "+result["state"]+f'\n{result["frames"]} frames from {result["start_seconds"]}s')
391
+ elif result.get("signed_in"):print("Signed in to "+result["server"]+". Try omni-reason example robot.")
392
+ elif result.get("signed_out"):print("Signed out. This credential is no longer usable.")
393
+ elif "checks" in result:
394
+ print("Ready to submit" if result["ready"] else "Not ready to submit")
395
+ for check in result["checks"]:print(("OK " if check["ready"] else "WAIT ")+check["name"]+": "+check["message"])
396
+ print(result["note"])
397
+ elif result.get("username"):
398
+ usage=result["usage"];print(result["username"]+f'\nDaily frames: {usage["daily_frames_used"]} / {usage["daily_frames_limit"]}\nActive tasks: {usage["pending"]} / {usage["pending_limit"]}')
399
+ elif result.get("valid"):print("Inputs checked. Nothing uploaded. "+result["note"])
400
+ else:print(json.dumps(result,indent=2,ensure_ascii=False))
401
+ successful_job_action=args.command=="jobs" and args.action in ("get","cancel")
402
+ terminal_failure=result.get("state") in ("failed","canceled") and not successful_job_action
403
+ return 2 if terminal_failure or result.get("ready") is False else 0
404
+ except KeyboardInterrupt:
405
+ print("Stopped waiting. Any accepted task continues; resume with the same command or job ID.",file=sys.stderr);return 130
406
+ except (ClientError,OSError,ValueError,http.client.HTTPException) as exc:
407
+ message=str(exc)
408
+ if args.json:print(json.dumps({"error":{"message":message,"status":getattr(exc,"status",0)},"context":getattr(exc,"data",None)}))
409
+ else:print(message,file=sys.stderr)
410
+ return 2
411
+
412
+ if __name__=="__main__":sys.exit(main())
@@ -0,0 +1,24 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "omni-reason-client"
7
+ version = "1.0.2"
8
+ description = "Omni-Reason hosted API client with optional local model, data and benchmark commands"
9
+ readme = "2026-11-20-package-description.md"
10
+ license = "Apache-2.0"
11
+ license-files = ["LICENSE"]
12
+ requires-python = ">=3.11"
13
+ dependencies = []
14
+
15
+ [project.urls]
16
+ Homepage = "https://omni-reason.com/"
17
+ Documentation = "https://platform.omni-reason.com/docs"
18
+ Support = "https://platform.omni-reason.com/request-access"
19
+
20
+ [project.scripts]
21
+ omni-reason = "omni_reason_client:main"
22
+
23
+ [tool.setuptools]
24
+ py-modules = ["omni_reason_client"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+