neoAI connects VisualNEO Win publications to the OpenRouter API. It provides chat, vision, structured output, in-memory conversations, image and video generation, model discovery, embeddings, media downloads, and non-blocking callbacks.
Requirements
- VisualNEO Win with Modern Plugin API v1 support.
- Windows 32-bit or 64-bit. The plugin module itself is Win32 x86.
- Internet access and an OpenRouter API key for authenticated requests.
- Sufficient OpenRouter credit for the selected model and operation.
Model availability, capabilities, prices, and accepted parameters change over time. Use the catalog actions instead of assuming that a model supports chat, vision, images, video, or embeddings.
Installation
- Install
com.visualneo.neoai.vnpluginfrom VisualNEO Win. - Restart VisualNEO Win if an older neoAI version is already loaded.
- Configure an API key before making an authenticated request.
Never distribute a plain API key inside a .pub file. Prefer an environment variable during development or a Windows DPAPI file for a deployed application.
Quick Start
. Configure the API key for this process.
neoAISetApiKey "[ApiKey]" "https://example.com" "My VisualNEO App"
. Send one chat request.
neoAIChat "openrouter/auto" "[UserPrompt]" "You are concise." "0.7" "0" "[AIResponse]" "[AIReasoning]" "[AIUsage]"
The model ID above is only an example. Call neoAIGetModels to obtain the current catalog.
Configuration and Key Protection
| Action | Purpose |
|---|---|
neoAISetApiKey | Sets a plain API key in process memory and optional OpenRouter attribution headers. |
neoAISetEncryptedApiKey | Decrypts a password-encrypted Base64 value into process memory. |
neoAIEncryptKey | Creates the Base64 value consumed by neoAISetEncryptedApiKey. |
neoAISaveKeySecure | Protects a key with Windows DPAPI and writes it to a file. |
neoAILoadKeySecure | Loads a DPAPI file, configures the key, and optionally returns it. |
neoAISetApiKeyFromEnv | Reads a key from an environment variable; the default is OPENROUTER_API_KEY. |
neoAISetBaseUrl | Changes the OpenAI-compatible base URL or proxy endpoint. |
neoAISetTimeout | Sets connection, response, and synchronous video polling limits in seconds. |
DPAPI binds protected data to the current Windows user account. The password-based helper is portable obfuscation and does not authenticate ciphertext; it is less suitable than DPAPI or an external secret store for production secrets.
Chat and Vision
| Action | Purpose |
|---|---|
neoAIChat | Sends a text prompt and returns assistant text, optional reasoning, and usage JSON. |
neoAIChatAdvanced | Sends a complete JSON payload to /chat/completions. |
neoAIChatVision | Sends a local image, data URL, or web image URL to a vision-capable model. |
neoAIChatStructured | Requests a JSON object or a strict JSON Schema result from a compatible model. |
neoAIChatVision accepts PNG, JPEG, WebP, and GIF files. A local file is encoded as a data URL before transmission. Support for each image type and structured output depends on the selected model and provider.
{
"model": "openrouter/auto",
"messages": [
{ "role": "user", "content": "Summarize this text." }
],
"temperature": 0.2
}
Conversational Sessions
| Action | Purpose |
|---|---|
neoAISessionCreate | Creates or resets a named in-memory conversation with an optional system prompt. |
neoAISessionSend | Adds a user message, sends the stored history, and stores the assistant response. |
neoAISessionGetHistory | Returns the session messages as JSON. |
neoAISessionClear | Deletes a named session. |
neoAISessionSendAsync | Sends a session message in the background and invokes a subroutine. |
Sessions exist only while the plugin remains loaded. They are not written to disk. Each session retains at most 100 messages to prevent unbounded memory growth.
Images and Media
| Action | Purpose |
|---|---|
neoAIGenerateImage | Generates an image and optionally saves it to a local file. |
neoAIGenerateImageAsync | Performs image generation on a worker thread and invokes a subroutine. |
neoAIGenerateVideo | Submits a video job, polls until completion or timeout, and optionally downloads it. |
neoAISubmitVideo | Submits a video job immediately and returns its job ID and status JSON. |
neoAIGetVideoStatus | Polls a submitted job and returns completion, URL, and full status JSON. |
neoAIDownloadMedia | Saves an HTTP(S) URL or Base64 data URL to disk. |
Image output can be raster data or SVG, depending on the model. The returned URL may therefore be a large data: URL. When a destination path is supplied, neoAI decodes the payload directly to that file.
Video generation is asynchronous at the service level. Prefer this responsive pattern:
. Start the billable job without waiting.
neoAISubmitVideo "google/veo-3.1" "A sunrise over a quiet lake" "{`"duration`":8,`"aspect_ratio`":`"16:9`"}" "[VideoJobId]" "[VideoStatusJson]"
. Call this later from a timer or button until [VideoComplete] is True.
neoAIGetVideoStatus "[VideoJobId]" "[VideoComplete]" "[VideoUrl]" "[VideoStatusJson]"
. Download only after completion.
neoAIDownloadMedia "[VideoUrl]" "[PubDir]generated-video.mp4" "[DownloadSuccess]"
Submitting image or video generation can spend account credit. Validate the model and options before calling the action.
Models, Account, and Usage
| Action | Purpose |
|---|---|
neoAIGetAccountInfo | Returns key limits and usage information as JSON. |
neoAIGetModels | Returns the general model catalog, optionally filtered by provider text. |
neoAIGetImageModels | Returns image-generation models and capability descriptors. |
neoAIGetVideoModels | Returns video-generation models and capability descriptors. |
neoAIGetEmbeddingModels | Returns embedding models and metadata. |
neoAIGetGenerationStats | Returns cost and token statistics for a generation ID. |
Catalog output is raw JSON so it can be processed with VisualNEO JSON actions. An empty provider filter in neoAIGetModels returns the complete general catalog.
Embeddings
neoAIEmbeddings converts text into a numerical vector and returns the complete API response as JSON. Embeddings are useful for semantic search, clustering, recommendations, and retrieval-augmented generation. Store and compare vectors outside the plugin; neoAI does not include a vector database.
Asynchronous Actions
| Action | Purpose |
|---|---|
neoAIChatAsync | Runs one chat request in the background and invokes a NeoScript subroutine. Its optional final parameter limits output tokens; use 0 for the model default. |
neoAISessionSendAsync | Runs a session request in the background and invokes a subroutine. |
neoAIGenerateImageAsync | Generates an image in the background and invokes a subroutine. |
neoAIIsBusy | Returns True while a background request is active. |
neoAICancel | Requests cooperative cancellation of the active background operation. |
Only one neoAI background action runs at a time. Results are marshalled to the VisualNEO UI thread through a private Win32 message window. Cancellation suppresses the callback and stops video polling, but an HTTP request already being processed by Windows cannot always be interrupted immediately.
. Start the request; this action returns immediately.
neoAIChatAsync "openrouter/auto" "[Question]" "OnAIResponse" "[AIResponse]" "[AIUsage]" "[AIStarted]" "0"
Return
:OnAIResponse
. The plugin has already updated [AIResponse] and [AIUsage].
SetVar "[StatusText]" "Complete"
Return
Error Handling
- Simple chat, vision, image, and video actions place HTTP error details in their normal output variable.
- Raw JSON actions return the service response, including its
errorobject when present. neoAIGetVideoStatusreturnsFalseuntil the job reportscompleted; inspect the status JSON to distinguish pending and failed jobs.- Confirm required variables and paths before making a request.
- Use
neoAISetTimeoutfor slow providers and high-resolution media jobs.
Included Examples
| Publication | Demonstrates |
|---|---|
01-Hello-AI-QuickStart.pub | API-key setup and basic chat. |
02-Multi-Provider-Assistant.pub | Model, system prompt, and temperature parameters. |
03-Async-Chatbot-Callback.pub | A non-blocking request and callback subroutine. |
04-Vision-Image-Analysis.pub | Local and remote image analysis. |
05-Image-and-Media-Generator.pub | Image generation and local saving. |
06-Semantic-Search-Embeddings.pub | Embedding response generation. |
neoAI-demo.pub | Compact action overview. |
Privacy and Deployment
Prompts, images, and generated content are transmitted to OpenRouter and the selected upstream provider. Review their current privacy, retention, and pricing policies before processing confidential data. neoAI does not log requests itself, but output variables and publication logic may retain returned content.
For deployment, use a restricted key where possible, avoid exposing it through visible variables, and do not treat client-side encryption as a substitute for a server-side secret boundary.