跳到正文
Skillpedia
API 与服务器(后端)48k · #5281

neon-ai-gateway

它能做什么

Neon AI Gateway 让你通过一个连接和一个密钥,使用多种 AI 模型(比如 OpenAI、Google 和 Meta 提供的模型)。它会把这些工具直接集成到你的 Neon 项目中,让访问更简单。

适用场景

  • ✓当你想使用不同的 AI 模型,但不想为每个模型单独注册账号时。
  • ✓当你想在代码中切换 AI 模型,而不必重写大量代码时。
  • ✓当你想把 AI 调用隔离在项目中特定的测试或开发环境里时。

技能链接

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/neon-ai-gateway/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/neon-ai-gateway/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“我该如何配置 Neon AI Gateway 来使用 GPT-4 模型?”

每周 5 个新技能,1 分钟读完。

工作原理

你需要在 Neon 项目的配置文件(`neon.ts`)中启用这项功能,然后继续使用现有的 AI 开发工具,只需把连接地址改成 Gateway 的地址即可。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Neon AI Gateway

This is a preview feature and only available in us-east-2. The Neon AI Gateway is the LLM inference layer built into your Neon branch: one API and one Neon credential give you access to frontier and open-source models from Anthropic, OpenAI, Google, Meta, Alibaba, DeepSeek, and Databricks — powered by Databricks. Your existing OpenAI/Anthropic/Gemini SDK works by changing only the base URL.

Use this skill to help the user send model calls through the gateway, wire it into the AI SDK or Mastra, and switch providers without rewiring code. Deliver a working inference request, a configured agent, or a precise answer from the official Neon docs.

When to Use

Reach for the AI Gateway whenever an app or agent needs to call an LLM and the user would rather not manage model providers themselves:

  • One credential instead of many provider accounts. A single Neon credential reaches the entire model catalog across seven providers. No separate OpenAI / Anthropic / Google billing, keys, or signups to provision and rotate.
  • Switch models without rewiring. The unified endpoint is OpenAI-compatible and works with every model in the catalog — change one model field to move between Claude, GPT, and Gemini. Standard SDKs (OpenAI, Anthropic, google-genai) work with just a base-URL change.
  • AI follows your branches. Each branch has its own gateway endpoint, scoped with the same lineage as your database. AI requests from a preview/feature branch are isolated to that branch — the same isolation your data already gets — which makes preview, CI, and agent environments self-contained.
  • No extra infrastructure, and it's already next to your data. The gateway lives inside your Neon project (and is injected into Neon Functions automatically), runs on the same Databricks infrastructure that serves trillions of tokens a month, and supports streaming (SSE) out of the box.

If the user already has a deep, single-provider integration and no interest in Neon branching or multi-model routing, a direct provider SDK is fine — but the moment they want one credential, model portability, or branch-scoped AI, this is the reason to use it.

What It Does

  • One API for all models — Frontier and open-source models behind a single endpoint, addressed by their catalog ID (e.g. claude-sonnet-4-6, gpt-5-mini, gemini-2-5-flash).
  • Standard SDKs, one URL change — OpenAI SDK and AI SDK (OpenAI-compatible MLflow/Responses routes), Anthropic SDK (native Messages), google-genai (native Gemini).
  • Branch-scoped — Each branch gets its own gateway host; the Neon credential authorizes requests for that branch and its descendants.
  • Streaming — Server-sent events work on all endpoints with no extra configuration.

Setup

The gateway is part of neon.ts (see the neon skill for the branch-first workflow and neon.ts basics). Enable it under preview.aiGateway:

// neon.ts
import { defineConfig } from "@neon/config/v1";

export default defineConfig({
  preview: {
    aiGateway: true,
  },
});
neon deploy   # provisions the gateway on the linked branch

Neon Infrastructure as Code (neon.ts)

The preview.aiGateway toggle above is part of neon.ts, Neon's infrastructure-as-code file — one TypeScript file declares the gateway alongside every other branch service, in version control (see the neon skill for the full reference). Reconcile it against a branch the Terraform way:

neon config status   # print the branch's live config (is the gateway on?)
neon config plan     # dry-run diff of what apply would change
neon config apply    # enable the gateway on the branch  (neon deploy is an alias)

The gateway is branch-scoped: each branch gets its own gateway host. When a neon.ts is present, neon checkout applies the policy as it creates a branch, so a fresh preview/CI branch comes up with the gateway already enabled. Checking out an existing branch doesn't reconcile it — run neon deploy to apply changes. Provisioning (config apply / deploy), link, and checkout also pull the branch's gateway credentials into your local .env.local, so local runs hit the same branch gateway as the deployed function (no manual env pull needed).

For typed, validated access to the injected credentials, pass the same config object to parseEnv from @neon/env — it returns an env.aiGateway namespace (apiKey, baseUrl) derived from your neon.ts.

…

常见问题

我需要多个访问密钥吗?

不需要。你只用一个 Neon 密钥,就可以通过 Gateway 访问所有可用的模型。

我现有的 AI 库还能继续用吗?

可以。像 OpenAI、Anthropic 或 Google Gemini 这些库,只要把基础连接地址改掉,就能正常工作。

“branch-scoped”是什么意思?

意思是项目的每个分支(branch)都有自己专属的 Gateway 访问入口。这样 AI 调用就会相互隔离,并与该分支的上下文绑定,就像你的数据一样。

详情

作者的原始描述

One API and one credential for frontier and open-source LLMs, built into your Neon branch and powered by Databricks.

repo: sickn33/agentic-awesome-skills

热度

GitHub 星标
48k
排名
#5281
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能