base_url and a model — no SDK swap, no new client — and get answers grounded in real-time, trusted data alongside the Tako cards and citations that back them.
This is a wire-compatible gateway over Answer and the two Agent products, not a chat model. A
tako-answer request is a stateless, single-shot query. The agents run deep research: tako-retrieval-agent returns a data-first listing with cards, and tako-answer-agent returns a synthesized, cited answer. On the Responses API, both agents support stateful follow-ups. A few OpenAI behaviors do not carry over — see Compatibility.Overview
Set two things on your OpenAI client:base_url→https://tako.com/api/openai/v1api_key→ your Tako API key (sent as theAuthorization: Bearerheader)
model:
- Python
- cURL
Choosing sources
By default the gateway grounds answers in both Tako’s curated knowledge and the live web. Passsource_indexes to restrict that — an array containing "data", "web", or both. It applies to both APIs and both models. Since it isn’t a native OpenAI field, pass it through extra_body with the SDK (or as a top-level field in a raw request).
"data" and "web". The legacy value "tako" is accepted as a synonym for "data". The list must be non-empty — an empty or invalid list returns 400. On the Responses API, pass source_indexes the same way.
Chat Completions
Answer
tako-answer returns a synthesized answer in one synchronous call — the OpenAI equivalent of Answer. The prose lands in message.content; the Tako cards and citations that back it ride a namespaced tako extension on the message.
Example response
Example response
A standard
chat.completion. The answer is in choices[0].message.content; the backing cards and citations are in choices[0].message.tako.Agents
Which agent?
tako-retrieval-agent returns a data-first listing of the values it found, plus the visualization cards. tako-answer-agent synthesizes everything into a written answer with [n] citation markers. Both run deep research and can take minutes — prefer streaming. A non-streaming call holds the connection open until the run finishes, and returns 504 (run_timeout, carrying the run_id) if the run overruns ~290 seconds.Retrieval Agent
tako-retrieval-agent runs the Retrieval Agent: multi-step retrieval that returns a data-first listing plus the visualization cards.
Answer Agent
tako-answer-agent runs the Answer Agent: deep research synthesized into a written, citation-backed answer.
Streaming
Setstream=True to receive the answer as it is produced — recommended for the agents. The text arrives in delta.content chunks; the Tako cards and citations arrive in a single dedicated delta.tako chunk near the end of the stream.
stream_options={"include_usage": True} to emit a final usage frame before [DONE] (its values are zero — see below).
If a run fails mid-stream, the gateway emits an error chunk and closes the stream without a
[DONE] marker. Treat a stream that ends without [DONE] as a failed run.Responses API
OpenAI’s Responses API is the newer, event-based interface —POST /responses. Same models, auth, and tako extension; the differences are the request field (input instead of messages), the response shape (an output array), and — for the agents — stateful follow-ups, background runs, and a richer streaming event set.
input accepts either a plain string or the OpenAI items array; Tako uses the last user turn as the query. instructions is accepted but not applied.
Answer
tako-answer is synchronous — one request, one grounded answer. The text is in output[].content[].text (the SDK aggregates it into response.output_text); cards and citations ride the top-level response.tako.
Example response
Example response
A standard
response object. The text is in output[0].content[0].text; the backing cards and citations are in the top-level tako key.Agents
Both agents run deep research, which can take minutes. You have three ways to run each:- Stream it (
stream=True) — recommended; see streaming events below. - Run it in the background (
background=True) and pollGET /responses/{id}. - Call it synchronously — Tako drains the run inline and returns
504(run_timeout, carrying the response id) past ~290 seconds.
previous_response_id to continue the thread. A follow-up stays on the product that started the thread — continuing a tako-retrieval-agent thread with tako-answer-agent (or the reverse) returns 409. Both previous_response_id and background are rejected with 400 for tako-answer.
Retrieving a response
GET /responses/{id} fetches a stored agent response — useful for polling a background run (answers are stateless and are not stored, so only agent ids are retrievable; access is owner-scoped). Add stream=true (or an SSE Accept header) to replay the run’s event stream from the start.
Python
Streaming events
The Responses stream uses named SSE events and — unlike Chat Completions — has no[DONE] sentinel. Terminate on response.completed or response.failed. Answer text arrives in response.output_text.delta events; agent narration streams first as response.reasoning_summary_text.delta events. The Tako cards and citations arrive once, on the final response.completed event (in response.tako) — they are not streamed incrementally.
The event order is
response.created → response.output_item.added → response.content_part.added → response.output_text.delta (repeated) → response.output_text.done → response.content_part.done → response.output_item.done → response.completed. A failed run emits a single response.failed event (carrying error) and no response.completed.The tako extension
Tako’s value-add — the cards (interactive charts with their underlying data), the citations (the unified registry of web and data sources that back the answer), and the request_id — rides on a namespaced tako object, never inside the text:
- Chat Completions:
choices[0].message.tako(non-streaming), or a dedicatedchoices[0].delta.takochunk (streaming). - Responses: the top-level
response.tako(non-streaming), or theresponse.completedevent’sresponse.tako(streaming).
tako is available with no custom client. Each card carries title, description, embed_url, image_url, webpage_url, and sources — everything you need to embed the interactive chart or cite the data. See Knowledge Cards.
Each citations entry carries index, title, source_index (data or web), and — for web sources — url, source_name, excerpt, and publish_date. The [n] markers in the answer text join this registry by index. A data-only answer may return an empty citations array (its data rides the card).
Listing models
GET /models lists the available Tako models:
Compatibility
The gateway maps OpenAI’s APIs onto Tako’s query pipeline, so a few OpenAI behaviors don’t carry over:- Chat Completions is single-shot and stateless. Only the last
usermessage becomes the Tako query; system messages and prior turns are ignored. For stateful, multi-turn agent conversations, use the Responses API (previous_response_id, agents only) or the native Agent API. source_indexesis respected — see Choosing sources. Other request knobs are accepted for SDK compatibility and ignored:temperature,top_p,tools,tool_choice,response_format, and (on Responses)instructionsandstore.n > 1is rejected.- No structured output over this wire.
response_formatis ignored, and the Retrieval Agent’soutput_schemais not available through the gateway. For machine-usable structured data, use the native Retrieval Agent API. usageis always zero. Tako bills per request, not per token — see pricing.- The Responses stream has no
[DONE]marker. Terminate onresponse.completedorresponse.failed.