Skip to main content

Language and Safety

Translation​

POST /v1/translate · Primex-native

ParameterTypeRequiredDescription
modelstringNoOffering ID to route to (discover IDs via GET /v1/models for this service_type).
textstring | string[]YesInput text: a single string or an array of strings for batch processing.
tostring | string[]YesTarget language code(s): one string or an array to translate into several languages at once.
fromstringNoSource language code. Omit to auto-detect.

Billed per 1M characters.

POST /v1/translate accepts one string or an array and one target language or several target languages. Omit from to use language detection.

{
"model": "YOUR_LIVE_TRANSLATION_MODEL",
"text": ["One key for AI.", "Build with capabilities."],
"to": ["de", "fa"]
}

The response reports usage.characters. Billing follows the number of processed characters.

Document translation​

POST /v1/documents/translate · Primex-native

Upload one DOCX document as multipart field document. Set to in the query string and optionally from and model. The response is a DOCX download; X-Primex-Characters gives Azure's billed character count, and X-Primex-Cost-USD gives the settled Primex charge. The DOCX input limit is 2 MiB. Embedded images are not translated. PDF and image translation are not part of this endpoint.

curl -X POST 'https://gateway.primexos.com/v1/documents/translate?to=fa' \
-H 'Authorization: Bearer prx-YOUR_KEY' \
-F 'document=@contract.docx;type=application/vnd.openxmlformats-officedocument.wordprocessingml.document' \
-o contract-fa.docx

The live azure-document-translator offering uses the same API key and wallet as other Primex services.

Document PII redaction: pending certification​

POST /v1/documents/redact-pii · Primex-native

Upload one PDF as multipart field document. Optional query parameters are language and model. The response is a redacted PDF. The input limit is 2 MiB. The azure-document-pii-redaction offering remains unavailable until production configuration and supplier billing certification are complete. The route counts PDF pages locally for Primex billing; Azure's document-level transactionsCount is retained as an upstream completion check and is not used as page units. DOCX is held until a trusted pagination contract exists.

PII detection can miss sensitive information. Review the redacted result before sharing it. Azure's native-document service supports PDFs and DOCX files; the current Primex route exposes the certified PDF path only.

Text analysis​

POST /v1/language/analyze · Primex-native

ParameterTypeRequiredDescription
modelstringNoOffering ID to route to (discover IDs via GET /v1/models for this service_type).
kindSentimentAnalysis | EntityRecognition | KeyPhraseExtraction | PiiEntityRecognition | LanguageDetectionNoAnalysis task to run.
textstring | string[]YesInput text: a single string or an array of strings for batch processing.
languagestringNoBCP-47 language hint for the input text. Omit to auto-detect.

Billed per rounded 1,000-element text record.

POST /v1/language/analyze runs one analysis kind across one string or a batch. Supported kinds include sentiment, named entities, PII, key phrases, and language detection as exposed by the live service.

{
"model": "YOUR_LIVE_LANGUAGE_MODEL",
"kind": "SentimentAnalysis",
"text": ["The setup was straightforward."],
"language": "en"
}

Billing uses text records. Each submitted document is counted independently in rounded blocks of 1,000 Unicode text elements.

Text summarization​

POST /v1/language/summarize · Primex-native

ParameterTypeRequiredDescription
modelstringNoOffering ID to route to (discover IDs via GET /v1/models for this service_type).
textstring | string[]YesInput text: a single string or an array of strings for batch processing.
languagestringNoBCP-47 language hint for the input text. Omit to auto-detect.
modeabstractive | extractiveNoSummary type: abstractive writes a concise summary; extractive returns selected source sentences.
summary_lengthshort | medium | longNoRequested abstractive summary length.
sentence_countintegerNoNumber of source sentences to return in extractive mode (1–20).
sort_byOffset | RankNoExtractive result order: source Offset or relevance Rank.

Billed per rounded 1,000-element text record across each input document and its generated summary.

POST /v1/language/summarize accepts one string or a batch of up to 25 strings. Abstractive mode produces new summary text. Extractive mode selects source sentences and can return them in source or relevance order.

{
"model": "azure-language-summarization",
"text": "Primex provides one API and wallet for models and specialized AI services. Teams can compare providers, control spending, and inspect usage from one account.",
"mode": "abstractive",
"summary_length": "short",
"language": "en"
}

The response reports input elements, output elements, and the settled number of text_records. Azure counts each input document together with its generated summary, rounded to 1,000-element records. Failed or incomplete upstream results are not billed.

Content safety​

POST /v1/moderations · Primex-native

ParameterTypeRequiredDescription
modelstringNoOffering ID to route to (discover IDs via GET /v1/models for this service_type).
textstringNoText to evaluate. Provide exactly one of text, image, or file_id.
imagestringNoBase64 string or data URL of an image to evaluate. Provide exactly one of text, image, or file_id.
file_idstringNoA finalized Files API file_id (see /endpoints/files). Provide exactly one input source.
categories(Hate | SelfHarm | Sexual | Violence)[]NoRestrict scoring to these safety categories. Omit to score all categories.

Billed per record (text) or per image.

POST /v1/moderations accepts either text or a base64/data-URL image and can optionally limit the safety categories to score.

{
"model": "YOUR_LIVE_MODERATION_MODEL",
"text": "Content to evaluate"
}

One moderation call is one billable record. The response returns category analysis and usage.records.

For a local image, use the Primex temporary Files API with purpose MODERATION_INPUT, then send the finalized file_id instead of image.