llm-digitalocean


Namellm-digitalocean JSON
Version 0.1.0 PyPI version JSON
download
home_pageNone
SummaryLLM plugin for models hosted by DigitalOcean AI
upload_time2025-07-15 19:43:10
maintainerNone
docs_urlNone
authorRajashekar Chintalapti
requires_python>=3.9
licenseNone
keywords llm ai digitalocean language-models plugin
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # llm-digitalocean

[![PyPI](https://img.shields.io/pypi/v/llm-digitalocean.svg)](https://pypi.org/project/llm-digitalocean/)
[![Changelog](https://img.shields.io/github/v/release/rajashekar/llm-digitalocean?include_prereleases&label=changelog)](https://github.com/rajashekar/llm-digitalocean/releases)
[![Tests](https://github.com/rajashekar/llm-digitalocean/workflows/Test/badge.svg)](https://github.com/rajashekar/llm-digitalocean/actions?query=workflow%3ATest)
[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/rajashekar/llm-digitalocean/blob/main/LICENSE)

[LLM](https://llm.datasette.io/) plugin for models hosted by [DigitalOcean AI](https://www.digitalocean.com/products/ai)

## Installation

First, [install the LLM command-line utility](https://llm.datasette.io/en/stable/setup.html).

Now install this plugin in the same environment as LLM:
```bash
llm install llm-digitalocean
```

## Configuration

You will need an API key from DigitalOcean. You can obtain one from the [DigitalOcean Control Panel](https://cloud.digitalocean.com/account/api/tokens).

You can set that as an environment variable called `DIGITAL_OCEAN`, or add it to the `llm` set of saved keys using:

```bash
llm keys set digitalocean
```
```
Enter key: <paste key here>
```

## Usage

To list available models, run:
```bash
llm models list
```
You should see a list that looks something like this:
```
DigitalOcean: digitalocean/meta-llama/Meta-Llama-3.1-405B-Instruct
DigitalOcean: digitalocean/meta-llama/Meta-Llama-3.1-70B-Instruct
DigitalOcean: digitalocean/meta-llama/Meta-Llama-3.1-8B-Instruct
...
```

To run a prompt against a model, pass its full model ID to the `-m` option, like this:
```bash
llm -m digitalocean/meta-llama/Meta-Llama-3.1-70B-Instruct "Five creative names for a pet robot"
```

You can set a shorter alias for a model using the `llm aliases` command like so:
```bash
llm aliases set llama3.1 digitalocean/meta-llama/Meta-Llama-3.1-70B-Instruct
```
Now you can prompt the model using:
```bash
cat llm_digitalocean.py | llm -m llama3.1 -s 'write some pytest tests for this'
```

### Vision models

Some DigitalOcean models can accept image attachments. Run this command:

```bash
llm models --options -q digitalocean
```
And look for models that list these attachment types:

```
  Attachment types:
    image/gif, image/jpeg, image/png, image/webp
```

You can feed these models images as URLs or file paths, for example:

```bash
curl https://static.simonwillison.net/static/2024/pelicans.jpg | llm \
    -m digitalocean/gpt-4o 'describe this image' -a -
```

### Listing models

The `llm models -q digitalocean` command will display all available models, or you can use this command to see more detailed information:

```bash
llm digitalocean models
```
Output starts like this:
```yaml
- id: meta-llama/Meta-Llama-3.1-405B-Instruct
  name: model
  created: 2024-07-15 12:00:00
  owned_by: meta-llama
  supports_schema: False
  supports_vision: False

- id: meta-llama/Meta-Llama-3.1-70B-Instruct
  name: model
  created: 2024-07-15 12:00:00
  owned_by: meta-llama
  supports_schema: False
  supports_vision: False
```

Add `--json` to get back JSON instead:
```bash
llm digitalocean models --json
```

### Plugin Commands

The plugin provides several commands under the `llm digitalocean` namespace:

#### Refresh Cache
```bash
llm digitalocean refresh
```
Refreshes the cached model information. The plugin automatically caches model data for 1 hour to improve performance and reduce API calls.

#### Cache Information
```bash
llm digitalocean cache-info
```
Shows information about the current cache, including file location, age, and number of cached models.

## Features

### Automatic Caching
The plugin automatically caches model information in your LLM user directory to improve performance and reduce API calls. The cache is valid for 1 hour and can be manually refreshed using the `refresh` command.

### Streaming Support
The plugin supports both streaming and non-streaming responses from DigitalOcean AI models.

### Vision Model Support
The plugin automatically detects and enables vision capabilities for models that support image inputs.

### Error Handling
Comprehensive error handling for:
- Missing API keys
- Network connectivity issues
- API rate limits and errors
- Invalid model names
- Malformed responses

## API Endpoint

This plugin uses the DigitalOcean AI inference API:
- Base URL: `https://inference.do-ai.run/v1/`
- Models endpoint: `GET /models`
- Chat completions: `POST /chat/completions`

## Cache Location

Model information is cached in your LLM user directory:
- macOS: `~/Library/Application Support/io.datasette.llm/digitalocean_models.json`
- Linux: `~/.config/io.datasette.llm/digitalocean_models.json`
- Windows: `%APPDATA%\io.datasette.llm\digitalocean_models.json`

## Development

To set up this plugin locally, first checkout the code. Then create a new virtual environment:
```bash
cd llm-digitalocean
python3 -m venv venv
source venv/bin/activate
```
Now install the dependencies and test dependencies:
```bash
llm install -e '.[test]'
```
To run the tests:
```bash
pytest
```

## Example Usage

```bash
# List all available models
llm digitalocean models

# Use a specific model
llm -m digitalocean/meta-llama/Meta-Llama-3.1-70B-Instruct "Explain quantum computing"

# Set up an alias for easier use
llm aliases set llama digitalocean/meta-llama/Meta-Llama-3.1-70B-Instruct
llm -m llama "What is machine learning?"

# Check cache status
llm digitalocean cache-info

# Refresh the model cache
llm digitalocean refresh

# Use with image input (if model supports vision)
llm -m digitalocean/gpt-4o "What's in this image?" -a image.jpg
```

## License

Apache License 2.0

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "llm-digitalocean",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "llm, ai, digitalocean, language-models, plugin",
    "author": "Rajashekar Chintalapti",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/cf/86/c8e77b6bff973c280c3c3ff53454c673c4fc26eec982a6ec8afb93267f35/llm_digitalocean-0.1.0.tar.gz",
    "platform": null,
    "description": "# llm-digitalocean\n\n[![PyPI](https://img.shields.io/pypi/v/llm-digitalocean.svg)](https://pypi.org/project/llm-digitalocean/)\n[![Changelog](https://img.shields.io/github/v/release/rajashekar/llm-digitalocean?include_prereleases&label=changelog)](https://github.com/rajashekar/llm-digitalocean/releases)\n[![Tests](https://github.com/rajashekar/llm-digitalocean/workflows/Test/badge.svg)](https://github.com/rajashekar/llm-digitalocean/actions?query=workflow%3ATest)\n[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/rajashekar/llm-digitalocean/blob/main/LICENSE)\n\n[LLM](https://llm.datasette.io/) plugin for models hosted by [DigitalOcean AI](https://www.digitalocean.com/products/ai)\n\n## Installation\n\nFirst, [install the LLM command-line utility](https://llm.datasette.io/en/stable/setup.html).\n\nNow install this plugin in the same environment as LLM:\n```bash\nllm install llm-digitalocean\n```\n\n## Configuration\n\nYou will need an API key from DigitalOcean. You can obtain one from the [DigitalOcean Control Panel](https://cloud.digitalocean.com/account/api/tokens).\n\nYou can set that as an environment variable called `DIGITAL_OCEAN`, or add it to the `llm` set of saved keys using:\n\n```bash\nllm keys set digitalocean\n```\n```\nEnter key: <paste key here>\n```\n\n## Usage\n\nTo list available models, run:\n```bash\nllm models list\n```\nYou should see a list that looks something like this:\n```\nDigitalOcean: digitalocean/meta-llama/Meta-Llama-3.1-405B-Instruct\nDigitalOcean: digitalocean/meta-llama/Meta-Llama-3.1-70B-Instruct\nDigitalOcean: digitalocean/meta-llama/Meta-Llama-3.1-8B-Instruct\n...\n```\n\nTo run a prompt against a model, pass its full model ID to the `-m` option, like this:\n```bash\nllm -m digitalocean/meta-llama/Meta-Llama-3.1-70B-Instruct \"Five creative names for a pet robot\"\n```\n\nYou can set a shorter alias for a model using the `llm aliases` command like so:\n```bash\nllm aliases set llama3.1 digitalocean/meta-llama/Meta-Llama-3.1-70B-Instruct\n```\nNow you can prompt the model using:\n```bash\ncat llm_digitalocean.py | llm -m llama3.1 -s 'write some pytest tests for this'\n```\n\n### Vision models\n\nSome DigitalOcean models can accept image attachments. Run this command:\n\n```bash\nllm models --options -q digitalocean\n```\nAnd look for models that list these attachment types:\n\n```\n  Attachment types:\n    image/gif, image/jpeg, image/png, image/webp\n```\n\nYou can feed these models images as URLs or file paths, for example:\n\n```bash\ncurl https://static.simonwillison.net/static/2024/pelicans.jpg | llm \\\n    -m digitalocean/gpt-4o 'describe this image' -a -\n```\n\n### Listing models\n\nThe `llm models -q digitalocean` command will display all available models, or you can use this command to see more detailed information:\n\n```bash\nllm digitalocean models\n```\nOutput starts like this:\n```yaml\n- id: meta-llama/Meta-Llama-3.1-405B-Instruct\n  name: model\n  created: 2024-07-15 12:00:00\n  owned_by: meta-llama\n  supports_schema: False\n  supports_vision: False\n\n- id: meta-llama/Meta-Llama-3.1-70B-Instruct\n  name: model\n  created: 2024-07-15 12:00:00\n  owned_by: meta-llama\n  supports_schema: False\n  supports_vision: False\n```\n\nAdd `--json` to get back JSON instead:\n```bash\nllm digitalocean models --json\n```\n\n### Plugin Commands\n\nThe plugin provides several commands under the `llm digitalocean` namespace:\n\n#### Refresh Cache\n```bash\nllm digitalocean refresh\n```\nRefreshes the cached model information. The plugin automatically caches model data for 1 hour to improve performance and reduce API calls.\n\n#### Cache Information\n```bash\nllm digitalocean cache-info\n```\nShows information about the current cache, including file location, age, and number of cached models.\n\n## Features\n\n### Automatic Caching\nThe plugin automatically caches model information in your LLM user directory to improve performance and reduce API calls. The cache is valid for 1 hour and can be manually refreshed using the `refresh` command.\n\n### Streaming Support\nThe plugin supports both streaming and non-streaming responses from DigitalOcean AI models.\n\n### Vision Model Support\nThe plugin automatically detects and enables vision capabilities for models that support image inputs.\n\n### Error Handling\nComprehensive error handling for:\n- Missing API keys\n- Network connectivity issues\n- API rate limits and errors\n- Invalid model names\n- Malformed responses\n\n## API Endpoint\n\nThis plugin uses the DigitalOcean AI inference API:\n- Base URL: `https://inference.do-ai.run/v1/`\n- Models endpoint: `GET /models`\n- Chat completions: `POST /chat/completions`\n\n## Cache Location\n\nModel information is cached in your LLM user directory:\n- macOS: `~/Library/Application Support/io.datasette.llm/digitalocean_models.json`\n- Linux: `~/.config/io.datasette.llm/digitalocean_models.json`\n- Windows: `%APPDATA%\\io.datasette.llm\\digitalocean_models.json`\n\n## Development\n\nTo set up this plugin locally, first checkout the code. Then create a new virtual environment:\n```bash\ncd llm-digitalocean\npython3 -m venv venv\nsource venv/bin/activate\n```\nNow install the dependencies and test dependencies:\n```bash\nllm install -e '.[test]'\n```\nTo run the tests:\n```bash\npytest\n```\n\n## Example Usage\n\n```bash\n# List all available models\nllm digitalocean models\n\n# Use a specific model\nllm -m digitalocean/meta-llama/Meta-Llama-3.1-70B-Instruct \"Explain quantum computing\"\n\n# Set up an alias for easier use\nllm aliases set llama digitalocean/meta-llama/Meta-Llama-3.1-70B-Instruct\nllm -m llama \"What is machine learning?\"\n\n# Check cache status\nllm digitalocean cache-info\n\n# Refresh the model cache\nllm digitalocean refresh\n\n# Use with image input (if model supports vision)\nllm -m digitalocean/gpt-4o \"What's in this image?\" -a image.jpg\n```\n\n## License\n\nApache License 2.0\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "LLM plugin for models hosted by DigitalOcean AI",
    "version": "0.1.0",
    "project_urls": {
        "CI": "https://github.com/rajashekar/llm-digitalocean/actions",
        "Changelog": "https://github.com/rajashekar/llm-digitalocean/releases",
        "Homepage": "https://github.com/rajashekar/llm-digitalocean",
        "Issues": "https://github.com/rajashekar/llm-digitalocean/issues"
    },
    "split_keywords": [
        "llm",
        " ai",
        " digitalocean",
        " language-models",
        " plugin"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "cb4a59c764e627fb982a7f284442ee26b8154fd8836fad4809414260804907f5",
                "md5": "ed37a2598f9058092209588424c0f9b4",
                "sha256": "f9dca1eef1b55ea2e1c3c6b980cf7355f2f3434be95ebe6d4989492b4ccf00fc"
            },
            "downloads": -1,
            "filename": "llm_digitalocean-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "ed37a2598f9058092209588424c0f9b4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 6551,
            "upload_time": "2025-07-15T19:43:09",
            "upload_time_iso_8601": "2025-07-15T19:43:09.622058Z",
            "url": "https://files.pythonhosted.org/packages/cb/4a/59c764e627fb982a7f284442ee26b8154fd8836fad4809414260804907f5/llm_digitalocean-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "cf86c8e77b6bff973c280c3c3ff53454c673c4fc26eec982a6ec8afb93267f35",
                "md5": "a976d8b41981d7fac75202fb02828b8a",
                "sha256": "de891fbc1935f0839c9a05c3b12e0660d84b7983751de883b93bd92a8cf257ed"
            },
            "downloads": -1,
            "filename": "llm_digitalocean-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "a976d8b41981d7fac75202fb02828b8a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 8011,
            "upload_time": "2025-07-15T19:43:10",
            "upload_time_iso_8601": "2025-07-15T19:43:10.943397Z",
            "url": "https://files.pythonhosted.org/packages/cf/86/c8e77b6bff973c280c3c3ff53454c673c4fc26eec982a6ec8afb93267f35/llm_digitalocean-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-15 19:43:10",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "rajashekar",
    "github_project": "llm-digitalocean",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "llm-digitalocean"
}
        
Elapsed time: 1.71615s