stnd.buildSTANDARD MANUAL2026-07-15

@stnd/ai

@stnd/ai

OpenRouter AI integration for the Standard Ecosystem.

Overview

@stnd/ai provides a simple and unified interface for interacting with various Large Language Models (LLMs) via OpenRouter. It is designed to work seamlessly within Astro applications and Cloudflare Workers.

Key Features

  • Unified API: Access any model supported by OpenRouter with a consistent pattern.
  • Streaming Support: Built-in support for streaming responses for real-time interactions.
  • Prompt Templates: Utilities for managing and formatting complex prompts.
  • Edge-Ready: Optimized for deployment on Cloudflare Pages and Workers.

Usage

import { AI } from "@stnd/ai";

const ai = new AI({
  apiKey: process.env.OPENROUTER_API_KEY,
  model: "google/gemini-2.0-flash-001"
});

const response = await ai.chat([
  { role: "user", content: "Explain the golden ratio in typography." }
]);

console.log(response.text);

Configuration

The package can be configured globally via the @stnd/core integration or per-instance.

  • apiKey: Your OpenRouter API key.
  • model: The default model to use.
  • baseURL: (Optional) Custom base URL for OpenRouter API.

What’s next — open

  • [ ] Decide: remove @stnd/ai? (OpenRouter, unused).