stnd.buildSTANDARD MANUAL2026-09-20

@stnd/ai

@stnd/ai

OpenRouter AI integration for the Standard Ecosystem.

ELI5

One small client, one API key, and you can call an LLM from Standard code without re-implementing provider plumbing each time.

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.

Notes / Observations

  • Package is currently paused; keep docs aligned with actual production usage before adding new surface.

What’s next — open

  • Decide: remove @stnd/ai? (OpenRouter, unused). priority: 3 token_scale: 3 created: 2026-07-14 area: framework