Skip to content

docs(weave): add Neon AI Gateway tracing guide - #2961

Open
mezotv wants to merge 7 commits into
wandb:mainfrom
mezotv:docs/weave-neon-ai-gateway
Open

mezotv wants to merge 7 commits into
wandb:mainfrom
mezotv:docs/weave-neon-ai-gateway

Conversation

@mezotv

@mezotv mezotv commented Jul 26, 2026

Copy link
Copy Markdown

Description

Adds a Weave integration guide for Neon AI Gateway, an OpenAI-compatible inference endpoint provided by Neon, plus the matching navigation entry in docs.json.

Why this needs no new Weave code. Neon AI Gateway is reached with the standard openai Python SDK pointed at a different base_url, so Weave's existing OpenAI SDK autopatching already traces these calls. The guide only changes api_key and base_url on an openai.OpenAI client. It follows the same shape as the sibling openrouter.mdx and together_ai.mdx pages, including the closing pointer to the OpenAI guide.

What is Neon-specific. Two things do not fit the single-shared-hostname pattern the other OpenAI-compatible pages assume:

  • Neon has no one gateway hostname. Each database branch gets its own host, so the page drives everything from the NEON_AI_GATEWAY_BASE_URL and NEON_AI_GATEWAY_TOKEN environment variables instead of a literal URL, and adds a short "Trace across branches" section on telling branches apart in traces.
  • GET /v1/models reports pricing as null and no cost field comes back on a response, so the page states plainly that traces show token counts without cost, rather than letting a reader assume the cost column will populate.

The page also names the two model constraints a reader hits first: the Codex variants are served only on Neon's Responses API path and return 400 on chat completions, and several models return message.content as an array of content blocks rather than a string.

Scope is deliberately narrow, chat completions through the OpenAI SDK. The page makes no tool-calling, structured-output, embeddings, image, or audio claim, and it does not claim Weave has a native Neon provider integration.

Files:

  • weave/guides/integrations/neon.mdx (new, 90 lines)
  • docs.json (one line, weave/guides/integrations/neon inserted between mistral and nvidia_nim)

The diff is insertion-only: 91 added lines, 0 removed. English only; fr, ja, and ko are left to the repo's gt.config.json translation pipeline.

Testing

  • Local build succeeds without errors — mint validate reported success build validation passed. This is the command .github/workflows/validate-mdx.yml runs; I did not separately run mint dev.
  • Local link check succeeds without errors — mint broken-links reported success no broken links found.
  • PR tests succeed — opened as a draft so CI can report first.

Also checked locally: docs.json parses and the nav entry sits alphabetically between mistral and nvidia_nim; both Python snippets compile and the bash snippet passes bash -n; frontmatter parses, code fences are even, and <Note> balances; the five external links each return 200.

Limitation worth stating up front. Neon AI Gateway is in beta and needs a paid Neon plan and an aws-us-east-2 project, and I did not issue live requests against a gateway branch while preparing this PR. The product statements on the page (the beta and region constraints, the credential scope and branch-lineage behaviour, the Responses-only Codex IDs, the array content-block shape, and pricing: null) come from Neon's published documentation and the documented GET /v1/models response shape, not from a fresh live run. The snippets are syntax-checked, not executed end to end.

One thing to flag for a maintainer. The closing sentence links /weave/guides/integrations/openai#track-your-own-ops. The page resolves, but that heading anchor does not exist in openai.mdx. I kept the sentence verbatim because openrouter.mdx and together_ai.mdx both use the identical sentence and anchor, so changing it here alone would make this page the odd one out. Happy to fix just this page, or all three, whichever you prefer.

Add a Weave integration guide for Neon AI Gateway, an OpenAI-compatible
inference endpoint provided by Neon. Weave's existing OpenAI SDK
autopatching traces these calls, so the guide only changes `api_key` and
`base_url` on a standard `openai.OpenAI` client.

The page follows the structure of the sibling OpenRouter and Together AI
guides, and adds the two things that are specific to Neon: the gateway
host is per database branch rather than a single shared hostname, and the
catalog reports `pricing` as `null`, so traces show token counts without
cost.

Also add the page to the LLM Providers group in docs.json, between
mistral and nvidia_nim.
@mezotv
mezotv marked this pull request as ready for review July 26, 2026 18:13
@mezotv
mezotv requested a review from a team as a code owner July 26, 2026 18:13
mezotv added 2 commits August 11, 2026 14:54
`gpt-5-2-codex`, `gpt-5-1-codex-max` and `gpt-5-1-codex-mini` are not in
Neon's model catalog. The models served only through the Responses
endpoint are `gpt-5-3-codex` and `gpt-5-5-pro`.
…odels

The set of models Neon serves only through the Responses API changes as
models are added and retired, so a list written into this page goes stale
without anyone noticing. Point at the Endpoints column in Neon's model
catalog, which is the published source for it, and keep the current models
as an example rather than as the definition.
@mdlinville
mdlinville requested a balanced review from Copilot September 16, 2026 20:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Several Neon requirements and behaviors are outdated, and one internal link targets a nonexistent anchor.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds documentation for tracing Neon AI Gateway requests through Weave’s OpenAI SDK integration.

Changes:

  • Adds setup, tracing, branch attribution, and model guidance.
  • Adds the guide to Weave integration navigation.
File summaries
File Description
weave/guides/integrations/neon.mdx Adds the Neon AI Gateway guide.
docs.json Registers the guide in navigation.
Review details

Suppressed comments (2)

weave/guides/integrations/neon.mdx:90

  • This fragment does not exist in the OpenAI guide, so the link lands at the top of the page rather than the intended custom-functions section. Link to the actual Tracing custom functions heading.
While this is a basic example to get started, see the [OpenAI](/weave/guides/integrations/openai#track-your-own-ops) guide for more details on how to integrate Weave with your own functions for more complex use cases.

weave/guides/integrations/neon.mdx:88

  • Inference is no longer free during the beta. Neon's current billing documentation says requests consume prepaid credits, so this sentence gives users an incorrect cost expectation.
Neon does not return a cost field and reports `pricing` as `null` in `GET /v1/models`, so traces show token counts without cost. Inference is free during the beta.
  • Files reviewed: 2/2 changed files
  • Comments generated: 3
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread weave/guides/integrations/neon.mdx Outdated
Comment thread weave/guides/integrations/neon.mdx Outdated
Comment thread weave/guides/integrations/neon.mdx Outdated
mdlinville and others added 2 commits September 16, 2026 14:16
Update access requirements and clarify Weave project naming. Remove the stale response-shape warning and replace the outdated free-beta claim with current prepaid-credit guidance.

@mdlinville mdlinville left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, and sorry that it has taken a while to get to this. Here are some suggestions to keep the content from going out of date and to avoid re-documenting too many specifics of a third-party platform in the W&B docs.

[Neon AI Gateway](https://neon.com/docs/ai-gateway/overview) is an OpenAI-compatible inference endpoint provided by Neon. A single Neon credential reaches models from OpenAI, Google, Meta, Databricks, and Alibaba, with no provider API keys. Weave detects the OpenAI SDK, so existing OpenAI code works after changing the API key and base URL.

<Note>
Neon AI Gateway is in beta. It requires a paid Neon plan with prepaid credits and a project in AWS US East (Ohio) (`aws-us-east-2`) or AWS Europe (Frankfurt) (`aws-eu-central-1`).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Neon AI Gateway is in beta. It requires a paid Neon plan with prepaid credits and a project in AWS US East (Ohio) (`aws-us-east-2`) or AWS Europe (Frankfurt) (`aws-eu-central-1`).
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](https://neon.com/docs/ai-gateway/overview) for detailed requirements.

This will immediately go out of date, how about removing the specifics in favor of the Neon docs?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We just went GA so you were right. Ill rework this section!


## Trace a Neon AI Gateway call

Set `api_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 [User Settings](https://docs.wandb.ai/platform/app/settings-page/user-settings/#default-team) in the W&B Models documentation.

@mdlinville mdlinville Sep 17, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Set `api_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 [User Settings](https://docs.wandb.ai/platform/app/settings-page/user-settings/#default-team) in the W&B Models documentation.
Set `api_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](/platform/app/settings-page/user-settings/#default-team).

)
```

## Choosing a model

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Choosing a model
## Choose a model


## Choosing a model

Neon uses short model IDs, for example `gpt-5-mini`, `gemini-3-flash`, `llama-4-maverick`, and `qwen3-next-80b-a3b-instruct`. List what a branch can serve:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Neon uses short model IDs, for example `gpt-5-mini`, `gemini-3-flash`, `llama-4-maverick`, and `qwen3-next-80b-a3b-instruct`. List what a branch can serve:
Neon uses short model IDs like `gpt-5-mini`, `gemini-3-flash`, `llama-4-maverick`, and `qwen3-next-80b-a3b-instruct`. List what a branch can serve:

Neon uses short model IDs, for example `gpt-5-mini`, `gemini-3-flash`, `llama-4-maverick`, and `qwen3-next-80b-a3b-instruct`. List what a branch can serve:

```bash
curl "$NEON_AI_GATEWAY_BASE_URL/v1/models" \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
curl "$NEON_AI_GATEWAY_BASE_URL/v1/models" \
curl "${NEON_AI_GATEWAY_BASE_URL}/v1/models" \

This isn't a safe shell expansion mixed into the URL string like this.


Neon does not return a cost field and reports `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](https://neon.com/docs/ai-gateway/overview#pricing).

While this is a basic example to get started, see the [OpenAI](/weave/guides/integrations/openai#track-your-own-ops) guide for more details on how to integrate Weave with your own functions for more complex use cases.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
While this is a basic example to get started, see the [OpenAI](/weave/guides/integrations/openai#track-your-own-ops) guide for more details on how to integrate Weave with your own functions for more complex use cases.
See the [OpenAI integration guide](/weave/guides/integrations/openai#track-your-own-ops) for more details about integrating Weave with your own functions for more complex use cases.

---
title: "Neon AI Gateway"
description: "Trace calls to Neon AI Gateway, the OpenAI-compatible inference endpoint provided by Neon"
keywords: ["Neon", "Neon AI Gateway", "OpenAI SDK compatibility", "branch-scoped credentials"]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
keywords: ["Neon", "Neon AI Gateway", "OpenAI SDK compatibility", "branch-scoped credentials"]

We don't use keywords for SEO.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants