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 web results that back them.
| Endpoint | OpenAI interface | Models | Use case |
|---|---|---|---|
/chat/completions | Chat Completions API | tako-answer, tako-agent | Single-shot, stateless requests. |
/responses | Responses API | tako-answer, tako-agent | Event-based; supports stateful tako-agent follow-ups. |
This is a wire-compatible gateway over Answer and the Agent, not a chat model. A
tako-answer request is a stateless, single-shot query; tako-agent runs deep research and, on the Responses API, supports stateful follow-ups. A few OpenAI behaviors don’t 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 web results 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 web results are in choices[0].message.tako.Agent
tako-agent runs the Agent: deep research over Tako’s curated knowledge and the live web. A run can take minutes, so prefer streaming. A non-streaming call works too, but Tako holds the connection open until the run finishes — and returns 504 (run_timeout, carrying the run_id) if the run overruns ~290 seconds.
Streaming
Setstream=True to receive the answer as it’s produced — recommended for tako-agent. The text arrives in delta.content chunks; the Tako cards and web results 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 tako-agent — 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 web results 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 web results are in the top-level tako key.Agent
tako-agent runs deep research, which can take minutes. You have three ways to run it:
- 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.
tako-agent responses are stateful: pass a prior response’s id as previous_response_id to continue the thread. (Both previous_response_id and background are rejected with 400 for tako-answer.)
Retrieving a response
GET /responses/{id} fetches a stored tako-agent response — useful for polling a background run (answers are stateless and aren’t 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; tako-agent narration streams first as response.reasoning_summary_text.delta events. The Tako cards and web results 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 web results, 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.
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,tako-agentonly) 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.usageis always zero. Tako bills per request, not per token — see pricing.- The Responses stream has no
[DONE]marker. Terminate onresponse.completedorresponse.failed.