https://github.com/vlm-run/vlmrun-python-sdk
Official Python SDK for VLM Run
https://github.com/vlm-run/vlmrun-python-sdk
computer-vision genai llm ocr python vlm
Last synced: 5 months ago
JSON representation
Official Python SDK for VLM Run
- Host: GitHub
- URL: https://github.com/vlm-run/vlmrun-python-sdk
- Owner: vlm-run
- License: apache-2.0
- Created: 2024-12-18T20:50:46.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2026-01-17T00:11:14.000Z (6 months ago)
- Last Synced: 2026-01-17T12:50:06.274Z (6 months ago)
- Topics: computer-vision, genai, llm, ocr, python, vlm
- Language: Python
- Homepage: https://docs.vlm.run/sdk-reference/getting-started
- Size: 1.35 MB
- Stars: 12
- Watchers: 2
- Forks: 2
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
The [VLM Run Python SDK](https://pypi.org/project/vlmrun/) is the official Python SDK for [VLM Run API platform](https://docs.vlm.run), providing a convenient way to interact with our REST APIs.
## 🚀 Getting Started
### Installation
```bash
pip install vlmrun
```
### Installation with Optional Features
The package provides optional features that can be installed based on your needs:
- Chat with Orion via the CLI (see `vlmrun chat`)
```bash
pip install "vlmrun[cli]"
```
- Video processing features (numpy, opencv-python):
```bash
pip install "vlmrun[video]"
```
- Document processing features (pypdfium2):
```bash
pip install "vlmrun[doc]"
```
- OpenAI SDK integration (for chat completions API):
```bash
pip install "vlmrun[openai]"
```
- All optional features:
```bash
pip install "vlmrun[all]"
```
### Basic Usage
```python
from PIL import Image
from vlmrun.client import VLMRun
from vlmrun.common.utils import remote_image
# Initialize the client
client = VLMRun(api_key="")
# Process an image using local file or remote URL
image: Image.Image = remote_image("https://storage.googleapis.com/vlm-data-public-prod/hub/examples/document.invoice/invoice_1.jpg")
response = client.image.generate(
images=[image],
domain="document.invoice"
)
print(response)
# Or process an image directly from URL
response = client.image.generate(
urls=["https://storage.googleapis.com/vlm-data-public-prod/hub/examples/document.invoice/invoice_1.jpg"],
domain="document.invoice"
)
print(response)
```
### OpenAI-Compatible Chat Completions
The VLM Run SDK provides OpenAI-compatible chat completions through the agent endpoint. This allows you to use the familiar OpenAI API with VLM Run's powerful vision-language models.
```python
from vlmrun.client import VLMRun
client = VLMRun(
api_key="your-key",
base_url="https://agent.vlm.run/v1"
)
response = client.agent.completions.create(
model="vlmrun-orion-1",
messages=[
{"role": "user", "content": "Hello!"}
]
)
print(response.choices[0].message.content)
```
For async support:
```python
import asyncio
from vlmrun.client import VLMRun
client = VLMRun(api_key="your-key", base_url="https://agent.vlm.run/v1")
async def main():
response = await client.agent.async_completions.create(
model="vlmrun-orion-1",
messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)
asyncio.run(main())
```
**Installation**: Install with OpenAI support using `pip install vlmrun[openai]`
## 🔗 Quick Links
* 💬 Need help? Email us at [support@vlm.run](mailto:support@vlm.run) or join our [Discord](https://discord.gg/AMApC2UzVY)
* 📚 Check out our [Documentation](https://docs.vlm.run/)
* 📣 Follow us on [Twitter](https://x.com/vlmrun) and [LinkedIn](https://www.linkedin.com/company/vlm-run)