HomeDocsGemini 2.5 Pro API
Chat APIs

Gemini 2.5 Pro API

Million-token context assistant with inline citations, multimodal understanding, and structured outputs for knowledge workflows. · Updated 2025-03-18

Overview

Gemini 2.5 Pro ingests up to one million tokens in a single request, enabling comprehensive summarisation, incident analysis, and knowledge base assistants. Cite sources automatically and blend text with tables, charts, or images.

Request Template

curl -X POST "https://api.transendai.net/v1/chat/gemini-2.5-pro" \
  -H "Authorization: Bearer $TRANSEND_API_KEY" \
  -H "Content-Type": "application/json" \
  -d '{
    "messages": [
      { "role": "system", "content": "You are a reliability analyst." },
      { "role": "user", "content": "Summarise the latest incident reports and list action items by service." }
    ],
    "documents": [
      { "type": "pdf", "url": "https://storage.example.com/incidents-q1.pdf" },
      { "type": "csv", "url": "https://storage.example.com/latency.csv" }
    ],
    "citations": true,
    "response_format": {
      "type": "json_schema",
      "schema": {
        "type": "object",
        "properties": {
          "summary": { "type": "string" },
          "services": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": { "type": "string" },
                "action_items": { "type": "array", "items": { "type": "string" } }
              },
              "required": ["name"]
            }
          }
        },
        "required": ["summary"]
      }
    }
  }'

Gemini downloads referenced documents, so ensure URLs are accessible and signed if private.

Response Payload

{
  "choices": [
    {
      "message": {
        "role": "assistant",
        "content": {
          "summary": "Service latency increased due to a misconfigured cache tier...",
          "services": [
            {
              "name": "payments",
              "action_items": [
                "Tune cache eviction strategy",
                "Expand synthetic monitoring to eu-central"
              ],
              "citations": [
                { "document": "incidents-q1.pdf", "page": 14 },
                { "document": "latency.csv", "row": 92 }
              ]
            }
          ]
        }
      }
    }
  ],
  "usage": { "prompt_tokens": 822000, "completion_tokens": 1600 }
}

Retrieval Augmentation

Combine Gemini with vector search:

  1. Generate embeddings using /embeddings/gemini-2.5.
  2. Store vectors in Pinecone, Weaviate, or a Transend-native index.
  3. Supply retrieved passages in the messages array before invoking the assistant.

Error Codes

CodeReasonResolution
400Invalid document type or schema.Supported types: pdf, docx, txt, csv, json.
413Exceeded 1M token window.Chunk documents or switch to retrieval mode.
424Document fetch failure.Ensure signed URLs remain valid for at least 15 minutes.

Tips

  • Request table reasoning via "enable_table_reasoning": true to improve analytics answers.
  • Use response_format to guarantee machine-readable summaries for dashboards.
  • Log citations to audit knowledge sources regularly.

Related Links