Languages

How do you build Persian AI apps with Plugsky?

Plugsky treats Persian as UTF-8 text on the OpenAI-compatible endpoint: set base_url to https://api.plugsky.com/v1 and send prompts to /v1/chat/completions. ZWNJ, homophone letters and digit variants cause most retrieval errors, so normalise them for search while keeping display text intact, and use plugsky-embed-multilingual for Persian and English RAG.

Key facts

Persian scriptRight-to-left Perso-Arabic script with ZWNJ half-spaces
TokenisationZWNJ-joined affixes and letter variants fragment tokens — measure with the Plugsky token calculator
NormalisationUnify homophone letters and digits for search; keep display text original
API compatibilityOpenAI-compatible POST https://api.plugsky.com/v1/chat/completions — chat, streaming, JSON mode and function calling
Models30+ models behind one endpoint, from free tiers to frontier reasoning
Free tierFree plan with plugsky-micro and plugsky-lite, no card required
DeploymentPlugsky cloud, your VPC, on-prem and air-gapped options
Product statusChat, streaming, JSON mode, function calling, embeddings, RAG and agents live; audio, images, batch and fine-tuning coming soon

TL;DR

  • Persian runs on the standard endpoint — no special language mode.
  • Normalise ZWNJ and homophone spellings before indexing.
  • Standardise digits across prompts and queries.
  • Separate formal and colloquial Persian in evals.
  • plugsky-embed-multilingual covers Persian and English retrieval.

How it works, step by step

  1. Create a Plugsky API key on the free plan (no card) and set base_url to https://api.plugsky.com/v1.
  2. Send a small set of real Persian prompts to /v1/chat/completions and compare output across two or three models.
  3. Count tokens for those prompts with the Plugsky token calculator and set chunk sizes that fit your model context.
  4. Normalise text before indexing or prompting: normalise ZWNJ, unify homophone letters and standardise digits.
  5. For RAG, embed with plugsky-embed-multilingual and test cross-language queries alongside Persian-only queries.
  6. Score candidate models on a Persian gold set with native-speaker review, then cut production traffic over.
1Create a PlugskyAPI key on the freeplan (no card) and2Send a small set ofreal Persianprompts to3Count tokens forthose prompts withthe Plugsky token4Normalise textbefore indexing orprompting:5For RAG, embed withplugsky-embed-multilingualand test6Score candidatemodels on a Persiangold set with

Try it yourself

Open the RAG sandbox →

How Plugsky handles Persian text

Persian is written right-to-left in a Perso-Arabic script with four extra letters, and uses the zero-width non-joiner (نیمفاصله) to separate prefixes and suffixes.

Formal written Persian and colloquial Tehrani speech differ substantially, Arabic loanwords coexist with native equivalents, and Persian and Arabic-Indic digits are both used.

Evaluate on formal and colloquial Persian samples; check ZWNJ usage, letter choices and digit style, because inconsistent normalisation is the most visible error.

Tokenisation and cost in Persian

Persian prefixes and suffixes often attach with a ZWNJ, which tokenisers treat inconsistently; homophone letters (س/ص/ث, ز/ذ/ض/ظ) and optional Arabic diacritics add further variance.

  • Normalise ZWNJ and letter variants for retrieval; keep display text intact.
  • Standardise on Persian or Arabic-Indic digits per product.
  • Test formal and colloquial registers separately.
  • Strip Arabic diacritics unless they carry meaning.

Persian retrieval and RAG

Persian retrieval depends on normalisation: unify ZWNJ and homophone spellings for search, keep original text for display, and test cross-language queries with English.

  • Use plugsky-embed-multilingual for Persian and English retrieval.
  • Normalise ZWNJ, letter variants and digits before embedding.
  • Store a display copy and a normalised search copy.
  • Evaluate colloquial and formal queries separately.

Code example: a Persian request

Point your existing OpenAI client at https://api.plugsky.com/v1 and pass Persian text in the content field — no language flag and no separate endpoint. Streaming, JSON mode and function calling keep the same request shapes.

client = OpenAI(base_url="https://api.plugsky.com/v1", api_key=os.environ["PLUGSKY_API_KEY"])

client.chat.completions.create(model="plugsky-pro", messages=[{"role": "user", "content": "این قرارداد را در سه بند به فارسی خلاصه کن."}])

Start on the free plan with plugsky-micro and plugsky-lite, then compare paid models on a Persian gold set before cutover. See the docs for request details.

For production, log the model name and your normalisation settings with each request, and re-run the Persian gold set whenever either changes — language quality regressions usually come from prompt or preprocessing drift, not from the model alone.

Honest comparison

CapabilityPlugskyPersian workflow todayBuilding in-house
API compatibilityOpenAI-compatible — change base_url and model nameVaries by provider and SDKFull rewrite
Persian text handlingZWNJ and letter-variant normalisation for retrievalDepends on provider tokeniser and prompt hygieneYou build normalisation, segmentation and evals
Token budgetFixed tokeniser per model; measure with the Plugsky token calculator and chunk to fitVaries by provider and modelYou host and tune each tokeniser
Multilingual retrievalplugsky-embed-multilingual available for cross-language RAGOften needs a separate embedding vendorYou serve and maintain embeddings
SovereigntyCloud, VPC, on-prem and air-gapped with residency optionsUsually US/EU public endpointsYou own the full stack

Frequently asked questions

Can Plugsky handle Persian text?

Yes. The API accepts UTF-8 Persian input on the OpenAI-compatible chat endpoint; output quality depends on the model, so compare two or three on your own prompts before choosing.

How do I estimate token usage for Persian?

Persian prefixes and suffixes often attach with a ZWNJ, which tokenisers treat inconsistently; homophone letters (س/ص/ث, ز/ذ/ض/ظ) and optional Arabic diacritics add further variance. Use the token calculator at /tools/llm-token-calculator before sizing context windows or chunk lengths.

Formal Persian or colloquial?

Formal written Persian suits contracts and public content; colloquial Tehrani suits chat. State the register in the system prompt to keep output consistent.

How do I handle ZWNJ?

Normalise half-spaces consistently for search and embeddings, and keep the original form for display. Inconsistent ZWNJ is a common retrieval failure.

Is there a multilingual embedding model?

Yes — plugsky-embed-multilingual is part of the 30+ model catalogue and is built for cross-language retrieval. Keep one embedding model per vector collection.

Can I keep data in my region?

Plugsky supports cloud, VPC, on-prem and air-gapped deployment with data-residency options; confirm your requirements with the docs and the enterprise team.

How do I migrate an existing app?

Change base_url to https://api.plugsky.com/v1 and map the model name. Streaming, JSON mode, function calling and embeddings keep the same request shapes.

Is there a free plan?

Yes — the free plan includes two free models, plugsky-micro and plugsky-lite, with no card. A 14-day full-access trial unlocks the paid catalogue.