Base URL https://api.vantafold.ai. All requests are JSON over
HTTPS and require a bearer token. The API is versioned in the path; /v1 is
current and is supported until at least 2029.
Reason
Send an input to a model and get a response. This is the endpoint you will use most — it covers text, tool calling, structured output, and streaming.
Parameters
| Name | Type | Description |
|---|---|---|
modelrequired | string | A model name from the catalog, or "auto" to let the router choose. |
inputrequired | string | array | A prompt string, or an array of message objects with role and content. |
toolsoptional | array | Tool definitions the model may call. Normalised across providers. |
routingoptional | object | Routing policy: optimize, max_cost_usd, max_latency_ms, min_quality, fallback. |
response_formatoptional | object | Set {"type": "json_schema"} with a schema to constrain output. |
streamoptional | boolean | Return server-sent events instead of a single response. Defaults to false. |
metadataoptional | object | Arbitrary key-value tags recorded on the trace and available for cost attribution. |
cacheoptional | boolean | Prompt prefix caching. Defaults to true. |
Request
response = client.reason(
model="auto",
input=[{"role": "user", "content": "Reconcile these two ledgers."}],
tools=[ledger_lookup],
routing={"optimize": "quality", "max_latency_ms": 4000},
metadata={"project": "billing-agent"},
)
const response = await client.reason({
model: "auto",
input: [{ role: "user", content: "Reconcile these two ledgers." }],
tools: [ledgerLookup],
routing: { optimize: "quality", max_latency_ms: 4000 },
metadata: { project: "billing-agent" },
});
curl https://api.vantafold.ai/v1/reason \
-H "Authorization: Bearer $VANTAFOLD_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "auto",
"input": [{ "role": "user", "content": "Reconcile these two ledgers." }],
"routing": { "optimize": "quality", "max_latency_ms": 4000 },
"metadata": { "project": "billing-agent" }
}'
Response
{
"id": "req_8f2c41a9",
"object": "reason.response",
"model": "frontier-lg",
"output_text": "The 4,120.00 variance is a timing difference...",
"tool_calls": [
{ "name": "ledger_lookup", "arguments": { "period": "2026-07" }, "duration_ms": 402 }
],
"usage": {
"input_tokens": 4210, "cached_input_tokens": 3800,
"output_tokens": 186, "cost_usd": 0.0154
},
"route": {
"requested": "auto", "selected": "frontier-lg", "attempts": 1,
"reason": "quality objective; tools required"
},
"trace_id": "tr_5b1d9e0c",
"created_at": "2026-08-19T09:14:22Z"
}
Embeddings
Turn text into vectors. Batches of up to 2,048 inputs per request.
Parameters
| Name | Type | Description |
|---|---|---|
modelrequired | string | An embedding model from the catalog. |
inputrequired | string | array | One string, or an array of up to 2,048 strings. |
dimensionsoptional | integer | Truncate output vectors to this many dimensions. |
metadataoptional | object | Tags recorded on the trace. |
Request
vectors = client.embed(
model="embed-3-large",
input=["net 30 from invoice date", "payable within thirty days"],
)
print(len(vectors.data), vectors.usage.input_tokens)
const vectors = await client.embed({
model: "embed-3-large",
input: ["net 30 from invoice date", "payable within thirty days"],
});
console.log(vectors.data.length, vectors.usage.input_tokens);
curl https://api.vantafold.ai/v1/embeddings \
-H "Authorization: Bearer $VANTAFOLD_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "model": "embed-3-large", "input": ["net 30 from invoice date"] }'
Response
{
"object": "list",
"model": "embed-3-large",
"data": [
{ "index": 0, "embedding": [0.0142, -0.0311, 0.0087, "..."] },
{ "index": 1, "embedding": [0.0138, -0.0294, 0.0091, "..."] }
],
"usage": { "input_tokens": 14, "cost_usd": 0.0000003 },
"trace_id": "tr_9c02fa17"
}
List models
Every model available to your account, with context windows, capabilities, and current rates. Filterable, and safe to cache for an hour.
Parameters
| Name | Type | Description |
|---|---|---|
capabilityoptional | string | Filter by tools, vision, json, or embed. |
provideroptional | string | Filter by provider slug. |
max_input_priceoptional | number | Maximum USD per 1M input tokens. |
limitoptional | integer | Page size, 1–200. Defaults to 50. |
Request
curl "https://api.vantafold.ai/v1/models?capability=tools&max_input_price=1.0" \
-H "Authorization: Bearer $VANTAFOLD_API_KEY"
Response
{
"object": "list",
"data": [
{
"id": "oss-70b-instruct",
"provider": "open-weights",
"context_window": 128000,
"capabilities": ["tools", "json", "stream"],
"price_per_1m": { "input": 0.35, "output": 0.90 },
"status": "available"
}
],
"has_more": true
}
Get trace
Retrieve the full trace for a request: every span, the routing decision, token counts, and cost. Retention follows your plan.
Parameters
| Name | Type | Description |
|---|---|---|
trace_idrequired | string | The trace_id returned with the response. |
include_payloadsoptional | boolean | Include prompt and completion text. Ignored in zero-retention mode. |
Request
curl https://api.vantafold.ai/v1/traces/tr_5b1d9e0c \
-H "Authorization: Bearer $VANTAFOLD_API_KEY"
Response
{
"trace_id": "tr_5b1d9e0c",
"duration_ms": 1284,
"status": "completed",
"route": { "requested": "auto", "selected": "frontier-lg", "attempts": 1 },
"usage": { "input_tokens": 4210, "output_tokens": 186, "cost_usd": 0.0154 },
"spans": [
{ "name": "gateway.auth", "start_ms": 4, "duration_ms": 8 },
{ "name": "router.select", "start_ms": 12, "duration_ms": 31 },
{ "name": "model.frontier-lg", "start_ms": 46, "duration_ms": 1180 },
{ "name": "tool.ledger_lookup", "start_ms": 214, "duration_ms": 402 }
]
}
Usage
Aggregated spend and token counts for a period, grouped by model, project, or any tag you send. This is the endpoint behind the dashboard, and the numbers match your invoice.
curl "https://api.vantafold.ai/v1/usage?start=2026-08-01&end=2026-08-19&group_by=model" \
-H "Authorization: Bearer $VANTAFOLD_API_KEY"
Conventions
Authentication
Send Authorization: Bearer <key> on every request. Keys are scoped to a
project and may be restricted to specific models or a spend ceiling.
Errors
Errors return a JSON body with a stable code, a human message,
and, where relevant, the attempts the router made.
{
"error": {
"code": "all_routes_degraded",
"message": "Every model in the fallback chain failed.",
"attempts": [
{ "model": "frontier-lg", "status": 529, "duration_ms": 1240 },
{ "model": "reason-pro", "status": 500, "duration_ms": 980 }
],
"trace_id": "tr_44a1c8de"
}
}
Versioning
Breaking changes ship behind a new path version and are announced in the
changelog with a 12-month deprecation window. Additive changes —
new fields, new models, new event types — can appear in /v1 at any time, so
parse defensively and ignore unknown fields.