Gemini

Query Google Gemini via Wire — structured answers with grounding sources

POSThttps://api.anakin.io/v1/wire/task

Run a prompt against Gemini and get its answer with grounding sources and citations, plus multi-turn support via conversation_id. Run it with the gemini_prompt action on POST /v1/wire/task.

Catalog: gemini · action_id: gemini_prompt · Credits: 2 / call · Auth: none


Request Body

{
  "action_id": "gemini_prompt",
  "params": { "prompt": "best CRM for small teams", "country": "us" }
}
ParameterTypeDescription
action_id requiredstringSet to gemini_prompt
params.prompt requiredstringYour question or instruction for Gemini (up to 8192 chars)
params.countrystringRegion to send the request from (2-letter code). Default us
params.additional_promptstringOptional follow-up, asked in the same conversation
params.force_searchbooleanForce Gemini to search the web and cite sources for this prompt (boosts citation coverage). Default false
params.include_htmlbooleanAlso return the answer as HTML under answer_html. Default false

Code Examples

curl -X POST http://staging-alb-1217701800.ap-south-1.elb.amazonaws.com/v1/wire/task \
  -H "X-API-Key: your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "action_id": "gemini_prompt",
    "params": { "prompt": "best CRM for small teams", "country": "us" }
  }'

Response

202 Accepted
{ "status": "processing", "job_id": "…", "poll_url": "/v1/wire/jobs/…" }

Poll GET /v1/wire/jobs/{id} until status: "completed":

200 OK
{
  "status": "completed",
  "credits_used": 2,
  "execution_ms": 19948,
  "data": {
    "status": "ok",
    "data": {
      "answer_text": "…", "answer_text_markdown": "…",
      "citations": [
        { "url": "https://…", "title": "…", "domain": "…", "position": 1,
          "ref_type": "web", "description": "…", "result_source": "search", "cited": true }
      ],
      "citation_anchors": [
        { "cited_text": "…", "start_idx": 0, "end_idx": 42,
          "raw_start_idx": 0, "raw_end_idx": 42,
          "url": "https://example.com/page#:~:text=…",
          "page_url": "https://example.com/page", "domain": "example.com", "title": "…" }
      ],
      "sources": [{ "url": "https://…", "anchors": [] }], "search_sources": [],
      "conversation_id": "…", "response_id": "…",
      "related_media": [], "detected_location": "…", "language": "en",
      "tools_used": ["search"], "model": "gemini-…"
    },
    "meta": { "action_id": "gemini_prompt", "catalog_slug": "gemini", "envelope_version": "v1" }
  }
}
FieldTypeDescription
data.data.answer_textstringThe answer. answer_text_markdown is the same answer with a numbered link [[n]](url) after each cited span; answer_html is returned when include_html
data.data.additional_answer_textstringThe answer to additional_prompt, when you send one
data.data.answer_text_rawstringThe raw, unprocessed answer — keeps Gemini's inline citation-chip labels and placeholder tokens that answer_text strips out
data.data.citationsarrayGrounding sources — { url, title, domain, position, ref_type, description, result_source, cited }
data.data.recommendationsarrayRelated products or items the engine recommends alongside the answer
data.data.shoppingarrayShopping module for commercial-intent queries — products with titles, prices and links
data.data.related_mediaarrayImages or videos attached to the answer
data.data.citation_anchorsarrayWhere each source is cited in the answer body. One entry per cited span: cited_text, the character range in answer_text (start_idx/end_idx) and in answer_text_raw (raw_start_idx/raw_end_idx), and the source url (with a #:~:text= passage fragment where Gemini provides one). Each sources[] entry also carries its own matching anchors.
data.data.links_attachedarrayThe cited sources as a flat list in reading order: { url, text, position }
data.data.referencesarrayThe cited sources in { url, title, attribution, domain } shape
data.data.sourcesarraySource pages behind the answer (Gemini's own source list; distinct from citations)
data.data.search_sourcesarraySources Gemini considered during its web search (not necessarily cited)
data.data.web_search_triggeredbooleanWhether Gemini actually ran a web search for this answer
data.data.web_search_querystringThe search query Gemini ran
data.data.conversation_idstringReuse to continue the thread (multi-turn)
data.data.detected_locationstringHow Gemini localized the answer for country
data.data.tools_usedstring[]Tools Gemini invoked (e.g. search)
data.data.adsobjectReserved for sponsored results — Gemini serves none today, so this is always { name: null, url: null, favicon_url: null, carousel_cards: null }
data.data.response_rawstringGemini's raw response stream, verbatim. Not a stable contract — its format can change without notice; use the structured fields instead

citation_anchors, sources[].anchors, and the inline markdown links are empty on runs where Gemini doesn't search or cite (not every prompt grounds). response_raw, when present, is Google's raw stream — its format can change without notice, so use citation_anchors for placement rather than parsing it. Billed only on success.