Sources in AI-generated responses are only useful when you can see exactly what they support. The LLM Responses API from the AI Optimization API suite now makes that connection clearer by adding text-level source annotations for the ChatGPT and Gemini platforms.
What’s new
The LLM Responses API now provides more detailed source annotations for the ChatGPT and Gemini platforms across both the POST and Live endpoints. Each annotation identifies the exact part of the generated response associated with a quoted source with three new fields in the annotations array:
start_index– indicates where the annotated segment starts in the response.end_index– indicates where the annotated segment ends in the response.text– contains the annotated part of the response associated with the source.
How it works
The annotations array contains source references used to generate the response. Please note that it returns null when the web_search parameter is not set to true. It may also return an empty array when web_search is enabled in cases when the AI model attempted to retrieve information from the web but did not find relevant sources.
For Gemini, we also updated the data extraction logic for the annotations array. Previously, annotations were built from groundingChunks element, resulting in a list of unique URLs used for search grounding. Now, they are built from groundingSupports. For each supported response segment, the API retrieves its start_index, end_index, and text, and then adds the corresponding source URLs and titles based on groundingChunkIndices.
As a result, the annotations array may now contain duplicate source URLs and titles. This occurs when multiple sources support the same response segment or when the same source supports multiple segments of the response.
Why it matters
Previously, annotations primarily showed which sources were used to ground the AI model’s response. The new fields provide a more precise connection between each source and the specific text part it supports.
You can use this data to:
- highlight cited parts of an AI response;
- display inline source references;
- map individual claims to their supporting sources;
- build more transparent response-verification and citation interfaces.
Check out the updated LLM Responses API documentation to start working with the extended annotations structure.