cmdop-llm 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.
- cmdop_llm-0.1.0/.gitignore +103 -0
- cmdop_llm-0.1.0/LICENSE +21 -0
- cmdop_llm-0.1.0/PKG-INFO +198 -0
- cmdop_llm-0.1.0/README.md +161 -0
- cmdop_llm-0.1.0/cmdop_llm/__init__.py +89 -0
- cmdop_llm-0.1.0/cmdop_llm/_client.py +217 -0
- cmdop_llm-0.1.0/cmdop_llm/_constants.py +12 -0
- cmdop_llm-0.1.0/cmdop_llm/_version.py +6 -0
- cmdop_llm-0.1.0/cmdop_llm/py.typed +1 -0
- cmdop_llm-0.1.0/cmdop_llm/resources/__init__.py +11 -0
- cmdop_llm-0.1.0/cmdop_llm/resources/ocr.py +180 -0
- cmdop_llm-0.1.0/cmdop_llm/resources/vision.py +186 -0
- cmdop_llm-0.1.0/cmdop_llm/types/__init__.py +11 -0
- cmdop_llm-0.1.0/cmdop_llm/types/ocr.py +50 -0
- cmdop_llm-0.1.0/cmdop_llm/types/vision.py +59 -0
- cmdop_llm-0.1.0/pyproject.toml +98 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
*.egg-info/
|
|
24
|
+
.installed.cfg
|
|
25
|
+
*.egg
|
|
26
|
+
|
|
27
|
+
# PyInstaller
|
|
28
|
+
*.manifest
|
|
29
|
+
*.spec
|
|
30
|
+
|
|
31
|
+
# Installer logs
|
|
32
|
+
pip-log.txt
|
|
33
|
+
pip-delete-this-directory.txt
|
|
34
|
+
|
|
35
|
+
# Unit test / coverage reports
|
|
36
|
+
htmlcov/
|
|
37
|
+
.tox/
|
|
38
|
+
.nox/
|
|
39
|
+
.coverage
|
|
40
|
+
.coverage.*
|
|
41
|
+
.cache
|
|
42
|
+
nosetests.xml
|
|
43
|
+
coverage.xml
|
|
44
|
+
*.cover
|
|
45
|
+
*.py,cover
|
|
46
|
+
.hypothesis/
|
|
47
|
+
.pytest_cache/
|
|
48
|
+
|
|
49
|
+
# Translations
|
|
50
|
+
*.mo
|
|
51
|
+
*.pot
|
|
52
|
+
|
|
53
|
+
# Environments
|
|
54
|
+
# .env
|
|
55
|
+
# .env.local
|
|
56
|
+
.venv
|
|
57
|
+
env/
|
|
58
|
+
venv/
|
|
59
|
+
ENV/
|
|
60
|
+
env.bak/
|
|
61
|
+
venv.bak/
|
|
62
|
+
|
|
63
|
+
# IDEs
|
|
64
|
+
.idea/
|
|
65
|
+
.vscode/
|
|
66
|
+
*.swp
|
|
67
|
+
*.swo
|
|
68
|
+
*~
|
|
69
|
+
.project
|
|
70
|
+
.pydevproject
|
|
71
|
+
.settings/
|
|
72
|
+
|
|
73
|
+
# Jupyter Notebook
|
|
74
|
+
.ipynb_checkpoints
|
|
75
|
+
|
|
76
|
+
# mypy
|
|
77
|
+
.mypy_cache/
|
|
78
|
+
.dmypy.json
|
|
79
|
+
dmypy.json
|
|
80
|
+
|
|
81
|
+
# Pyre
|
|
82
|
+
.pyre/
|
|
83
|
+
|
|
84
|
+
# pyright
|
|
85
|
+
.pyright/
|
|
86
|
+
|
|
87
|
+
# ruff
|
|
88
|
+
.ruff_cache/
|
|
89
|
+
|
|
90
|
+
# OS
|
|
91
|
+
.DS_Store
|
|
92
|
+
Thumbs.db
|
|
93
|
+
|
|
94
|
+
# Logs
|
|
95
|
+
*.log
|
|
96
|
+
logs/
|
|
97
|
+
|
|
98
|
+
# Data files
|
|
99
|
+
data/
|
|
100
|
+
*.json.tmp
|
|
101
|
+
|
|
102
|
+
# Local development
|
|
103
|
+
.local/
|
cmdop_llm-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 CMDOP
|
|
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.
|
cmdop_llm-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: cmdop-llm
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python SDK for CMDOP LLM Service - OpenAI-compatible API for 200+ AI models
|
|
5
|
+
Project-URL: Homepage, https://cmdop.com
|
|
6
|
+
Project-URL: Documentation, https://sdk.cmdop.com
|
|
7
|
+
Project-URL: Repository, https://github.com/markolofsen/cmdop-client
|
|
8
|
+
Project-URL: Issues, https://github.com/markolofsen/cmdop-client/issues
|
|
9
|
+
Author-email: CMDOP Team <support@cmdop.com>
|
|
10
|
+
License-Expression: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: ai,anthropic,api,chat,claude,cmdop,gpt,llm,openai,openrouter
|
|
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.9
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
23
|
+
Classifier: Typing :: Typed
|
|
24
|
+
Requires-Python: >=3.9
|
|
25
|
+
Requires-Dist: httpx<1,>=0.23.0
|
|
26
|
+
Requires-Dist: openai<3.0.0,>=1.0.0
|
|
27
|
+
Requires-Dist: pydantic<3,>=2.0.0
|
|
28
|
+
Requires-Dist: typing-extensions>=4.5.0
|
|
29
|
+
Provides-Extra: dev
|
|
30
|
+
Requires-Dist: mypy>=1.0.0; extra == 'dev'
|
|
31
|
+
Requires-Dist: pyright>=1.1.300; extra == 'dev'
|
|
32
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
|
|
33
|
+
Requires-Dist: pytest>=7.0.0; extra == 'dev'
|
|
34
|
+
Requires-Dist: respx>=0.20.0; extra == 'dev'
|
|
35
|
+
Requires-Dist: ruff>=0.1.0; extra == 'dev'
|
|
36
|
+
Description-Content-Type: text/markdown
|
|
37
|
+
|
|
38
|
+
# CMDOP LLM Python SDK
|
|
39
|
+
|
|
40
|
+
Python SDK for CMDOP LLM Service - OpenAI-compatible API for 200+ AI models.
|
|
41
|
+
|
|
42
|
+
## Installation
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
pip install cmdop-llm
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Quick Start
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
from cmdop_llm import CmdopLLM
|
|
52
|
+
|
|
53
|
+
client = CmdopLLM(api_key="your-api-key")
|
|
54
|
+
|
|
55
|
+
response = client.chat.completions.create(
|
|
56
|
+
model="anthropic/claude-3.5-sonnet",
|
|
57
|
+
messages=[{"role": "user", "content": "Hello!"}]
|
|
58
|
+
)
|
|
59
|
+
print(response.choices[0].message.content)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Features
|
|
63
|
+
|
|
64
|
+
- **Drop-in OpenAI replacement** - Same API, different models
|
|
65
|
+
- **200+ Models** - GPT-4, Claude, Llama, Mistral, Gemini via single endpoint
|
|
66
|
+
- **Streaming** - Real-time token streaming
|
|
67
|
+
- **Vision & OCR** - Image analysis and text extraction
|
|
68
|
+
- **Image Generation** - FLUX, DALL-E and other models
|
|
69
|
+
- **Async Support** - Full async/await support
|
|
70
|
+
|
|
71
|
+
## Environment Variables
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
export CMDOP_API_KEY="your-api-key"
|
|
75
|
+
export CMDOP_BASE_URL="https://llm.cmdop.com" # Optional, default
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Usage Examples
|
|
79
|
+
|
|
80
|
+
### Chat Completion
|
|
81
|
+
|
|
82
|
+
```python
|
|
83
|
+
from cmdop_llm import CmdopLLM
|
|
84
|
+
|
|
85
|
+
client = CmdopLLM()
|
|
86
|
+
|
|
87
|
+
response = client.chat.completions.create(
|
|
88
|
+
model="openai/gpt-4o",
|
|
89
|
+
messages=[
|
|
90
|
+
{"role": "system", "content": "You are a helpful assistant."},
|
|
91
|
+
{"role": "user", "content": "Explain quantum computing."}
|
|
92
|
+
],
|
|
93
|
+
temperature=0.7,
|
|
94
|
+
max_tokens=1000,
|
|
95
|
+
)
|
|
96
|
+
print(response.choices[0].message.content)
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Streaming
|
|
100
|
+
|
|
101
|
+
```python
|
|
102
|
+
stream = client.chat.completions.create(
|
|
103
|
+
model="anthropic/claude-3.5-sonnet",
|
|
104
|
+
messages=[{"role": "user", "content": "Write a poem."}],
|
|
105
|
+
stream=True,
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
for chunk in stream:
|
|
109
|
+
if chunk.choices[0].delta.content:
|
|
110
|
+
print(chunk.choices[0].delta.content, end="")
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Vision Analysis
|
|
114
|
+
|
|
115
|
+
```python
|
|
116
|
+
result = client.vision.analyze(
|
|
117
|
+
image_url="https://example.com/image.jpg",
|
|
118
|
+
prompt="Describe this image"
|
|
119
|
+
)
|
|
120
|
+
print(result.description)
|
|
121
|
+
print(result.extracted_text)
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### OCR Text Extraction
|
|
125
|
+
|
|
126
|
+
```python
|
|
127
|
+
result = client.ocr.extract(
|
|
128
|
+
image_url="https://example.com/document.png"
|
|
129
|
+
)
|
|
130
|
+
print(result.text)
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
### Image Generation
|
|
134
|
+
|
|
135
|
+
```python
|
|
136
|
+
response = client.images.generate(
|
|
137
|
+
model="black-forest-labs/FLUX.1-schnell",
|
|
138
|
+
prompt="A futuristic cityscape",
|
|
139
|
+
size="1024x1024",
|
|
140
|
+
)
|
|
141
|
+
print(response.data[0].url)
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Async Usage
|
|
145
|
+
|
|
146
|
+
```python
|
|
147
|
+
import asyncio
|
|
148
|
+
from cmdop_llm import AsyncCmdopLLM
|
|
149
|
+
|
|
150
|
+
async def main():
|
|
151
|
+
client = AsyncCmdopLLM()
|
|
152
|
+
|
|
153
|
+
response = await client.chat.completions.create(
|
|
154
|
+
model="openai/gpt-4o",
|
|
155
|
+
messages=[{"role": "user", "content": "Hello!"}]
|
|
156
|
+
)
|
|
157
|
+
print(response.choices[0].message.content)
|
|
158
|
+
|
|
159
|
+
asyncio.run(main())
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Available Models
|
|
163
|
+
|
|
164
|
+
Access 200+ models including:
|
|
165
|
+
|
|
166
|
+
- **OpenAI**: gpt-4o, gpt-4o-mini, gpt-4-turbo
|
|
167
|
+
- **Anthropic**: claude-3.5-sonnet, claude-3-opus, claude-3-haiku
|
|
168
|
+
- **Google**: gemini-pro, gemini-1.5-pro
|
|
169
|
+
- **Meta**: llama-3.1-405b, llama-3.1-70b
|
|
170
|
+
- **Mistral**: mistral-large, mixtral-8x22b
|
|
171
|
+
- **Image**: FLUX.1-schnell, FLUX.1-pro, stable-diffusion-xl
|
|
172
|
+
|
|
173
|
+
Use model format: `provider/model-name` (e.g., `openai/gpt-4o`)
|
|
174
|
+
|
|
175
|
+
## API Reference
|
|
176
|
+
|
|
177
|
+
### CmdopLLM
|
|
178
|
+
|
|
179
|
+
```python
|
|
180
|
+
CmdopLLM(
|
|
181
|
+
api_key: str = None, # From CMDOP_API_KEY env if not set
|
|
182
|
+
base_url: str = None, # Default: https://llm.cmdop.com
|
|
183
|
+
timeout: float = None, # Request timeout
|
|
184
|
+
max_retries: int = 2, # Retry count
|
|
185
|
+
)
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Resources
|
|
189
|
+
|
|
190
|
+
- `client.chat.completions` - Chat completions (OpenAI compatible)
|
|
191
|
+
- `client.images` - Image generation (OpenAI compatible)
|
|
192
|
+
- `client.models` - List available models
|
|
193
|
+
- `client.vision` - Vision analysis (CMDOP specific)
|
|
194
|
+
- `client.ocr` - OCR extraction (CMDOP specific)
|
|
195
|
+
|
|
196
|
+
## License
|
|
197
|
+
|
|
198
|
+
MIT
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
# CMDOP LLM Python SDK
|
|
2
|
+
|
|
3
|
+
Python SDK for CMDOP LLM Service - OpenAI-compatible API for 200+ AI models.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install cmdop-llm
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
from cmdop_llm import CmdopLLM
|
|
15
|
+
|
|
16
|
+
client = CmdopLLM(api_key="your-api-key")
|
|
17
|
+
|
|
18
|
+
response = client.chat.completions.create(
|
|
19
|
+
model="anthropic/claude-3.5-sonnet",
|
|
20
|
+
messages=[{"role": "user", "content": "Hello!"}]
|
|
21
|
+
)
|
|
22
|
+
print(response.choices[0].message.content)
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Features
|
|
26
|
+
|
|
27
|
+
- **Drop-in OpenAI replacement** - Same API, different models
|
|
28
|
+
- **200+ Models** - GPT-4, Claude, Llama, Mistral, Gemini via single endpoint
|
|
29
|
+
- **Streaming** - Real-time token streaming
|
|
30
|
+
- **Vision & OCR** - Image analysis and text extraction
|
|
31
|
+
- **Image Generation** - FLUX, DALL-E and other models
|
|
32
|
+
- **Async Support** - Full async/await support
|
|
33
|
+
|
|
34
|
+
## Environment Variables
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
export CMDOP_API_KEY="your-api-key"
|
|
38
|
+
export CMDOP_BASE_URL="https://llm.cmdop.com" # Optional, default
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Usage Examples
|
|
42
|
+
|
|
43
|
+
### Chat Completion
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
from cmdop_llm import CmdopLLM
|
|
47
|
+
|
|
48
|
+
client = CmdopLLM()
|
|
49
|
+
|
|
50
|
+
response = client.chat.completions.create(
|
|
51
|
+
model="openai/gpt-4o",
|
|
52
|
+
messages=[
|
|
53
|
+
{"role": "system", "content": "You are a helpful assistant."},
|
|
54
|
+
{"role": "user", "content": "Explain quantum computing."}
|
|
55
|
+
],
|
|
56
|
+
temperature=0.7,
|
|
57
|
+
max_tokens=1000,
|
|
58
|
+
)
|
|
59
|
+
print(response.choices[0].message.content)
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Streaming
|
|
63
|
+
|
|
64
|
+
```python
|
|
65
|
+
stream = client.chat.completions.create(
|
|
66
|
+
model="anthropic/claude-3.5-sonnet",
|
|
67
|
+
messages=[{"role": "user", "content": "Write a poem."}],
|
|
68
|
+
stream=True,
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
for chunk in stream:
|
|
72
|
+
if chunk.choices[0].delta.content:
|
|
73
|
+
print(chunk.choices[0].delta.content, end="")
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Vision Analysis
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
result = client.vision.analyze(
|
|
80
|
+
image_url="https://example.com/image.jpg",
|
|
81
|
+
prompt="Describe this image"
|
|
82
|
+
)
|
|
83
|
+
print(result.description)
|
|
84
|
+
print(result.extracted_text)
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### OCR Text Extraction
|
|
88
|
+
|
|
89
|
+
```python
|
|
90
|
+
result = client.ocr.extract(
|
|
91
|
+
image_url="https://example.com/document.png"
|
|
92
|
+
)
|
|
93
|
+
print(result.text)
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Image Generation
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
response = client.images.generate(
|
|
100
|
+
model="black-forest-labs/FLUX.1-schnell",
|
|
101
|
+
prompt="A futuristic cityscape",
|
|
102
|
+
size="1024x1024",
|
|
103
|
+
)
|
|
104
|
+
print(response.data[0].url)
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Async Usage
|
|
108
|
+
|
|
109
|
+
```python
|
|
110
|
+
import asyncio
|
|
111
|
+
from cmdop_llm import AsyncCmdopLLM
|
|
112
|
+
|
|
113
|
+
async def main():
|
|
114
|
+
client = AsyncCmdopLLM()
|
|
115
|
+
|
|
116
|
+
response = await client.chat.completions.create(
|
|
117
|
+
model="openai/gpt-4o",
|
|
118
|
+
messages=[{"role": "user", "content": "Hello!"}]
|
|
119
|
+
)
|
|
120
|
+
print(response.choices[0].message.content)
|
|
121
|
+
|
|
122
|
+
asyncio.run(main())
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Available Models
|
|
126
|
+
|
|
127
|
+
Access 200+ models including:
|
|
128
|
+
|
|
129
|
+
- **OpenAI**: gpt-4o, gpt-4o-mini, gpt-4-turbo
|
|
130
|
+
- **Anthropic**: claude-3.5-sonnet, claude-3-opus, claude-3-haiku
|
|
131
|
+
- **Google**: gemini-pro, gemini-1.5-pro
|
|
132
|
+
- **Meta**: llama-3.1-405b, llama-3.1-70b
|
|
133
|
+
- **Mistral**: mistral-large, mixtral-8x22b
|
|
134
|
+
- **Image**: FLUX.1-schnell, FLUX.1-pro, stable-diffusion-xl
|
|
135
|
+
|
|
136
|
+
Use model format: `provider/model-name` (e.g., `openai/gpt-4o`)
|
|
137
|
+
|
|
138
|
+
## API Reference
|
|
139
|
+
|
|
140
|
+
### CmdopLLM
|
|
141
|
+
|
|
142
|
+
```python
|
|
143
|
+
CmdopLLM(
|
|
144
|
+
api_key: str = None, # From CMDOP_API_KEY env if not set
|
|
145
|
+
base_url: str = None, # Default: https://llm.cmdop.com
|
|
146
|
+
timeout: float = None, # Request timeout
|
|
147
|
+
max_retries: int = 2, # Retry count
|
|
148
|
+
)
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Resources
|
|
152
|
+
|
|
153
|
+
- `client.chat.completions` - Chat completions (OpenAI compatible)
|
|
154
|
+
- `client.images` - Image generation (OpenAI compatible)
|
|
155
|
+
- `client.models` - List available models
|
|
156
|
+
- `client.vision` - Vision analysis (CMDOP specific)
|
|
157
|
+
- `client.ocr` - OCR extraction (CMDOP specific)
|
|
158
|
+
|
|
159
|
+
## License
|
|
160
|
+
|
|
161
|
+
MIT
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"""CMDOP LLM Python SDK.
|
|
2
|
+
|
|
3
|
+
A drop-in replacement for OpenAI Python SDK that connects to llm.cmdop.com.
|
|
4
|
+
Provides access to 200+ AI models via OpenRouter, plus custom vision/OCR endpoints.
|
|
5
|
+
|
|
6
|
+
Example:
|
|
7
|
+
```python
|
|
8
|
+
from cmdop_llm import CmdopLLM
|
|
9
|
+
|
|
10
|
+
client = CmdopLLM(api_key="your-api-key")
|
|
11
|
+
|
|
12
|
+
# Chat completion (same as OpenAI)
|
|
13
|
+
response = client.chat.completions.create(
|
|
14
|
+
model="anthropic/claude-3.5-sonnet",
|
|
15
|
+
messages=[{"role": "user", "content": "Hello!"}]
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
# Vision analysis (CMDOP-specific)
|
|
19
|
+
result = client.vision.analyze(image_url="https://...")
|
|
20
|
+
|
|
21
|
+
# OCR (CMDOP-specific)
|
|
22
|
+
result = client.ocr.extract(image_url="https://...")
|
|
23
|
+
```
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
from openai import (
|
|
27
|
+
APIConnectionError,
|
|
28
|
+
APIError,
|
|
29
|
+
APIStatusError,
|
|
30
|
+
APITimeoutError,
|
|
31
|
+
AsyncStream,
|
|
32
|
+
AuthenticationError,
|
|
33
|
+
BadRequestError,
|
|
34
|
+
ConflictError,
|
|
35
|
+
InternalServerError,
|
|
36
|
+
NotFoundError,
|
|
37
|
+
OpenAIError,
|
|
38
|
+
PermissionDeniedError,
|
|
39
|
+
RateLimitError,
|
|
40
|
+
Stream,
|
|
41
|
+
UnprocessableEntityError,
|
|
42
|
+
)
|
|
43
|
+
from openai._types import NOT_GIVEN, NotGiven
|
|
44
|
+
|
|
45
|
+
from ._client import AsyncClient, AsyncCmdopLLM, Client, CmdopLLM
|
|
46
|
+
from ._version import __author__, __email__, __title__, __version__
|
|
47
|
+
from .resources import AsyncOCR, AsyncVision, OCR, Vision
|
|
48
|
+
from .types import OCRRequest, OCRResponse, VisionAnalyzeRequest, VisionAnalyzeResponse
|
|
49
|
+
|
|
50
|
+
__all__ = [
|
|
51
|
+
# Version info
|
|
52
|
+
"__version__",
|
|
53
|
+
"__title__",
|
|
54
|
+
"__author__",
|
|
55
|
+
"__email__",
|
|
56
|
+
# Main clients
|
|
57
|
+
"CmdopLLM",
|
|
58
|
+
"AsyncCmdopLLM",
|
|
59
|
+
"Client",
|
|
60
|
+
"AsyncClient",
|
|
61
|
+
# Custom resources
|
|
62
|
+
"Vision",
|
|
63
|
+
"AsyncVision",
|
|
64
|
+
"OCR",
|
|
65
|
+
"AsyncOCR",
|
|
66
|
+
# Custom types
|
|
67
|
+
"VisionAnalyzeRequest",
|
|
68
|
+
"VisionAnalyzeResponse",
|
|
69
|
+
"OCRRequest",
|
|
70
|
+
"OCRResponse",
|
|
71
|
+
# Re-exported from OpenAI
|
|
72
|
+
"OpenAIError",
|
|
73
|
+
"APIError",
|
|
74
|
+
"APIStatusError",
|
|
75
|
+
"APIConnectionError",
|
|
76
|
+
"APITimeoutError",
|
|
77
|
+
"AuthenticationError",
|
|
78
|
+
"BadRequestError",
|
|
79
|
+
"ConflictError",
|
|
80
|
+
"NotFoundError",
|
|
81
|
+
"PermissionDeniedError",
|
|
82
|
+
"RateLimitError",
|
|
83
|
+
"UnprocessableEntityError",
|
|
84
|
+
"InternalServerError",
|
|
85
|
+
"Stream",
|
|
86
|
+
"AsyncStream",
|
|
87
|
+
"NOT_GIVEN",
|
|
88
|
+
"NotGiven",
|
|
89
|
+
]
|