{"openapi":"3.1.0","info":{"title":"N-gram API","version":"1.0.0","description":"Generate n-grams from text, with frequency counts — entirely locally. The ngrams endpoint breaks text into contiguous sequences of n tokens and returns each distinct n-gram with how often it occurs, ranked by frequency: word n-grams (unigrams, bigrams, trigrams and beyond) for phrase and collocation analysis, or character n-grams (shingles) for fuzzy matching, language detection and indexing. The range endpoint produces every size from a minimum to a maximum in a single call (for example 1–3 grams), which is exactly what you need to build feature vectors. Choose word or character mode, whether to lower-case first, and a top-N limit to keep only the most frequent. Word tokenization is Unicode-aware and keeps internal apostrophes and hyphens (don't, well-known) as single tokens. Everything runs locally and deterministically, so it is fast and private. Ideal for text mining and NLP feature extraction, language modelling and autocomplete, search indexing and shingling, plagiarism and similarity detection, and keyword and collocation analysis. Pure local computation — no key, no third-party service, instant. Live, nothing stored. 3 endpoints. This produces n-grams and counts; for extractive summaries and keywords use a summarize API and for grapheme/character counting use a text-segmentation API.","contact":{"name":"PremiumApi","url":"https://www.oanor.com/by/premiumapi"}},"servers":[{"url":"https://api.oanor.com/ngram-api","description":"oanor gateway"}],"tags":[{"name":"N-gram"},{"name":"Meta"}],"components":{"securitySchemes":{"oanorKey":{"type":"apiKey","in":"header","name":"x-oanor-key","description":"Get your key at https://www.oanor.com/developer/keys"}}},"security":[{"oanorKey":[]}],"paths":{"/v1/ngrams":{"get":{"operationId":"get_v1_ngrams","tags":["N-gram"],"summary":"Generate n-grams","description":"","parameters":[{"name":"text","in":"query","required":true,"description":"The text","schema":{"type":"string"},"example":"the cat sat on the cat"},{"name":"n","in":"query","required":false,"description":"The n-gram size (default 2)","schema":{"type":"string"},"example":"2"},{"name":"mode","in":"query","required":false,"description":"'word' (default) or 'char'","schema":{"type":"string"}},{"name":"lowercase","in":"query","required":false,"description":"lower-case first (default true)","schema":{"type":"string"}},{"name":"top","in":"query","required":false,"description":"keep only the N most frequent","schema":{"type":"string"}}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"n":2,"mode":"word","total":5,"ngrams":[{"gram":"the cat","count":2},{"gram":"cat sat","count":1},{"gram":"sat on","count":1},{"gram":"on the","count":1}],"unique":4,"token_count":6},"meta":{"timestamp":"2026-06-03T09:25:03.312Z","request_id":"91f9306e-c691-4cd4-86d2-e61215ff944b"},"status":"ok","message":"Generate n-grams","success":true}}}},"401":{"description":"Missing or invalid x-oanor-key header"},"402":{"description":"Active subscription required"},"429":{"description":"Rate-limit or monthly quota reached"},"502":{"description":"Upstream did not respond"}}}},"/v1/range":{"get":{"operationId":"get_v1_range","tags":["N-gram"],"summary":"N-grams for a range of sizes","description":"","parameters":[{"name":"text","in":"query","required":true,"description":"The text","schema":{"type":"string"},"example":"one two three four"},{"name":"min","in":"query","required":false,"description":"Smallest size (default 1)","schema":{"type":"string"},"example":"1"},{"name":"max","in":"query","required":false,"description":"Largest size (default 3)","schema":{"type":"string"},"example":"3"},{"name":"mode","in":"query","required":false,"description":"'word' or 'char'","schema":{"type":"string"}},{"name":"lowercase","in":"query","required":false,"description":"default true","schema":{"type":"string"}},{"name":"top","in":"query","required":false,"description":"top-N per size","schema":{"type":"string"}}],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"max":3,"min":1,"mode":"word","sizes":{"1":{"total":4,"ngrams":[{"gram":"one","count":1},{"gram":"two","count":1},{"gram":"three","count":1},{"gram":"four","count":1}],"unique":4},"2":{"total":3,"ngrams":[{"gram":"one two","count":1},{"gram":"two three","count":1},{"gram":"three four","count":1}],"unique":3},"3":{"total":2,"ngrams":[{"gram":"one two three","count":1},{"gram":"two three four","count":1}],"unique":2}},"token_count":4},"meta":{"timestamp":"2026-06-03T09:25:03.385Z","request_id":"9d1d4d2d-528a-4f77-9e3b-be539a5658cb"},"status":"ok","message":"N-grams for a range of sizes","success":true}}}},"401":{"description":"Missing or invalid x-oanor-key header"},"402":{"description":"Active subscription required"},"429":{"description":"Rate-limit or monthly quota reached"},"502":{"description":"Upstream did not respond"}}}},"/v1/meta":{"get":{"operationId":"get_v1_meta","tags":["Meta"],"summary":"Spec","description":"","parameters":[],"security":[{"oanorKey":[]}],"responses":{"200":{"description":"OK","content":{"application/json":{"example":{"data":{"name":"N-gram API","notes":"Word mode joins tokens with a space; character mode uses Unicode code points with no separator. Ties in frequency are ordered by first appearance. Ideal for text mining, language modelling, autocomplete, plagiarism and similarity features. Nothing is stored.","version":"v1","endpoints":[{"path":"/v1/ngrams","params":{"n":"the n-gram size (default 2)","top":"keep only the N most frequent (default all)","mode":"'word' (default) or 'char'","text":"the text (required)","lowercase":"lower-case first (default true)"},"returns":"the ranked n-grams with counts"},{"path":"/v1/range","params":{"max":"largest size (default 3)","min":"smallest size (default 1)","top":"top-N per size","mode":"'word' or 'char'","text":"the text (required)","lowercase":"default true"},"returns":"n-grams grouped by size"},{"path":"/v1/meta","params":[],"returns":"this document"}],"description":"Generate n-grams from text, with frequency counts. The ngrams endpoint breaks text into contiguous sequences of n tokens — word n-grams (unigrams, bigrams, trigrams…) or character n-grams (shingles) — and returns each distinct n-gram with how often it occurs, ranked by frequency. The range endpoint produces every size from min to max in one call (e.g. 1–3 grams) for feature extraction. Choose word or character mode, lower-casing, and a top-N limit. Word tokenization is Unicode-aware and keeps internal apostrophes and hyphens. Pure local, no key."},"meta":{"timestamp":"2026-06-03T09:25:03.475Z","request_id":"a8546a2b-0746-40f8-8b51-9b7f79235492"},"status":"ok","message":"Meta","success":true}}}},"401":{"description":"Missing or invalid x-oanor-key header"},"402":{"description":"Active subscription required"},"429":{"description":"Rate-limit or monthly quota reached"},"502":{"description":"Upstream did not respond"}}}}},"x-oanor-pricing":[{"slug":"free","name":"Free","price_cents_month":0,"monthly_call_quota":2635,"rps_limit":2,"hard_limit":true},{"slug":"starter","name":"Starter","price_cents_month":415,"monthly_call_quota":12150,"rps_limit":8,"hard_limit":true},{"slug":"pro","name":"Pro","price_cents_month":2405,"monthly_call_quota":172500,"rps_limit":20,"hard_limit":true},{"slug":"mega","name":"Mega","price_cents_month":6205,"monthly_call_quota":905000,"rps_limit":50,"hard_limit":true}],"x-oanor-marketplace-url":"https://www.oanor.com/api/ngram-api"}