openai-rest-cli 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.
- openai_rest_cli-0.1.0/.gitignore +7 -0
- openai_rest_cli-0.1.0/LICENSE +21 -0
- openai_rest_cli-0.1.0/PKG-INFO +211 -0
- openai_rest_cli-0.1.0/README.md +184 -0
- openai_rest_cli-0.1.0/pyproject.toml +43 -0
- openai_rest_cli-0.1.0/src/openai_rest_cli/__init__.py +1 -0
- openai_rest_cli-0.1.0/src/openai_rest_cli/cli.py +20 -0
- openai_rest_cli-0.1.0/src/openai_rest_cli/spec.yaml +35805 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 shivaam
|
|
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,211 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: openai-rest-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A full-coverage CLI for the OpenAI REST API, generated from the official OpenAPI spec
|
|
5
|
+
Project-URL: Homepage, https://github.com/shivaam/openai-rest-cli
|
|
6
|
+
Project-URL: Repository, https://github.com/shivaam/openai-rest-cli
|
|
7
|
+
Project-URL: Issues, https://github.com/shivaam/openai-rest-cli/issues
|
|
8
|
+
Project-URL: OpenAI API docs, https://platform.openai.com/docs/api-reference
|
|
9
|
+
Author: shivaam
|
|
10
|
+
License-Expression: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: api,chat,cli,completions,dall-e,embeddings,gpt,llm,openai,openapi
|
|
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.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
22
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
|
+
Classifier: Topic :: Utilities
|
|
24
|
+
Requires-Python: >=3.10
|
|
25
|
+
Requires-Dist: openapi-cli-gen>=0.0.13
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# openai-rest-cli
|
|
29
|
+
|
|
30
|
+
**A full-coverage CLI for the OpenAI REST API.** Every endpoint — chat, completions, embeddings, images, moderations, files, vector stores, assistants, batch — exposed as a typed command. Generated from [OpenAI's official OpenAPI spec](https://github.com/openai/openai-openapi).
|
|
31
|
+
|
|
32
|
+
Built using [openapi-cli-gen](https://github.com/shivaam/openapi-cli-gen).
|
|
33
|
+
|
|
34
|
+
## Why
|
|
35
|
+
|
|
36
|
+
The official `openai` Python SDK **dropped its CLI in v1.0.0** (Nov 2023). Existing community CLIs are mostly chat-REPL tools (shell-gpt, llm, aichat) that focus on "ask GPT a question" and intentionally skip admin/scripting endpoints like Batch, Vector Stores, Files, and Fine-tuning.
|
|
37
|
+
|
|
38
|
+
This one is different: **every endpoint in the OpenAPI spec is a command**, with typed flags auto-generated from the spec. When OpenAI updates the spec, a regeneration gets you the new endpoints.
|
|
39
|
+
|
|
40
|
+
Think `kubectl` for OpenAI, not another chat REPL.
|
|
41
|
+
|
|
42
|
+
## Install
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pipx install openai-rest-cli
|
|
46
|
+
|
|
47
|
+
# Or with uv
|
|
48
|
+
uv tool install openai-rest-cli
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Setup
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
export OPENAI_REST_CLI_TOKEN=sk-... # your OpenAI API key
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Quick Start
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
# List all models
|
|
61
|
+
openai-rest-cli Models list
|
|
62
|
+
|
|
63
|
+
# Get a specific model
|
|
64
|
+
openai-rest-cli Models retrieve --model gpt-4o-mini
|
|
65
|
+
|
|
66
|
+
# Chat completion (GPT-4o-mini)
|
|
67
|
+
openai-rest-cli Chat create-completion \
|
|
68
|
+
--model gpt-4o-mini \
|
|
69
|
+
--messages '[{"role":"user","content":"Hello"}]'
|
|
70
|
+
|
|
71
|
+
# Generate an embedding
|
|
72
|
+
openai-rest-cli Embeddings create \
|
|
73
|
+
--input "Hello world" \
|
|
74
|
+
--model text-embedding-3-small \
|
|
75
|
+
--dimensions 8
|
|
76
|
+
|
|
77
|
+
# Classify content (moderation)
|
|
78
|
+
openai-rest-cli Moderations create --input "I love puppies"
|
|
79
|
+
|
|
80
|
+
# Generate an image (DALL-E)
|
|
81
|
+
openai-rest-cli Images create \
|
|
82
|
+
--prompt "A cat coding on a laptop" \
|
|
83
|
+
--model dall-e-2 \
|
|
84
|
+
--size 256x256
|
|
85
|
+
|
|
86
|
+
# List files
|
|
87
|
+
openai-rest-cli Files list
|
|
88
|
+
|
|
89
|
+
# Vector stores
|
|
90
|
+
openai-rest-cli "Vector stores" list-vector-stores
|
|
91
|
+
openai-rest-cli "Vector stores" create-vector-store --name my_store
|
|
92
|
+
|
|
93
|
+
# Batch operations
|
|
94
|
+
openai-rest-cli Batch list-batches --limit 10
|
|
95
|
+
|
|
96
|
+
# Legacy text completion (GPT-3.5-turbo-instruct)
|
|
97
|
+
openai-rest-cli Completions create \
|
|
98
|
+
--model gpt-3.5-turbo-instruct \
|
|
99
|
+
--prompt "Python is" \
|
|
100
|
+
--max-tokens 30
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## What's Covered
|
|
104
|
+
|
|
105
|
+
| Group | Example commands |
|
|
106
|
+
|---|---|
|
|
107
|
+
| **Chat** | `create-completion`, `list-completions`, `get-completion` |
|
|
108
|
+
| **Completions** (legacy) | `create` |
|
|
109
|
+
| **Embeddings** | `create` |
|
|
110
|
+
| **Images** | `create` (DALL-E), `create-edit`, `create-variation` |
|
|
111
|
+
| **Audio** | `create-speech`, `create-transcription`, `create-translation` |
|
|
112
|
+
| **Moderations** | `create` |
|
|
113
|
+
| **Models** | `list`, `retrieve`, `delete` |
|
|
114
|
+
| **Files** | `create`, `list`, `retrieve`, `delete`, `download` |
|
|
115
|
+
| **Vector stores** | Full CRUD + file attach/detach |
|
|
116
|
+
| **Assistants** | Full lifecycle (requires `OpenAI-Beta` header) |
|
|
117
|
+
| **Batch** | `create`, `retrieve`, `cancel`, `list-batches` |
|
|
118
|
+
| **Fine-tuning** | Jobs, events, checkpoints |
|
|
119
|
+
| **Uploads** | Multi-part file uploads |
|
|
120
|
+
| **Responses** | Create, delete, get |
|
|
121
|
+
|
|
122
|
+
## Output Formats
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
openai-rest-cli Models list --output-format json # default
|
|
126
|
+
openai-rest-cli Models list --output-format table # rich table
|
|
127
|
+
openai-rest-cli Models list --output-format yaml
|
|
128
|
+
openai-rest-cli Models list --output-format raw
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Discovery
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
# Top-level groups
|
|
135
|
+
openai-rest-cli --help
|
|
136
|
+
|
|
137
|
+
# Commands in a group
|
|
138
|
+
openai-rest-cli Chat --help
|
|
139
|
+
|
|
140
|
+
# Flags for a specific command
|
|
141
|
+
openai-rest-cli Images create --help
|
|
142
|
+
# Shows: --prompt, --model, --size {256x256,512x512,...}, --quality {standard,hd}, etc.
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Real Example Session
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
$ openai-rest-cli Embeddings create --input "Hello" --model text-embedding-3-small --dimensions 4
|
|
149
|
+
{
|
|
150
|
+
"object": "list",
|
|
151
|
+
"data": [
|
|
152
|
+
{
|
|
153
|
+
"object": "embedding",
|
|
154
|
+
"embedding": [-0.087, -0.041, 0.115, -0.205],
|
|
155
|
+
"index": 0
|
|
156
|
+
}
|
|
157
|
+
],
|
|
158
|
+
"model": "text-embedding-3-small",
|
|
159
|
+
"usage": {
|
|
160
|
+
"prompt_tokens": 1,
|
|
161
|
+
"total_tokens": 1
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
$ openai-rest-cli Chat create-completion \
|
|
166
|
+
--model gpt-4o-mini \
|
|
167
|
+
--messages '[{"role":"user","content":"Reply in 3 words"}]'
|
|
168
|
+
{
|
|
169
|
+
"id": "chatcmpl-...",
|
|
170
|
+
"choices": [
|
|
171
|
+
{
|
|
172
|
+
"message": {
|
|
173
|
+
"role": "assistant",
|
|
174
|
+
"content": "Sure, what's up?"
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
],
|
|
178
|
+
"usage": { "prompt_tokens": 13, "completion_tokens": 5 }
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
$ openai-rest-cli Images create --prompt "A cat coding" --model dall-e-2 --size 256x256
|
|
182
|
+
{
|
|
183
|
+
"created": 1775806667,
|
|
184
|
+
"data": [
|
|
185
|
+
{ "url": "https://oaidalleapiprodscus.blob.core.windows.net/..." }
|
|
186
|
+
]
|
|
187
|
+
}
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
## How It Works
|
|
191
|
+
|
|
192
|
+
This package is a thin wrapper:
|
|
193
|
+
- Embeds the OpenAI OpenAPI spec (`spec.yaml`)
|
|
194
|
+
- Delegates CLI generation to [openapi-cli-gen](https://github.com/shivaam/openapi-cli-gen) at runtime
|
|
195
|
+
- Base URL defaults to `https://api.openai.com/v1`
|
|
196
|
+
|
|
197
|
+
Since it's spec-driven, adding new endpoints is just a regeneration. No manual wrapping to fall behind.
|
|
198
|
+
|
|
199
|
+
## Limitations
|
|
200
|
+
|
|
201
|
+
- **Complex `oneOf`/`anyOf` bodies**: Some endpoints with deeply nested unions (e.g., Assistants message content with mixed types) require passing JSON via a fallback field instead of individual flags.
|
|
202
|
+
- **Assistants API**: Requires `OpenAI-Beta: assistants=v2` header. Not yet supported natively — you can work around by using the SDK for Assistants.
|
|
203
|
+
- **Streaming**: Not supported. For streaming chat, use the SDK directly.
|
|
204
|
+
|
|
205
|
+
## Not Affiliated
|
|
206
|
+
|
|
207
|
+
This is an **unofficial community CLI** built on top of OpenAI's public OpenAPI spec. It is not endorsed by or affiliated with OpenAI. The `openai` package on PyPI is the official SDK.
|
|
208
|
+
|
|
209
|
+
## License
|
|
210
|
+
|
|
211
|
+
MIT
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
# openai-rest-cli
|
|
2
|
+
|
|
3
|
+
**A full-coverage CLI for the OpenAI REST API.** Every endpoint — chat, completions, embeddings, images, moderations, files, vector stores, assistants, batch — exposed as a typed command. Generated from [OpenAI's official OpenAPI spec](https://github.com/openai/openai-openapi).
|
|
4
|
+
|
|
5
|
+
Built using [openapi-cli-gen](https://github.com/shivaam/openapi-cli-gen).
|
|
6
|
+
|
|
7
|
+
## Why
|
|
8
|
+
|
|
9
|
+
The official `openai` Python SDK **dropped its CLI in v1.0.0** (Nov 2023). Existing community CLIs are mostly chat-REPL tools (shell-gpt, llm, aichat) that focus on "ask GPT a question" and intentionally skip admin/scripting endpoints like Batch, Vector Stores, Files, and Fine-tuning.
|
|
10
|
+
|
|
11
|
+
This one is different: **every endpoint in the OpenAPI spec is a command**, with typed flags auto-generated from the spec. When OpenAI updates the spec, a regeneration gets you the new endpoints.
|
|
12
|
+
|
|
13
|
+
Think `kubectl` for OpenAI, not another chat REPL.
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pipx install openai-rest-cli
|
|
19
|
+
|
|
20
|
+
# Or with uv
|
|
21
|
+
uv tool install openai-rest-cli
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Setup
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
export OPENAI_REST_CLI_TOKEN=sk-... # your OpenAI API key
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Quick Start
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# List all models
|
|
34
|
+
openai-rest-cli Models list
|
|
35
|
+
|
|
36
|
+
# Get a specific model
|
|
37
|
+
openai-rest-cli Models retrieve --model gpt-4o-mini
|
|
38
|
+
|
|
39
|
+
# Chat completion (GPT-4o-mini)
|
|
40
|
+
openai-rest-cli Chat create-completion \
|
|
41
|
+
--model gpt-4o-mini \
|
|
42
|
+
--messages '[{"role":"user","content":"Hello"}]'
|
|
43
|
+
|
|
44
|
+
# Generate an embedding
|
|
45
|
+
openai-rest-cli Embeddings create \
|
|
46
|
+
--input "Hello world" \
|
|
47
|
+
--model text-embedding-3-small \
|
|
48
|
+
--dimensions 8
|
|
49
|
+
|
|
50
|
+
# Classify content (moderation)
|
|
51
|
+
openai-rest-cli Moderations create --input "I love puppies"
|
|
52
|
+
|
|
53
|
+
# Generate an image (DALL-E)
|
|
54
|
+
openai-rest-cli Images create \
|
|
55
|
+
--prompt "A cat coding on a laptop" \
|
|
56
|
+
--model dall-e-2 \
|
|
57
|
+
--size 256x256
|
|
58
|
+
|
|
59
|
+
# List files
|
|
60
|
+
openai-rest-cli Files list
|
|
61
|
+
|
|
62
|
+
# Vector stores
|
|
63
|
+
openai-rest-cli "Vector stores" list-vector-stores
|
|
64
|
+
openai-rest-cli "Vector stores" create-vector-store --name my_store
|
|
65
|
+
|
|
66
|
+
# Batch operations
|
|
67
|
+
openai-rest-cli Batch list-batches --limit 10
|
|
68
|
+
|
|
69
|
+
# Legacy text completion (GPT-3.5-turbo-instruct)
|
|
70
|
+
openai-rest-cli Completions create \
|
|
71
|
+
--model gpt-3.5-turbo-instruct \
|
|
72
|
+
--prompt "Python is" \
|
|
73
|
+
--max-tokens 30
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## What's Covered
|
|
77
|
+
|
|
78
|
+
| Group | Example commands |
|
|
79
|
+
|---|---|
|
|
80
|
+
| **Chat** | `create-completion`, `list-completions`, `get-completion` |
|
|
81
|
+
| **Completions** (legacy) | `create` |
|
|
82
|
+
| **Embeddings** | `create` |
|
|
83
|
+
| **Images** | `create` (DALL-E), `create-edit`, `create-variation` |
|
|
84
|
+
| **Audio** | `create-speech`, `create-transcription`, `create-translation` |
|
|
85
|
+
| **Moderations** | `create` |
|
|
86
|
+
| **Models** | `list`, `retrieve`, `delete` |
|
|
87
|
+
| **Files** | `create`, `list`, `retrieve`, `delete`, `download` |
|
|
88
|
+
| **Vector stores** | Full CRUD + file attach/detach |
|
|
89
|
+
| **Assistants** | Full lifecycle (requires `OpenAI-Beta` header) |
|
|
90
|
+
| **Batch** | `create`, `retrieve`, `cancel`, `list-batches` |
|
|
91
|
+
| **Fine-tuning** | Jobs, events, checkpoints |
|
|
92
|
+
| **Uploads** | Multi-part file uploads |
|
|
93
|
+
| **Responses** | Create, delete, get |
|
|
94
|
+
|
|
95
|
+
## Output Formats
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
openai-rest-cli Models list --output-format json # default
|
|
99
|
+
openai-rest-cli Models list --output-format table # rich table
|
|
100
|
+
openai-rest-cli Models list --output-format yaml
|
|
101
|
+
openai-rest-cli Models list --output-format raw
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Discovery
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# Top-level groups
|
|
108
|
+
openai-rest-cli --help
|
|
109
|
+
|
|
110
|
+
# Commands in a group
|
|
111
|
+
openai-rest-cli Chat --help
|
|
112
|
+
|
|
113
|
+
# Flags for a specific command
|
|
114
|
+
openai-rest-cli Images create --help
|
|
115
|
+
# Shows: --prompt, --model, --size {256x256,512x512,...}, --quality {standard,hd}, etc.
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Real Example Session
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
$ openai-rest-cli Embeddings create --input "Hello" --model text-embedding-3-small --dimensions 4
|
|
122
|
+
{
|
|
123
|
+
"object": "list",
|
|
124
|
+
"data": [
|
|
125
|
+
{
|
|
126
|
+
"object": "embedding",
|
|
127
|
+
"embedding": [-0.087, -0.041, 0.115, -0.205],
|
|
128
|
+
"index": 0
|
|
129
|
+
}
|
|
130
|
+
],
|
|
131
|
+
"model": "text-embedding-3-small",
|
|
132
|
+
"usage": {
|
|
133
|
+
"prompt_tokens": 1,
|
|
134
|
+
"total_tokens": 1
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
$ openai-rest-cli Chat create-completion \
|
|
139
|
+
--model gpt-4o-mini \
|
|
140
|
+
--messages '[{"role":"user","content":"Reply in 3 words"}]'
|
|
141
|
+
{
|
|
142
|
+
"id": "chatcmpl-...",
|
|
143
|
+
"choices": [
|
|
144
|
+
{
|
|
145
|
+
"message": {
|
|
146
|
+
"role": "assistant",
|
|
147
|
+
"content": "Sure, what's up?"
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
],
|
|
151
|
+
"usage": { "prompt_tokens": 13, "completion_tokens": 5 }
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
$ openai-rest-cli Images create --prompt "A cat coding" --model dall-e-2 --size 256x256
|
|
155
|
+
{
|
|
156
|
+
"created": 1775806667,
|
|
157
|
+
"data": [
|
|
158
|
+
{ "url": "https://oaidalleapiprodscus.blob.core.windows.net/..." }
|
|
159
|
+
]
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## How It Works
|
|
164
|
+
|
|
165
|
+
This package is a thin wrapper:
|
|
166
|
+
- Embeds the OpenAI OpenAPI spec (`spec.yaml`)
|
|
167
|
+
- Delegates CLI generation to [openapi-cli-gen](https://github.com/shivaam/openapi-cli-gen) at runtime
|
|
168
|
+
- Base URL defaults to `https://api.openai.com/v1`
|
|
169
|
+
|
|
170
|
+
Since it's spec-driven, adding new endpoints is just a regeneration. No manual wrapping to fall behind.
|
|
171
|
+
|
|
172
|
+
## Limitations
|
|
173
|
+
|
|
174
|
+
- **Complex `oneOf`/`anyOf` bodies**: Some endpoints with deeply nested unions (e.g., Assistants message content with mixed types) require passing JSON via a fallback field instead of individual flags.
|
|
175
|
+
- **Assistants API**: Requires `OpenAI-Beta: assistants=v2` header. Not yet supported natively — you can work around by using the SDK for Assistants.
|
|
176
|
+
- **Streaming**: Not supported. For streaming chat, use the SDK directly.
|
|
177
|
+
|
|
178
|
+
## Not Affiliated
|
|
179
|
+
|
|
180
|
+
This is an **unofficial community CLI** built on top of OpenAI's public OpenAPI spec. It is not endorsed by or affiliated with OpenAI. The `openai` package on PyPI is the official SDK.
|
|
181
|
+
|
|
182
|
+
## License
|
|
183
|
+
|
|
184
|
+
MIT
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "openai-rest-cli"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "A full-coverage CLI for the OpenAI REST API, generated from the official OpenAPI spec"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "shivaam" },
|
|
14
|
+
]
|
|
15
|
+
keywords = ["openai", "cli", "gpt", "llm", "api", "openapi", "chat", "completions", "embeddings", "dall-e"]
|
|
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.10",
|
|
22
|
+
"Programming Language :: Python :: 3.11",
|
|
23
|
+
"Programming Language :: Python :: 3.12",
|
|
24
|
+
"Programming Language :: Python :: 3.13",
|
|
25
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
26
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
27
|
+
"Topic :: Utilities",
|
|
28
|
+
]
|
|
29
|
+
dependencies = [
|
|
30
|
+
"openapi-cli-gen>=0.0.13",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[project.scripts]
|
|
34
|
+
openai-rest-cli = "openai_rest_cli.cli:main"
|
|
35
|
+
|
|
36
|
+
[project.urls]
|
|
37
|
+
Homepage = "https://github.com/shivaam/openai-rest-cli"
|
|
38
|
+
Repository = "https://github.com/shivaam/openai-rest-cli"
|
|
39
|
+
Issues = "https://github.com/shivaam/openai-rest-cli/issues"
|
|
40
|
+
"OpenAI API docs" = "https://platform.openai.com/docs/api-reference"
|
|
41
|
+
|
|
42
|
+
[tool.hatch.build.targets.wheel]
|
|
43
|
+
packages = ["src/openai_rest_cli"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""openai-rest-cli CLI — generated by openapi-cli-gen."""
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
from openapi_cli_gen import build_cli
|
|
4
|
+
|
|
5
|
+
# Base URL: override via OPENAI_REST_CLI_BASE_URL env var, fall back to spec default
|
|
6
|
+
_base_url = os.environ.get("OPENAI_REST_CLI_BASE_URL")
|
|
7
|
+
|
|
8
|
+
app = build_cli(
|
|
9
|
+
spec=Path(__file__).parent / "spec.yaml",
|
|
10
|
+
name="openai-rest-cli",
|
|
11
|
+
base_url=_base_url,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def main():
|
|
16
|
+
app()
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
if __name__ == "__main__":
|
|
20
|
+
main()
|