Neon AI Gateway is in beta. It requires a paid Neon plan with prepaid credits and a project in a supported AWS region. See Neon AI Gateway for detailed requirements.
Prerequisites
Unlike most providers, Neon does not have one shared hostname. Each database branch gets its own gateway host, so you need two values:- A credential with the
ai_gateway:invokescope. Create it in the Neon Console under Credentials, or through the Neon API. See AI Gateway authentication. - The branch host, shown in the Neon Console as
NEON_AI_GATEWAY_BASE_URL. It is a per-branch URL of the formhttps://<your-neon-branch-host>.
neon env pull --file .env writes both as NEON_AI_GATEWAY_TOKEN and NEON_AI_GATEWAY_BASE_URL.
Trace a Neon AI Gateway call
Setapi_key to your Neon credential, set base_url to the branch host plus /v1, and use a short Neon model ID such as gpt-5-mini. weave.init() requires a project name for your traces. You can optionally prefix it with a W&B entity as <entity>/<project>; if you omit the entity, Weave uses your default entity. To find or update your default entity, refer to Default team.
Trace across branches
A Neon credential is valid on the branch it was created on and on every branch descended from it, so a credential created onmain also works in preview and CI branches forked from it. Only NEON_AI_GATEWAY_BASE_URL changes between environments.
Because the branch host lives in the client configuration rather than in the request, traces from different branches look the same in Weave. Pass separate project names to weave.init(), or attach the branch as an attribute, if you want to tell them apart:
Choose a model
Neon uses short model IDs likegpt-5-mini, gemini-3-flash, llama-4-maverick, and qwen3-next-80b-a3b-instruct. List what a branch can serve:
neon provider on Models.dev.
Two constraints affect which model you pick:
- A few models are served only on Neon’s Responses API path,
{NEON_AI_GATEWAY_BASE_URL}/openai/v1, and return a400on chat completions. The Endpoints column in Neon’s model catalog marks which ones, and the set changes; at the time of writing it isgpt-5-3-codexandgpt-5-5-pro. Every model the column lists withchat/completionsworks on the chat completions path.
pricing as null in GET /v1/models, so traces show token counts without cost. AI Gateway usage draws down your prepaid credit balance; see AI Gateway pricing.
See the OpenAI integration guide for more details about integrating Weave with your own functions for more complex use cases.