$0+

Proof-of-Concept: Blender AI Assistance - LM Studio/Ollama/OpenAI Compatible.

1 rating
I want this!

Proof-of-Concept: Blender AI Assistance - LM Studio/Ollama/OpenAI Compatible.

$0+
1 rating
Blender AI Code Assistant

A proof-of-concept Blender addon that demonstrates integration with OpenAI-compatible API endpoints for AI-powered code completion in the Blender Text Editor.


Overview

This addon serves as a demonstration of how to integrate AI language models with Blender's Python scripting environment. It allows users to get AI-powered code completions directly within Blender's Text Editor, making Python scripting more accessible and efficient.

Features

- AI-powered code completion in Blender's Text Editor
- Compatible with any OpenAI-compatible API endpoint (local or remote)
- Customizable system prompt to tailor the AI's behavior
- Adjustable parameters (temperature, max tokens, context lines)
- Keyboard shortcut (Ctrl+Space) for quick access
- Handles Markdown code blocks automatically
- Threaded API requests to keep Blender responsive

Requirements

- Blender 4.1.0 or newer
- Access to an OpenAI-compatible API endpoint:
  - Local models via [llama.cpp](https://github.com/ggerganov/llama.cpp), [text-generation-webui](https://github.com/oobabooga/text-generation-webui), etc.
  - Commercial API services like OpenAI, Anthropic, etc.

Installation

1. Download the addon (ZIP file or clone the repository)
2. In Blender, go to Edit > Preferences > Add-ons > Install
3. Select the downloaded ZIP file or the `__init__.py` file
4. Enable the addon by checking the box next to "Development: AI Code Assistant"

Configuration

1. Go to Edit > Preferences > Add-ons
2. Find and expand "Development: AI Code Assistant"
3. Configure the following settings:
   - API Endpoint: URL of your OpenAI-compatible API (e.g., `http://localhost:1234/v1/chat/completions`)
   - API Key: If your endpoint requires authentication
   - Max Tokens: Maximum length of completions
   - Temperature: Controls randomness (0-100, higher = more creative)
   - Context Lines: Number of lines before cursor to use as context
   - System Prompt: Customize the AI's behavior and instructions

Usage

1. Open the Text Editor in Blender
2. Create a new text file or open an existing Python script
3. Position your cursor where you want the completion to be inserted
4. Press Ctrl+Space or click the "Get Completion" button in the AI Assistant panel
5. Wait for the completion to be generated and inserted

Examples

The addon works well with various AI models, including:
- Microsoft's Phi-4
- Llama 3
- Mistral
- GPT models

Example use cases:
- Completing Blender Python API code
- Generating boilerplate code
- Fixing syntax errors
- Learning the Blender API through examples

Extending the Addon

This addon is designed as a starting point for more specialized AI integrations with Blender. Possible extensions include:

- Adding support for different types of AI assistance (not just code completion)
- Creating specialized modes for different Blender workflows (modeling, animation, etc.)
- Implementing more advanced context gathering for better completions
- Adding a chat interface for conversational assistance
- Creating a "Run" button to execute generated code
- Supporting other areas of Blender beyond the Text Editor

License

This project is licensed under the GNU General Public License v2 or later.

Acknowledgments

- Developed by Lee Shaw
- Inspired by the potential of AI to enhance creative workflows in Blender
- Thanks to the Blender Foundation for the amazing Blender software
$
I want this!

You'll get the proof-of-concept Python code necessary to integrate an LLM into the scripting tab of Blender to assist you with code completion.

Open-source
Take the code and build whatever you like!
OpenAI Compatible endpoints.
Connect to any locally running or OpenAI compatible endpoint! (API key required for online services)
Size
4.21 KB
Copy product URL
30-day money back guarantee

Ratings

5
(1 rating)
5 stars
100%
4 stars
0%
3 stars
0%
2 stars
0%
1 star
0%