Skip to content

Technical guide · Overview

Page status: HistoricalHistory group: Updates

Worker local-first AI and diagnostic logging update

This update makes Cloudflare Workers try local AI first for article review/classification and summary translation when LOCAL_AI_URL + LOCAL_AI_API_KEY are configured. If local AI …

Visual overview

Primary diagram

System map

This update makes Cloudflare Workers try local AI first for article review/classification and summary translation when LOCAL_AI_URL + LOCAL_AI_API_KEY are configured. If local AI …

Render the repository-owned system map when you need it.

Diagram is not rendered yet.

View as text
Worker local-first AI and diagnostic logging update

This update makes Cloudflare Workers try local AI first for article review/classification and summary translation when LOCAL_AI_URL + LOCAL_AI_API_KEY are configured. If local AI …

flowchart TB
  accTitle: Worker local-first AI and diagnostic logging update
  accDescr {
    This update makes Cloudflare Workers try local AI first for article review/classification and summary translation when LOCAL_AI_URL + LOCAL_AI_API_KEY are configured. If local AI …
  }
  A["Worker local-first AI and diagnostic logging update"] --> B["updates/README_WORKER_LOCAL_FIRST_AI_AND_LOGGING_UPDATE.md"]
  B --> C["Auto-generated placeholder diagram"]

Worker local-first AI and diagnostic logging update

Fullscreen diagram view.

Worker local-first AI and diagnostic logging update

Section titled “Worker local-first AI and diagnostic logging update”

This update makes Cloudflare Workers try local AI first for article review/classification and summary translation when LOCAL_AI_URL + LOCAL_AI_API_KEY are configured. If local AI fails and OPENAI_API_KEY is available, the Worker falls back to OpenAI.

  • worker/src/index.ts
  • worker/src/logger.ts
  • worker/scripts/generate-wrangler-config.mjs
  • Article review now attempts local AI before OpenAI.
  • Summary translations continue to attempt local AI before OpenAI.
  • Fallback to OpenAI is enabled by default when an OpenAI key exists.
  • Worker response now includes provider diagnostics:
    • aiReviewProviderOrder
    • localAiConfigured
    • openAiFallbackEnabled
    • articleSummaryLocalTranslationCount
    • articleSummaryOpenAiTranslationCount
    • translationProviderOrder
  • Better Stack/console logs include local AI attempt, skipped local config, local request failures, and OpenAI fallback events.
  • Generated Wrangler config now carries HOLD_ARTICLES_FOR_TRANSLATIONS through to every shard.

Cloudflare Workers cannot call your Mac SSH tunnel or a private-only 127.0.0.1 home server address. For deployed Workers to use local AI first, LOCAL_AI_URL must be a secure public URL reachable from Cloudflare, such as a Cloudflare Tunnel URL, and LOCAL_AI_API_KEY must be available to Workers through Secrets Store.