🧠 300+ Models: A massive library of AI capabilities for any task.

OpenRouterAI Extension for MIT App Inventor


Descreption


:rocket: AI Gateway: 300+ Models for App Inventor (OpenRouter Edition)

Supercharge your MIT App Inventor projects by unlocking a universe of 300+ cutting-edge AI models through the OpenRouter platform! This powerful extension suite acts as your direct gateway, bringing diverse AI functionalities to your apps with easy-to-use blocks. Choose between our feature-rich Pro (Paid) version or get started instantly with the Free Basic version.


Overview of Versions

_- visual selection

Overview of Versions

  • OpenRouterAI - Pro Version (Paid Upgrade - Conceptual):
    The ultimate solution for developers seeking the full spectrum of AI capabilities. The Pro Version would unlock real-time streaming, access to all OpenRouter models (including premium/paid ones), fine-grained control over AI generation parameters, advanced processing and analysis of existing images and PDF documents (multimodal capabilities) , web search integration, and more. This version would require a separate license purchase.

  • OpenRouterAI - Free Basic Version (Available Now):
    A great starting point to explore AI in App Inventor. This version provides core functionality for non-streaming AI chat completions using default generation settings. It allows model selection, with the explicit understanding that users can primarily expect to successfully use models designated as "free" by OpenRouter with their API key.


Pro Version (Paid) - Features & Capabilities

Blocks





Features

  • Continuous Chat (Free and pro)

To have a continuous conversation where the AI remembers previous parts of the chat, your App Inventor application needs to manage the conversation history. The RequestChatCompletion block accepts a messages list. For each new turn in the conversation, you must send the entire history up to that point.

Blcoks

  • Real-Time Streaming Responses:

  • Receive AI-generated text in chunks as it's created, enabling dynamic and interactive user experiences.

  • Events: StreamChunkReceived (partialText), StreamCompleted, StreamProcessingError.

    StreamChunkReceived_Event

  • Full Model Access & Advanced Selection:

  • Access to the entire catalog of models available on OpenRouter, including the latest and most powerful premium models.

    • Potential for advanced filtering and selection of models based on capabilities or cost.
  • Customizable AI Generation Parameters:

  • Fine-tune AI responses with full control over parameters such as:

    • MaxTokens (response length)

    • Temperature (creativity/randomness)

    • TopP & TopK (nucleus and top-k sampling)

    • Seed (for reproducible outputs)

    • StopSequences (custom stopping points for generation)

    • FrequencyPenalty & PresencePenalty

  • Advanced File Processing (Multimodal):

  • Send PDF documents or images to AI models for analysis, summarization, question-answering, and other multimodal tasks.

    1. mistral-ocr: Best for scanned documents or PDFs with images ($2 per 1,000 pages).

    2. pdf-text: Best for well-structured PDFs with clear text content (Free).

    3. native: Only available for models that support file input natively (charged as input tokens).

  • Web Search Integration:

    • Allow models to access real-time information from the internet to provide more up-to-date and comprehensive answers.

    • Specific blocks or parameters to enable and control web search.

  • Structured JSON Output:

    • Instruct models to return responses in a specific JSON format, making it easier to parse and integrate structured data into your app.

    • Parameters to define JSON schemas.

  • You can use Google AI Studio to customize your JSON


Video preview


:credit_card: Get Pro Now! :credit_card:

  1. Pay Securely with PayPal:
    Click the button or link to purchase your Pro license.
    :star2: Pay here :star2:

  2. Instant Download Access:
    :white_check_mark: After successful payment, you'll be automatically redirected to the download page for the Pro extension (aix + aia files).


Free Basic Version - Features & Capabilities

Author: Mr.koder
Current Free Version: 1.0.4-free-basic

This version offers a solid entry point for using OpenRouter AI.

  • Basic AI Chat: Send messages to AI models and get text responses (non-streaming only).

  • Model Selection Utilities:

    • GetAllModelDisplayNames: Get a list of human-readable model names (from a predefined set).

    • GetAllModelIdentifiers: Get a list of corresponding API model IDs.

    • GetModelEnumFromIndex: Easily select a model for chat using its list index.

  • API Key Information: GetKeyInformation to check your OpenRouter API key's usage and limits.

  • Simple Error Events: Receive clear feedback if an API call or extension operation fails.

  • Fixed AI Settings: Uses standard default settings for AI generation (like creativity, response length) for ease of use. Customization of these settings is a Pro feature.

Setup (Free)

  1. Get OpenRouter API Key: Sign up at OpenRouter.ai and create an API key.

  2. Download Extension: Obtain the :arrow_down: OpenRouterAI_FreeBasic.aix (31.5 KB) file.or you can download the :arrow_down: open_router_free.aia (37.4 KB) file

  3. Import to App Inventor:

  • In your App Inventor project, go to Extensions (in the Palette) -> Import extension.

  • Choose the OpenRouter.aix file and click "Import."

  1. Add to Project: Drag the OpenRouterAI component from the "Extension" section onto your app Screen. It's a non-visible component.
  • messages list structure: Each item in the list must be a dictionary with:

  • When ChatCompletionReceived (..., messageContent, ...): AI response is ready!

    • Key output: messageContent (text) - the AI's reply.
  • When KeyInformationReceived (...): API key details received.

  • When ChatCompletionError (errorMessage, apiErrorCode, ...): Problem during AI chat.

  • When KeyInformationError (errorMessage, httpStatusCode, ...): Problem getting key info.

  • When ErrorOccurred (errorMessage, functionName): General error in the extension.

Example (Free) - :arrow_down: open_router_free.aia (36.2 KB)


Error Handling (Applies to Both Versions)

  • The extension provides clear error events (ChatCompletionError, KeyInformationError, ErrorOccurred).

  • These events give you:

    • errorMessage: User-friendly message.

    • apiErrorCode: Code from OpenRouter API (e.g., 401 for bad key).

    • httpStatusCode: Standard web error code.

    • rawErrorResponse: Full JSON error from server (for debugging).

  • Always handle these error events in your app! Check OpenRouter's API docs for specific error code meanings.


:sparkles: OpenRouterAI: Free vs. Pro :sparkles:

Feature :green_circle: Free Basic Version :star: Pro Version (Paid Upgrade)
Core AI Chat (Non-Streaming) :white_check_mark: :white_check_mark:
API Key Usage :white_check_mark: :white_check_mark:
Model Selection Utilities :white_check_mark: :white_check_mark:
API Key Information Retrieval :white_check_mark: :white_check_mark:
Basic Error Handling :white_check_mark: :white_check_mark:
--- --- ---
Access to FREE Models on OpenRouter :white_check_mark: :white_check_mark:
Access to ALL Models on OpenRouter :x: :white_check_mark:
Real-Time Streaming Responses :x: :white_check_mark:
Customizable AI Settings :x: :white_check_mark:
(Temperature, Max Tokens, TopP, Seed, etc.)
Analyze Existing Images & PDFs :x: :white_check_mark:
(Multimodal Capabilities)
Web Search Integration :x: :white_check_mark:
Structured JSON Output :x: :white_check_mark:
--- --- ---
License Cost for Extension Free Paid License
Support Level Community Standard

FAQ (General)

Q: Do I need an OpenRouter account?

A: Yes. An OpenRouter API key is required for both Free Basic and any potential Pro version.

Q: What are the costs involved?

A: The Free Basic Version of this extension is free. Using AI models via OpenRouter may incur costs based on the model and your OpenRouter account plan. The Pro Version of the extension would have its own license fee, separate from OpenRouter API costs. Always check OpenRouter's pricing for their services.

Q: How do I select an AI model with the Free Basic version?

A: 1. Use GetAllModelDisplayNames to show models in a ListView. 2. Get the SelectionIndex when the user picks. 3. Pass this index to GetModelEnumFromIndex. 4. Use the output in the model slot of RequestChatCompletion.

Q: Where is the OpenRouter API documentation?

A: https://openrouter.ai/docs


Support

  • For this Extension (Free Basic or Pro inquiries):

Quick Guide: OpenRouter Platform Costs & Free Access

(This applies to using any version of this extension with OpenRouter)

  • Pay-As-You-Go: OpenRouter uses credits you buy (no subscription). Paid models use these credits based on token usage.

  • Free Models Available: OpenRouter offers several models at no credit cost (often marked with :free).

  • OpenRouter's Limits on Free Models:

    • Daily Limit: Typically 50 requests/day. Increases to 1,000/day if you've bought $10+ credits on OpenRouter.

    • Rate Limit: Usually 20 requests/minute.

  • Negative Balance = No Access: If your OpenRouter credit is negative, even free models might be blocked until you add funds.

  • Your Extension vs. OpenRouter:

    • Free Extension: Best with OpenRouter's free models (respecting their limits).

    • Pro Extension (Conceptual): Lets you call any model; using paid models deducts from your OpenRouter credits.

Always check OpenRouter.ai for current pricing, free models, and exact limits.

:credit_card: Get Pro Now! :credit_card:

  1. Pay Securely with PayPal:
    Click the button or link to purchase your Pro license.
    :star2: Pay here :star2:

  2. Instant Download Access:
    :white_check_mark: After successful payment, you'll be automatically redirected to the download page for the Pro extension (aix + aia files).

See also


Happy Inventing!

1 Like