Capabilities
Citations
Inline source attribution for generated text
Read this when
- Building features that need verifiable sources
- Surfacing search-grounded results
Citations attach source metadata (document, page, character range, URL) to spans of generated text. Useful for RAG over uploaded files, web-search grounding, and audit trails.
Compatibility
| Provider | API | pi-go | Notes |
|---|---|---|---|
| Anthropic | ✅ Citations API (citations: {enabled: true} on documents) | ⚠️ | document-level Citations API not wired; web_search results surface as a numbered title/URL list on ServerToolOutput (anthropic.go, see server-tools.md) |
| OpenAI Chat | ❌ | — | |
| OpenAI Responses | ✅ inline citations from web/file search | ⚠️ | web-search action description on ServerToolOutput.Content; full provider JSON retained on Output.Raw (openairesponses.go). No dedicated citation content type yet |
| OpenRouter (Responses dialect) | ✅ response.output_text.annotation.added events with url_citation payloads | ❌ | events are streamed but ignored — citations are not currently attached to ai.Text spans or to the preceding server-tool call |
| Google Gemini | ✅ groundingMetadata from grounded searches | ⚠️ | parsed into a synthesized web_search ToolCall; chunks rendered on Output.Content, full metadata on Output.Raw (google.go) |
| Claude CLI | ⚠️ surfaced in CLI output | ❌ | not parsed |
Provider Documentation
pi-go Gaps
- No
Citationcontent type or sub-block onai.Text. Search-grounded citations currently live as text + raw JSON insideServerToolOutput, not as structured spans tied to assistant text. - No way to opt-in citations on document inputs (Anthropic’s
citations: {enabled}flag). - No anchoring of citation chunks to the assistant text spans they support — Gemini’s
groundingSupportsindices are present inOutput.Rawbut not promoted to a typed structure. - Citations interact with Server-Side Tools and File Search — the
ServerToolOutput.Rawescape hatch is shared across all of them.