All bundles Agent Tools bundle · 8 endpoints

Agent Tools

8 offline utilities AI agents call on every turn — token counting, RAG chunking, JSON repair & validation, fuzzy matching, language detection, date parsing, and diffing. No model to host, no extra vendor.

For AI agent builders and RAG pipelines that want fast, deterministic text and JSON utilities behind the same Bearer token — instead of bundling six libraries into every agent.

Endpoints in this bundle

Each endpoint is independently callable. Bundle membership is for discovery only — you do not need to opt in.

Method Path Credits Summary
POST /v1/tokens/count 0 Count tokens (and characters) for any string under a tiktoken encoding — estimate prompt cost before you call a model. Free.
POST /v1/text/chunk 1 Token-aware text splitting for RAG ingestion: sliding windows of N tokens with optional overlap, decoded back to text.
POST /v1/json/repair 1 Repair malformed JSON from an LLM — trailing commas, single quotes, missing brackets, markdown fences — into a valid object.
POST /v1/json/validate 1 Validate data against a JSON Schema and get every error, or omit the schema to infer one from the data.
POST /v1/text/similarity 1 Fuzzy string similarity (0–100): pairwise scores, or rank a list of candidates against a query, best first.
POST /v1/lang/detect 1 Detect the dominant language of a string with a confidence score — offline, no network.
POST /v1/datetime/parse 1 Parse a natural-language or messy date ("next tuesday", "3 days ago") into ISO-8601 plus a Unix timestamp.
POST /v1/text/diff 1 Diff two strings (unified or ndiff) with a similarity score — verify an agents edit before applying it.
Recipe

Prep and verify an agents text I/O

  1. Before calling a model, size the prompt with /v1/tokens/count and split long context into clean RAG windows with /v1/text/chunk.
  2. Detect the input language with /v1/lang/detect and normalize any dates with /v1/datetime/parse.
  3. When the model returns JSON, fix it with /v1/json/repair, then enforce your contract with /v1/json/validate.
  4. Match or dedupe candidate strings with /v1/text/similarity, and confirm an edit with /v1/text/diff before you write it back.
Sample code

Try a request

Pick a language. Click to expand the snippet.

curl
curl -X POST https://api.ollagraph.com/v1/json/repair \n  -H "Authorization: Bearer $OLLAGRAPH_API_KEY" \n  -H "Content-Type: application/json" \n  -d "{\"text\":\"{\\\"name\\\":\\\"Ada\\\",\\\"skills\\\":[\\\"math\\\",]}\"}"
python
import httpx, os

r = httpx.post(
    "https://api.ollagraph.com/v1/json/repair",
    headers={"Authorization": f"Bearer {os.environ['OLLAGRAPH_API_KEY']}"},
    json={"text": '{"name":"Ada","skills":["math",]}'},
    timeout=30.0,
)
print(r.json())
node
const res = await fetch("https://api.ollagraph.com/v1/json/repair", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.OLLAGRAPH_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ text: '{"name":"Ada","skills":["math",]}' }),
});
console.log(await res.json());
FAQ

Agent Tools bundle FAQ

Do these call out to any model or external service?

No. They run in-process on the API, fully offline — no model weights, no network, no GPU. The value is one Bearer token and one bill for utilities your agent would otherwise vendor or self-host.

Why is /v1/tokens/count free?

Token counting is something every agent does constantly and costs us almost nothing, so we leave it uncharged. The other seven utilities are 1 credit each.

Which tokenizer does counting and chunking use?

tiktoken’s cl100k_base by default (the OpenAI family, so boundaries match what your model sees). Pass an encoding such as o200k_base to switch.

Ship with the Agent Tools bundle.

1,000 credits on signup. No card. Every endpoint in this bundle is live from minute one.