Skip to main content
POST
Ask
/v1/ask is the highest-level endpoint: retrieve context + generate an answer + return citations in one round-trip. Use it when you want the simplest possible integration. Use /v1/context if you want to bring your own prompt or LLM.

Required action

ask

Cost

1 credit per call. Note: /v1/ask also incurs OpenAI completion costs (passed through transparently — credits cover both retrieval and the generation token cost in your tier’s bundle).

Body

Same as /v1/search:
string
required
The user-facing question.
integer
default:"8"
How many context hits to feed the LLM. Min 1, max 25.

Response

string
Echo of the input query.
string
LLM-generated answer, cited inline as [N]. When OpenAI is unavailable Repo falls back to a deterministic synthesis from the top hits.
array
Numbered list mapping [N] markers to source items. See Citations.
array
The retrieved hits the LLM saw. Includes provider, URL, and score. Useful for your UI to render source previews next to the answer.

Example

Behavior when retrieval is empty

If no hits match the query (within the calling key’s scope), Repo returns an answer like:
…and citations + context are empty arrays. Your agent should treat this as “no grounded answer available” and either re-prompt the user, try a broader query, or fall back to its own knowledge with a disclaimer.

When to use this vs /v1/context