[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7A6ZPBP5DPC0TS5CV6HGC7D":3,"skill-same:01M7A6ZPBP5DPC0TS5CV6HGC7D":53},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":30,"commitSha":31,"skillDirectory":32,"forksCount":33,"repositoryHtmlUrl":34,"repositoryHomepageUrl":6,"ownerHtmlUrl":35,"ownerBlogUrl":36,"ownerDescription":37,"updatedAt":38,"install":39,"resources":52},"01M7A6ZPBP5DPC0TS5CV6HGC7D","neon-ai-gateway",null,"One API and one credential for frontier and open-source LLMs, built into your Neon branch and powered by Databricks. Use when a user wants to call an LLM, add AI\u002Fchat\u002Fan agent to their app, route between model providers (OpenAI, Anthropic, Google\u002FGemini, Meta, Alibaba, DeepSeek), or...","MHassan0000\u002FSkills","MHassan0000","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F224296448?v=4","01M7A14DTC1EZCRN04582533RD","Muhammad Hassan Yousaf","01M7A14DV10KTW8NHQTJPD08X0",1,"Apache-2.0","https:\u002F\u002Fgithub.com\u002FMHassan0000\u002FSkills\u002Fblob\u002Fmain\u002FClaude\u002Fantigravity skills\u002Fagentic-awesome-skills\u002Fskills\u002Fneon-ai-gateway\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: neon-ai-gateway\ndescription: One API and one credential for frontier and open-source LLMs, built into your Neon branch and powered by Databricks. Use when a user wants to call an LLM, add AI\u002Fchat\u002Fan agent to their app, route between model providers (OpenAI, Anthropic, Google\u002FGemini, Meta, Alibaba, DeepSeek), or...\nrisk: critical\nsource: https:\u002F\u002Fgithub.com\u002Fneondatabase\u002Fagent-skills\u002Ftree\u002Fmain\u002Fskills\u002Fneon-ai-gateway\nsource_repo: neondatabase\u002Fagent-skills\nsource_type: official\ndate_added: 2026-07-01\nlicense: Apache-2.0\nlicense_source: https:\u002F\u002Fgithub.com\u002Fneondatabase\u002Fagent-skills\u002Fblob\u002Fmain\u002FLICENSE\n---\n\n# Neon AI Gateway\n\nThis 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\u002FAnthropic\u002FGemini SDK works by changing only the base URL.\n\nUse 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.\n\n## When to Use\n\nReach for the AI Gateway whenever an app or agent needs to call an LLM and the user would rather not manage model providers themselves:\n\n- **One credential instead of many provider accounts.** A single Neon credential reaches the entire model catalog across seven providers. No separate OpenAI \u002F Anthropic \u002F Google billing, keys, or signups to provision and rotate.\n- **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.\n- **AI follows your branches.** Each branch has its own gateway endpoint, scoped with the same lineage as your database. AI requests from a preview\u002Ffeature branch are isolated to that branch — the same isolation your data already gets — which makes preview, CI, and agent environments self-contained.\n- **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.\n\nIf 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.\n\n## What It Does\n\n- **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`).\n- **Standard SDKs, one URL change** — OpenAI SDK and AI SDK (OpenAI-compatible MLflow\u002FResponses routes), Anthropic SDK (native Messages), google-genai (native Gemini).\n- **Branch-scoped** — Each branch gets its own gateway host; the Neon credential authorizes requests for that branch and its descendants.\n- **Streaming** — Server-sent events work on all endpoints with no extra configuration.\n\n## Setup\n\nThe gateway is part of `neon.ts` (see the `neon` skill for the branch-first workflow and `neon.ts` basics). Enable it under `preview.aiGateway`:\n\n```typescript\n\u002F\u002F neon.ts\nimport { defineConfig } from \"@neon\u002Fconfig\u002Fv1\";\n\nexport default defineConfig({\n  preview: {\n    aiGateway: true,\n  },\n});\n```\n\n```bash\nneon deploy   # provisions the gateway on the linked branch\n```\n\n## Neon Infrastructure as Code (`neon.ts`)\n\nThe `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:\n\n```bash\nneon config status   # print the branch's live config (is the gateway on?)\nneon config plan     # dry-run diff of what apply would change\nneon config apply    # enable the gateway on the branch  (neon deploy is an alias)\n```\n\nThe 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\u002FCI 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` \u002F `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).\n\nFor typed, validated access to the injected credentials, pass the same config object to `parseEnv` from `@neon\u002Fenv` — it returns an `env.aiGateway` namespace (`apiKey`, `baseUrl`) derived from your `neon.ts`.\n\n## Environment variables\n\nWhen `preview.aiGateway` is enabled, Neon injects the gateway credentials as **OpenAI-standard** env vars (so the OpenAI SDK and AI SDK work from the environment with no config), plus `NEON_`-branded aliases. Inside a deployed Neon Function these are injected automatically; locally, `neon env pull` writes them to `.env`\u002F`.env.local` (or use `neon-env run -- \u003Ccmd>` to inject at runtime without a file):\n\n| Variable                   | Meaning                                                                                                                                    |\n| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |\n| `OPENAI_API_KEY`           | Gateway bearer token (a Neon credential, `nt_live_...`)                                                                                    |\n| `OPENAI_BASE_URL`          | Full OpenAI-dialect route, **including** `\u002Fai-gateway\u002Fopenai\u002Fv1`: `https:\u002F\u002F\u003Cbranch-id>-api.ai.\u003Cregion>.aws.neon.tech\u002Fai-gateway\u002Fopenai\u002Fv1` |\n| `NEON_AI_GATEWAY_TOKEN`    | Same bearer as `OPENAI_API_KEY` (survives a user overriding `OPENAI_*` with their own keys)                                                |\n| `NEON_AI_GATEWAY_BASE_URL` | **Bare branch gateway host** (`scheme:\u002F\u002Fhost`, **no path** — no `\u002Fai-gateway`): `https:\u002F\u002F\u003Cbranch-id>-api.ai.\u003Cregion>.aws.neon.tech`        |\n\nThe two base URLs are **different**: `OPENAI_BASE_URL` already includes the full `\u002Fai-gateway\u002Fopenai\u002Fv1` (Responses) route, while `NEON_AI_GATEWAY_BASE_URL` is just the bare host, so you append `\u002Fai-gateway\u002F\u003Cdialect>` yourself (this is also what the `@neon\u002Fai-sdk-provider` does for you). The routes under the host are:\n\n- `\u002Fai-gateway\u002Fmlflow\u002Fv1` — unified, OpenAI **Chat Completions**-compatible; recommended default, works with every provider.\n- `\u002Fai-gateway\u002Fopenai\u002Fv1` — OpenAI **Responses** API (required for `gpt-5-…-codex` variants and `gpt-5-5-pro`). This is the route `OPENAI_BASE_URL` already points at, because the `@ai-sdk\u002Fopenai` provider uses the Responses API by default.\n- `\u002Fai-gateway\u002Fanthropic\u002Fv1` — native Anthropic Messages (extended thinking, prompt caching).\n- `\u002Fai-gateway\u002Fgemini\u002Fv1beta\u002F...` — native Gemini `generateContent`.\n\nSo `${NEON_AI_GATEWAY_BASE_URL}\u002Fai-gateway\u002Fmlflow\u002Fv1` is the chat-completions endpoint, `${NEON_AI_GATEWAY_BASE_URL}\u002Fai-gateway\u002Fopenai\u002Fv1` equals `OPENAI_BASE_URL`, and so on. If you only have `OPENAI_BASE_URL` and need chat completions, swap the dialect: `baseUrl.replace(\"\u002Fopenai\u002Fv1\", \"\u002Fmlflow\u002Fv1\")` (this is what the Mastra example does).\n\nFor typed access, `parseEnv` (from `@neon\u002Fenv`) returns `env.aiGateway` (`apiKey`, `baseUrl`) derived from your `neon.ts`.\n\n## Build agents with the Vercel AI SDK (recommended)\n\nThe [Vercel AI SDK](https:\u002F\u002Fai-sdk.dev) is the recommended way to call the gateway and build agents from TypeScript: one set of primitives (`generateText`, `streamText`, tool calling, structured output) over every catalog model, with first-class streaming for the long agent responses Neon Functions are built to host.\n\nOn a Neon Function that streams text and generates images, the `@ai-sdk\u002Fopenai` provider reads `OPENAI_API_KEY` and `OPENAI_BASE_URL` from the injected env automatically — no client config needed; just pick a catalog model:\n\n```typescript\nimport { openai } from \"@ai-sdk\u002Fopenai\";\nimport { streamText } from \"ai\";\n\nconst result = streamText({\n  model: openai(\"gpt-5-mini\"),\n  messages,\n  tools: {\n    image_generation: openai.tools.imageGeneration({\n      outputFormat: \"jpeg\",\n      size: \"1024x1024\",\n    }),\n  },\n});\nreturn result.toUIMessageStreamResponse();\n```\n\nFor multi-provider routing from a single call, the dedicated `@neon\u002Fai-sdk-provider` reads `NEON_AI_GATEWAY_BASE_URL` + `NEON_AI_GATEWAY_TOKEN` and routes each model to the best endpoint (Anthropic → Messages, OpenAI\u002FCodex → Responses, everything else → MLflow):\n\n```typescript\nimport { neon } from \"@neon\u002Fai-sdk-provider\";\nimport { generateText } from \"ai\";\n\nconst { text } = await generateText({\n  model: neon(\"claude-haiku-4-5\"), \u002F\u002F or gpt-5-3-codex, gemini-2-5-flash, ...\n  prompt: \"Summarize Postgres for me.\",\n});\n```\n\nTo build an **agent** — a model that calls tools in a loop and then answers — add `tools` and a `stopWhen` budget. The loop runs in-process, so on a Neon Function it isn't cut off by lambda-style timeouts:\n\n```typescript\nimport { neon } from \"@neon\u002Fai-sdk-provider\";\nimport { generateText, tool, stepCountIs } from \"ai\";\nimport { z } from \"zod\";\n\nconst { text } = await generateText({\n  model: neon(\"claude-sonnet-4-6\"),\n  prompt: \"How many open todos do I have, and what's the oldest one?\",\n  tools: {\n    listTodos: tool({\n      description: \"List the user's open todos.\",\n      inputSchema: z.object({}), \u002F\u002F AI SDK v5+: `inputSchema`, not `parameters`\n      execute: async () => db.select().from(todos),\n    }),\n  },\n  stopWhen: stepCountIs(5), \u002F\u002F let the model call tools, then summarize\n});\n```\n\nFor a full AI SDK agent deployed as a Neon Function (streaming, tool calling, image generation, persistence), see the `neon-functions` skill's `references\u002Fai-sdk.md`.\n\n## Build agents with Mastra (recommended)\n\n[Mastra](https:\u002F\u002Fmastra.ai) is the recommended framework when you want batteries-included agents — built-in memory, tools, workflows, and tracing — with the model still pointed at the gateway. A memory-backed agent (threads\u002Fmessages in Postgres via `@mastra\u002Fpg`) running as a Neon Function reads `env.aiGateway` from `parseEnv` and uses the **chat-completions** (MLflow) dialect:\n\n```typescript\nimport { Agent } from \"@mastra\u002Fcore\u002Fagent\";\nimport { parseEnv } from \"@neon\u002Fenv\";\nimport config from \"..\u002Fneon\";\n\nconst env = parseEnv(config);\nconst gatewayUrl = env.aiGateway.baseUrl.replace(\"\u002Fopenai\u002Fv1\", \"\u002Fmlflow\u002Fv1\");\n\nexport const personalAssistant = new Agent({\n  id: \"personal-assistant\",\n  name: \"personal-assistant\",\n  instructions:\n    \"You are a warm, concise personal assistant with long-term memory.\",\n  model: {\n    id: `neon\u002Fclaude-haiku-4-5`,\n    url: gatewayUrl,\n    apiKey: env.aiGateway.apiKey,\n  },\n  memory,\n});\n```\n\n## Use with plain SDKs (lower-level)\n\nWhen you don't need an agent framework — a single completion, an existing provider-SDK integration, or native provider features — call the gateway with the plain SDKs. The injected `OPENAI_API_KEY` and `OPENAI_BASE_URL` are OpenAI-standard, so `new OpenAI()` picks them up with **zero config**. Since `OPENAI_BASE_URL` is the OpenAI **Responses** dialect (`\u002Fopenai\u002Fv1`), call the Responses API:\n\n```typescript\nimport OpenAI from \"openai\";\n\nconst client = new OpenAI(); \u002F\u002F reads OPENAI_API_KEY + OPENAI_BASE_URL from the env\n\nconst res = await client.responses.create({\n  model: \"gpt-5-mini\", \u002F\u002F swap to claude-sonnet-4-6, gemini-2-5-flash, ...\n  input: \"What is Neon?\",\n});\n```\n\nFor the unified **chat-completions** dialect (`\u002Fmlflow\u002Fv1`) instead, point the client at it. The ergonomic way is to swap the dialect on the injected base URL rather than rebuild it (same move the Mastra example makes):\n\n```typescript\nconst client = new OpenAI({\n  baseURL: process.env.OPENAI_BASE_URL!.replace(\"\u002Fopenai\u002Fv1\", \"\u002Fmlflow\u002Fv1\"),\n});\n\nconst res = await client.chat.completions.create({\n  model: \"claude-sonnet-4-6\",\n  messages: [{ role: \"user\", content: \"What is Neon?\" }],\n});\n```\n\nThe Anthropic SDK and google-genai work the same way for native provider features — point them at the `\u002Fanthropic` and `\u002Fgemini` routes on the bare gateway host (`${NEON_AI_GATEWAY_BASE_URL}\u002Fai-gateway\u002Fanthropic`, `${NEON_AI_GATEWAY_BASE_URL}\u002Fai-gateway\u002Fgemini`).\n\n## Model identifiers\n\nUse a model's catalog ID directly in the `model` field — e.g. `claude-sonnet-4-6`, `gpt-5-mini`, `gemini-2-5-flash`. No provider prefix is needed. To look up the exact identifiers the gateway serves, which underlying model each maps to, and their context windows, pricing, and capabilities, use any of:\n\n- **models.dev Neon provider page: https:\u002F\u002Fmodels.dev\u002Fproviders\u002Fneon** — the canonical, always-current list of the Neon provider's model IDs and their underlying models. The machine-readable catalog is at https:\u002F\u002Fmodels.dev\u002Fapi.json (the `neon` key).\n- **Models doc:** see Further reading.\n\n## Availability\n\nThe AI Gateway is a preview (early access) feature available only on new projects in the `us-east-2` region; it can't be enabled on existing projects. Foundation model access requires a paid Neon plan. Confirm the user's project is a new project in `us-east-2`. If the user does not yet have access, point them to the private beta sign-up: https:\u002F\u002Fneon.com\u002Fblog\u002Fwere-building-backends#access\n\n## Neon Documentation\n\nThe Neon documentation is the source of truth and the AI Gateway is evolving rapidly, so always verify against the official docs. Any doc page can be fetched as markdown by appending `.md` to the URL or by requesting `Accept: text\u002Fmarkdown`. Find the right page from the docs index (https:\u002F\u002Fneon.com\u002Fdocs\u002Fllms.txt) and the changelog announcements.\n\n## Further reading\n\n- https:\u002F\u002Fneon.com\u002Fdocs\u002Fai-gateway\u002Foverview.md\n- https:\u002F\u002Fneon.com\u002Fdocs\u002Fai-gateway\u002Fget-started.md\n- https:\u002F\u002Fneon.com\u002Fdocs\u002Fai-gateway\u002Fmodels.md\n- https:\u002F\u002Fneon.com\u002Fdocs\u002Fai-gateway\u002Fchat-completions.md\n- https:\u002F\u002Fneon.com\u002Fdocs\u002Fai-gateway\u002Fanthropic-messages.md\n- https:\u002F\u002Fneon.com\u002Fdocs\u002Fai-gateway\u002Fopenai-responses.md\n- https:\u002F\u002Fneon.com\u002Fdocs\u002Fai-gateway\u002Fgemini.md\n- https:\u002F\u002Fneon.com\u002Fdocs\u002Fai-gateway\u002Fauthentication.md\n- https:\u002F\u002Fneon.com\u002Fdocs\u002Fai-gateway\u002Ftroubleshooting.md\n\n## Limitations\n\n- Use this skill only when the task clearly matches its upstream product or API scope.\n- Verify commands, API behavior, pricing, quotas, credentials, and deployment effects against current official documentation before making changes.\n- Do not treat generated examples as a substitute for environment-specific tests, security review, or user approval for destructive or costly actions.\n","# Neon AI Gateway\n\nThis 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\u002FAnthropic\u002FGemini SDK works by changing only the base URL.\n\nUse 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.\n\n## When to Use\n\nReach for the AI Gateway whenever an app or agent needs to call an LLM and the user would rather not manage model providers themselves:\n\n- **One credential instead of many provider accounts.** A single Neon credential reaches the entire model catalog across seven providers. No separate OpenAI \u002F Anthropic \u002F Google billing, keys, or signups to provision and rotate.\n- **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.\n- **AI follows your branches.** Each branch has its own gateway endpoint, scoped with the same lineage as your database. AI requests from a preview\u002Ffeature branch are isolated to that branch — the same isolation your data already gets — which makes preview, CI, and agent environments self-contained.\n- **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.\n\nIf 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.\n\n## What It Does\n\n- **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`).\n- **Standard SDKs, one URL change** — OpenAI SDK and AI SDK (OpenAI-compatible MLflow\u002FResponses routes), Anthropic SDK (native Messages), google-genai (native Gemini).\n- **Branch-scoped** — Each branch gets its own gateway host; the Neon credential authorizes requests for that branch and its descendants.\n- **Streaming** — Server-sent events work on all endpoints with no extra configuration.\n\n## Setup\n\nThe gateway is part of `neon.ts` (see the `neon` skill for the branch-first workflow and `neon.ts` basics). Enable it under `preview.aiGateway`:\n\n```typescript\n\u002F\u002F neon.ts\nimport { defineConfig } from \"@neon\u002Fconfig\u002Fv1\";\n\nexport default defineConfig({\n  preview: {\n    aiGateway: true,\n  },\n});\n```\n\n```bash\nneon deploy   # provisions the gateway on the linked branch\n```\n\n## Neon Infrastructure as Code (`neon.ts`)\n\nThe `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:\n\n```bash\nneon config status   # print the branch's live config (is the gateway on?)\nneon config plan     # dry-run diff of what apply would change\nneon config apply    # enable the gateway on the branch  (neon deploy is an alias)\n```\n\nThe 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\u002FCI 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` \u002F `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).\n\nFor typed, validated access to the injected credentials, pass the same config object to `parseEnv` from `@neon\u002Fenv` — it returns an `env.aiGateway` namespace (`apiKey`, `baseUrl`) derived from your `neon.ts`.\n\n## Environment variables\n\nWhen `preview.aiGateway` is enabled, Neon injects the gateway credentials as **OpenAI-standard** env vars (so the OpenAI SDK and AI SDK work from the environment with no config), plus `NEON_`-branded aliases. Inside a deployed Neon Function these are injected automatically; locally, `neon env pull` writes them to `.env`\u002F`.env.local` (or use `neon-env run -- \u003Ccmd>` to inject at runtime without a file):\n\n| Variable                   | Meaning                                                                                                                                    |\n| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |\n| `OPENAI_API_KEY`           | Gateway bearer token (a Neon credential, `nt_live_...`)                                                                                    |\n| `OPENAI_BASE_URL`          | Full OpenAI-dialect route, **including** `\u002Fai-gateway\u002Fopenai\u002Fv1`: `https:\u002F\u002F\u003Cbranch-id>-api.ai.\u003Cregion>.aws.neon.tech\u002Fai-gateway\u002Fopenai\u002Fv1` |\n| `NEON_AI_GATEWAY_TOKEN`    | Same bearer as `OPENAI_API_KEY` (survives a user overriding `OPENAI_*` with their own keys)                                                |\n| `NEON_AI_GATEWAY_BASE_URL` | **Bare branch gateway host** (`scheme:\u002F\u002Fhost`, **no path** — no `\u002Fai-gateway`): `https:\u002F\u002F\u003Cbranch-id>-api.ai.\u003Cregion>.aws.neon.tech`        |\n\nThe two base URLs are **different**: `OPENAI_BASE_URL` already includes the full `\u002Fai-gateway\u002Fopenai\u002Fv1` (Responses) route, while `NEON_AI_GATEWAY_BASE_URL` is just the bare host, so you append `\u002Fai-gateway\u002F\u003Cdialect>` yourself (this is also what the `@neon\u002Fai-sdk-provider` does for you). The routes under the host are:\n\n- `\u002Fai-gateway\u002Fmlflow\u002Fv1` — unified, OpenAI **Chat Completions**-compatible; recommended default, works with every provider.\n- `\u002Fai-gateway\u002Fopenai\u002Fv1` — OpenAI **Responses** API (required for `gpt-5-…-codex` variants and `gpt-5-5-pro`). This is the route `OPENAI_BASE_URL` already points at, because the `@ai-sdk\u002Fopenai` provider uses the Responses API by default.\n- `\u002Fai-gateway\u002Fanthropic\u002Fv1` — native Anthropic Messages (extended thinking, prompt caching).\n- `\u002Fai-gateway\u002Fgemini\u002Fv1beta\u002F...` — native Gemini `generateContent`.\n\nSo `${NEON_AI_GATEWAY_BASE_URL}\u002Fai-gateway\u002Fmlflow\u002Fv1` is the chat-completions endpoint, `${NEON_AI_GATEWAY_BASE_URL}\u002Fai-gateway\u002Fopenai\u002Fv1` equals `OPENAI_BASE_URL`, and so on. If you only have `OPENAI_BASE_URL` and need chat completions, swap the dialect: `baseUrl.replace(\"\u002Fopenai\u002Fv1\", \"\u002Fmlflow\u002Fv1\")` (this is what the Mastra example does).\n\nFor typed access, `parseEnv` (from `@neon\u002Fenv`) returns `env.aiGateway` (`apiKey`, `baseUrl`) derived from your `neon.ts`.\n\n## Build agents with the Vercel AI SDK (recommended)\n\nThe [Vercel AI SDK](https:\u002F\u002Fai-sdk.dev) is the recommended way to call the gateway and build agents from TypeScript: one set of primitives (`generateText`, `streamText`, tool calling, structured output) over every catalog model, with first-class streaming for the long agent responses Neon Functions are built to host.\n\nOn a Neon Function that streams text and generates images, the `@ai-sdk\u002Fopenai` provider reads `OPENAI_API_KEY` and `OPENAI_BASE_URL` from the injected env automatically — no client config needed; just pick a catalog model:\n\n```typescript\nimport { openai } from \"@ai-sdk\u002Fopenai\";\nimport { streamText } from \"ai\";\n\nconst result = streamText({\n  model: openai(\"gpt-5-mini\"),\n  messages,\n  tools: {\n    image_generation: openai.tools.imageGeneration({\n      outputFormat: \"jpeg\",\n      size: \"1024x1024\",\n    }),\n  },\n});\nreturn result.toUIMessageStreamResponse();\n```\n\nFor multi-provider routing from a single call, the dedicated `@neon\u002Fai-sdk-provider` reads `NEON_AI_GATEWAY_BASE_URL` + `NEON_AI_GATEWAY_TOKEN` and routes each model to the best endpoint (Anthropic → Messages, OpenAI\u002FCodex → Responses, everything else → MLflow):\n\n```typescript\nimport { neon } from \"@neon\u002Fai-sdk-provider\";\nimport { generateText } from \"ai\";\n\nconst { text } = await generateText({\n  model: neon(\"claude-haiku-4-5\"), \u002F\u002F or gpt-5-3-codex, gemini-2-5-flash, ...\n  prompt: \"Summarize Postgres for me.\",\n});\n```\n\nTo build an **agent** — a model that calls tools in a loop and then answers — add `tools` and a `stopWhen` budget. The loop runs in-process, so on a Neon Function it isn't cut off by lambda-style timeouts:\n\n```typescript\nimport { neon } from \"@neon\u002Fai-sdk-provider\";\nimport { generateText, tool, stepCountIs } from \"ai\";\nimport { z } from \"zod\";\n\nconst { text } = await generateText({\n  model: neon(\"claude-sonnet-4-6\"),\n  prompt: \"How many open todos do I have, and what's the oldest one?\",\n  tools: {\n    listTodos: tool({\n      description: \"List the user's open todos.\",\n      inputSchema: z.object({}), \u002F\u002F AI SDK v5+: `inputSchema`, not `parameters`\n      execute: async () => db.select().from(todos),\n    }),\n  },\n  stopWhen: stepCountIs(5), \u002F\u002F let the model call tools, then summarize\n});\n```\n\nFor a full AI SDK agent deployed as a Neon Function (streaming, tool calling, image generation, persistence), see the `neon-functions` skill's `references\u002Fai-sdk.md`.\n\n## Build agents with Mastra (recommended)\n\n[Mastra](https:\u002F\u002Fmastra.ai) is the recommended framework when you want batteries-included agents — built-in memory, tools, workflows, and tracing — with the model still pointed at the gateway. A memory-backed agent (threads\u002Fmessages in Postgres via `@mastra\u002Fpg`) running as a Neon Function reads `env.aiGateway` from `parseEnv` and uses the **chat-completions** (MLflow) dialect:\n\n```typescript\nimport { Agent } from \"@mastra\u002Fcore\u002Fagent\";\nimport { parseEnv } from \"@neon\u002Fenv\";\nimport config from \"..\u002Fneon\";\n\nconst env = parseEnv(config);\nconst gatewayUrl = env.aiGateway.baseUrl.replace(\"\u002Fopenai\u002Fv1\", \"\u002Fmlflow\u002Fv1\");\n\nexport const personalAssistant = new Agent({\n  id: \"personal-assistant\",\n  name: \"personal-assistant\",\n  instructions:\n    \"You are a warm, concise personal assistant with long-term memory.\",\n  model: {\n    id: `neon\u002Fclaude-haiku-4-5`,\n    url: gatewayUrl,\n    apiKey: env.aiGateway.apiKey,\n  },\n  memory,\n});\n```\n\n## Use with plain SDKs (lower-level)\n\nWhen you don't need an agent framework — a single completion, an existing provider-SDK integration, or native provider features — call the gateway with the plain SDKs. The injected `OPENAI_API_KEY` and `OPENAI_BASE_URL` are OpenAI-standard, so `new OpenAI()` picks them up with **zero config**. Since `OPENAI_BASE_URL` is the OpenAI **Responses** dialect (`\u002Fopenai\u002Fv1`), call the Responses API:\n\n```typescript\nimport OpenAI from \"openai\";\n\nconst client = new OpenAI(); \u002F\u002F reads OPENAI_API_KEY + OPENAI_BASE_URL from the env\n\nconst res = await client.responses.create({\n  model: \"gpt-5-mini\", \u002F\u002F swap to claude-sonnet-4-6, gemini-2-5-flash, ...\n  input: \"What is Neon?\",\n});\n```\n\nFor the unified **chat-completions** dialect (`\u002Fmlflow\u002Fv1`) instead, point the client at it. The ergonomic way is to swap the dialect on the injected base URL rather than rebuild it (same move the Mastra example makes):\n\n```typescript\nconst client = new OpenAI({\n  baseURL: process.env.OPENAI_BASE_URL!.replace(\"\u002Fopenai\u002Fv1\", \"\u002Fmlflow\u002Fv1\"),\n});\n\nconst res = await client.chat.completions.create({\n  model: \"claude-sonnet-4-6\",\n  messages: [{ role: \"user\", content: \"What is Neon?\" }],\n});\n```\n\nThe Anthropic SDK and google-genai work the same way for native provider features — point them at the `\u002Fanthropic` and `\u002Fgemini` routes on the bare gateway host (`${NEON_AI_GATEWAY_BASE_URL}\u002Fai-gateway\u002Fanthropic`, `${NEON_AI_GATEWAY_BASE_URL}\u002Fai-gateway\u002Fgemini`).\n\n## Model identifiers\n\nUse a model's catalog ID directly in the `model` field — e.g. `claude-sonnet-4-6`, `gpt-5-mini`, `gemini-2-5-flash`. No provider prefix is needed. To look up the exact identifiers the gateway serves, which underlying model each maps to, and their context windows, pricing, and capabilities, use any of:\n\n- **models.dev Neon provider page: https:\u002F\u002Fmodels.dev\u002Fproviders\u002Fneon** — the canonical, always-current list of the Neon provider's model IDs and their underlying models. The machine-readable catalog is at https:\u002F\u002Fmodels.dev\u002Fapi.json (the `neon` key).\n- **Models doc:** see Further reading.\n\n## Availability\n\nThe AI Gateway is a preview (early access) feature available only on new projects in the `us-east-2` region; it can't be enabled on existing projects. Foundation model access requires a paid Neon plan. Confirm the user's project is a new project in `us-east-2`. If the user does not yet have access, point them to the private beta sign-up: https:\u002F\u002Fneon.com\u002Fblog\u002Fwere-building-backends#access\n\n## Neon Documentation\n\nThe Neon documentation is the source of truth and the AI Gateway is evolving rapidly, so always verify against the official docs. Any doc page can be fetched as markdown by appending `.md` to the URL or by requesting `Accept: text\u002Fmarkdown`. Find the right page from the docs index (https:\u002F\u002Fneon.com\u002Fdocs\u002Fllms.txt) and the changelog announcements.\n\n## Further reading\n\n- https:\u002F\u002Fneon.com\u002Fdocs\u002Fai-gateway\u002Foverview.md\n- https:\u002F\u002Fneon.com\u002Fdocs\u002Fai-gateway\u002Fget-started.md\n- https:\u002F\u002Fneon.com\u002Fdocs\u002Fai-gateway\u002Fmodels.md\n- https:\u002F\u002Fneon.com\u002Fdocs\u002Fai-gateway\u002Fchat-completions.md\n- https:\u002F\u002Fneon.com\u002Fdocs\u002Fai-gateway\u002Fanthropic-messages.md\n- https:\u002F\u002Fneon.com\u002Fdocs\u002Fai-gateway\u002Fopenai-responses.md\n- https:\u002F\u002Fneon.com\u002Fdocs\u002Fai-gateway\u002Fgemini.md\n- https:\u002F\u002Fneon.com\u002Fdocs\u002Fai-gateway\u002Fauthentication.md\n- https:\u002F\u002Fneon.com\u002Fdocs\u002Fai-gateway\u002Ftroubleshooting.md\n\n## Limitations\n\n- Use this skill only when the task clearly matches its upstream product or API scope.\n- Verify commands, API behavior, pricing, quotas, credentials, and deployment effects against current official documentation before making changes.\n- Do not treat generated examples as a substitute for environment-specific tests, security review, or user approval for destructive or costly actions.\n",{"name":5,"risk":24,"source":25,"license":15,"date_added":26,"description":7,"source_repo":27,"source_type":28,"license_source":29},"critical","https:\u002F\u002Fgithub.com\u002Fneondatabase\u002Fagent-skills\u002Ftree\u002Fmain\u002Fskills\u002Fneon-ai-gateway",1782864000000,"neondatabase\u002Fagent-skills","official","https:\u002F\u002Fgithub.com\u002Fneondatabase\u002Fagent-skills\u002Fblob\u002Fmain\u002FLICENSE","main","a4404a75dc81d6b7e58c5906b6aaffbcb5e84747","Claude\u002Fantigravity skills\u002Fagentic-awesome-skills\u002Fskills\u002Fneon-ai-gateway",0,"https:\u002F\u002Fgithub.com\u002FMHassan0000\u002FSkills","https:\u002F\u002Fgithub.com\u002FMHassan0000","https:\u002F\u002Fhassanyousaf.vercel.app","Full Stack Developer building web apps, SaaS, AI systems, and automations. Passionate about clean code, UI\u002FUX, backend systems, and turning ideas into products.","2026-08-07 20:42:05",{"source":8,"skillName":5,"commands":40,"prompt":50,"zipAvailable":51},[41,44,47],{"tool":42,"command":43},"npx","npx skills add MHassan0000\u002FSkills --skill neon-ai-gateway",{"tool":45,"command":46},"bunx","bunx skills add MHassan0000\u002FSkills --skill neon-ai-gateway",{"tool":48,"command":49},"pnpm","pnpm dlx skills add MHassan0000\u002FSkills --skill neon-ai-gateway","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FMHassan0000\u002FSkills\u002Fblob\u002Fmain\u002FClaude\u002Fantigravity skills\u002Fagentic-awesome-skills\u002Fskills\u002Fneon-ai-gateway\u002FSKILL.md",true,[],[54,62,69,76,84,92],{"skillNo":55,"name":56,"nameZh":6,"description":57,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":58,"licenseFileUrl":6,"sourceHtmlUrl":59,"categories":60,"keywords":61,"publishedAt":19},"01M7AGBX58S04DX8DKKME8N311","vercel-react-best-practices","React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React\u002FNext.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.","MIT","https:\u002F\u002Fgithub.com\u002FMHassan0000\u002FSkills\u002Fblob\u002Fmain\u002FClaude\u002Fskills boraztunc github\u002Fvercel-react-best-practices\u002FSKILL.md",[],[],{"skillNo":63,"name":64,"nameZh":6,"description":65,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":58,"licenseFileUrl":6,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":19},"01M7AGBREE890608Z7YDMAKH27","stop-slop","Remove AI writing patterns from prose. Use when drafting, editing, or reviewing text to eliminate predictable AI tells and produce more human-like writing.","https:\u002F\u002Fgithub.com\u002FMHassan0000\u002FSkills\u002Fblob\u002Fmain\u002FClaude\u002Fskills boraztunc github\u002Fstop-slop\u002FSKILL.md",[],[],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":58,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":19},"01M7AGAS972A2AN7Q5EW8HEAXK","ogilvy-copywriting","Apply David Ogilvy's advertising principles when writing or reviewing copy, headlines, product descriptions, landing pages, ads, emails, or any persuasive text. Use when the goal is copy that sells, not copy that wins awards. Covers positioning, headlines, promises, brand voice, long-form copy, and visual logic. Source: How to Create Advertising That Sells (1972) + Ogilvy on Advertising.","https:\u002F\u002Fgithub.com\u002FMHassan0000\u002FSkills\u002Fblob\u002Fmain\u002FClaude\u002Fskills boraztunc github\u002Fogilvy\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":80,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":19},"01M7AGAF12803G5JPVMK79AYJB","frontend-design","Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, artifacts, posters, or applications (examples include websites, landing pages, dashboards, React components, HTML\u002FCSS layouts, or when styling\u002Fbeautifying any web UI). Generates creative, polished code and UI design that avoids generic AI aesthetics.","https:\u002F\u002Fgithub.com\u002FMHassan0000\u002FSkills\u002Fblob\u002Fmain\u002FClaude\u002Fskills boraztunc github\u002Ffrontend-design\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FMHassan0000\u002FSkills\u002Fblob\u002Fmain\u002FClaude\u002Fskills boraztunc github\u002Ffrontend-design\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":88,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":19},"01M7AG88WWVWCGJY9WA9CH7EY4","webapp-testing","Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.","https:\u002F\u002Fgithub.com\u002FMHassan0000\u002FSkills\u002Fblob\u002Fmain\u002FClaude\u002Fobra superpower skills\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FMHassan0000\u002FSkills\u002Fblob\u002Fmain\u002FClaude\u002Fobra superpower skills\u002Fwebapp-testing\u002FSKILL.md",[],[],{"skillNo":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":96,"sourceHtmlUrl":97,"categories":98,"keywords":99,"publishedAt":19},"01M7AG7ZTNV7XQCWDQ9674FBYB","web-artifacts-builder","Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn\u002Fui). Use for complex artifacts requiring state management, routing, or shadcn\u002Fui components - not for simple single-file HTML\u002FJSX artifacts.","https:\u002F\u002Fgithub.com\u002FMHassan0000\u002FSkills\u002Fblob\u002Fmain\u002FClaude\u002Fobra superpower skills\u002Fweb-artifacts-builder\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FMHassan0000\u002FSkills\u002Fblob\u002Fmain\u002FClaude\u002Fobra superpower skills\u002Fweb-artifacts-builder\u002FSKILL.md",[],[]]