Skip to content

AI Prompt Provider Module

The AI Prompt Provider module is designed to streamline the process of generating prompts for both custom and natively supported AI providers. By integrating this module into your app, you can create external Pre-translate and Assist prompts that leverage various types of contextual information from your Crowdin projects. The module allows you to compile prompts externally, ensuring they are ready for execution by the AI provider without any further modifications. This approach is particularly beneficial for users with fine-tuned models that require specific prompt structures that differ from those generated by Crowdin, allowing for seamless integration and optimal performance.

Access

You can grant access to this module to one of the following user categories:

For Crowdin:

  • Only me (i.e., project owner)
  • All project members
  • Selected users

For Crowdin Enterprise:

  • Only organization admins
  • All users in the organization projects
  • Selected users

Structure

manifest.json
{
"modules": {
"ai-prompt-provider": [
{
"key": "ai-prompt-provider",
"name": "AI prompt provider",
"logo": "/logo.png",
"configuratorUrl": "/configurator",
"compileUrl": "/compile",
"environments": [
"crowdin",
"crowdin-enterprise"
]
}
]
}
}

Properties

key

Type: string

Required: yes

Description: Module identifier within the Crowdin app.

name

Type: string

Required: yes

Description: The human-readable name of the module.

logo

Type: string

Required: yes

Description: The relative URL to the custom AI’s logo that will be displayed in the Crowdin UI.
The recommended resolution is 48x48 pixels.

configuratorUrl

Type: string

Required: no

Description: The relative URL for an iframe that provides a set of options stored in the prompt and will be sent during the compilation.

compileUrl

Type: string

Required: yes

Description: The relative URL to the API endpoint used for prompt compilation.

environments

Type: string

Allowed values: crowdin, crowdin-enterprise

Description: Set of environments where a module could be installed.
This parameter is needed for cross-product applications.

Communication between AI Prompt Provider App and Crowdin

The system collects the strings requiring translation along with all related context and sends this data to the AI Prompt Provider app. The app processes the data, and using compileUrl, compiles a prompt optimized for a specific AI model and requirements. The compiled prompt is then returned back to Crowdin and sent to the chosen AI provider.

Request to the App from Crowdin for Assist Action

Request payload example:

{
"action": "assist",
"provider": "open_ai",
"model": "gpt-4o",
"limitation": {
"contextWindow": 128000,
"output": 4096
},
"options": null,
"payload": {
"project": {
"id": 748586,
61 collapsed lines
"type": 0,
"sourceLanguage": {
"id": "en",
"name": "English",
"twoLettersCode": "en",
"threeLettersCode": "eng",
"locale": "en-US",
"pluralCategoryNames": [
"one",
"other"
],
"pluralRules": "(n != 1)",
"pluralExamples": [
"1",
"0, 2-999; 1.2, 2.07..."
],
"textDirection": "ltr",
"dialectOf": null
},
"targetLanguages": [
{
"id": "de",
"name": "German",
"twoLettersCode": "de",
"threeLettersCode": "deu",
"locale": "de-DE",
"pluralCategoryNames": [
"one",
"other"
],
"pluralRules": "(n != 1)",
"pluralExamples": [
"1",
"0, 2-999; 1.2, 2.07..."
],
"textDirection": "ltr",
"dialectOf": null
},
{
"id": "uk",
"name": "Ukrainian",
"twoLettersCode": "uk",
"threeLettersCode": "ukr",
"locale": "uk-UA",
"pluralCategoryNames": [
"one",
"few",
"many",
"other"
],
"pluralRules": "((n%10==1 && n%100!=11) ? 0 : ((n%10 >= 2 && n%10 <=4 && (n%100 < 12 || n%100 > 14)) ? 1 : ((n%10 == 0 || (n%10 >= 5 && n%10 <=9)) || (n%100 >= 11 && n%100 <= 14)) ? 2 : 3))",
"pluralExamples": [
"1, 21, 31, 41, 51, 61, 71, 81...",
"2-4, 22-24, 32-34, 42-44, 52-54, 62...",
"0, 5-19, 100, 1000, 10000...",
"0.0-0.9, 1.1-1.6, 10.0, 100.0..."
],
"textDirection": "ltr",
"dialectOf": null
}
],
"name": "Umbrella Android",
"description": "Localization project for Umbrella Android"
},
"sourceLanguage": {
"id": "en",
"name": "English",
14 collapsed lines
"twoLettersCode": "en",
"threeLettersCode": "eng",
"locale": "en-US",
"pluralCategoryNames": [
"one",
"other"
],
"pluralRules": "(n != 1)",
"pluralExamples": [
"1",
"0, 2-999; 1.2, 2.07..."
],
"textDirection": "ltr",
"dialectOf": null
},
"targetLanguage": {
"id": "de",
"name": "German",
14 collapsed lines
"twoLettersCode": "de",
"threeLettersCode": "deu",
"locale": "de-DE",
"pluralCategoryNames": [
"one",
"other"
],
"pluralRules": "(n != 1)",
"pluralExamples": [
"1",
"0, 2-999; 1.2, 2.07..."
],
"textDirection": "ltr",
"dialectOf": null
},
"strings": [
{
"id": 5511717,
"text": "Welcome!",
"key": "welcome",
"context": "welcome",
"maxLength": null,
"pluralForm": null
}
],
"siblingsStrings": {
"previous": null,
"next": {
"id": 5511718,
"text": "Save as...",
"key": "save_as",
"context": "save_as",
"maxLength": null
}
},
"filteredStrings": [
{
"id": 5511717,
"text": "Welcome!",
"key": "welcome",
"context": "welcome",
"maxLength": null
},
{
"id": 5511718,
"text": "Save as...",
"key": "save_as",
"context": "save_as",
"maxLength": null
},
{
"id": 5511719,
"text": "View",
"key": "view",
"context": "view",
"maxLength": null
}
],
"tmSuggestions": [
{
"tmId": 736613,
"phraseId": 316642,
"source": {
"text": "Welcome!"
},
"target": {
"text": "Willkommen!"
},
"relevant": 100,
"updatedAt": "2024-05-17T09:09:32+00:00"
}
],
"terms": [
{
"glossaryId": 728017,
"conceptId": 211993,
"source": {
"id": 357901,
"userId": 13575027,
"languageId": "en",
"text": "Welcome",
"description": null,
"partOfSpeech": "PROPN",
"status": null,
"type": null,
"gender": null,
"note": null,
"url": null,
"lemma": "welcome",
"createdAt": "2024-06-21T07:44:26+00:00",
"updatedAt": "2024-06-21T07:44:26+00:00"
},
"target": {
"id": 357902,
"userId": 13575027,
"languageId": "de",
"text": "Willkommen",
"description": null,
"partOfSpeech": "PROPN",
"status": null,
"type": null,
"gender": null,
"note": null,
"url": null,
"lemma": "willkommen",
"createdAt": "2024-06-21T07:44:26+00:00",
"updatedAt": "2024-06-21T07:44:26+00:00"
}
}
],
"file": {
"id": 4549,
"name": "crowdin_sample_android.xml",
"title": null,
"context": "File context",
"type": "android",
"path": "/crowdin_sample_android.xml"
}
}
}

Request to the App from Crowdin for Pre-translate Action

Request payload example:

{
"action": "pre_translate",
"provider": "open_ai",
"model": "gpt-4o",
"limitation": {
"contextWindow": 128000,
"output": 4096
},
"options": null,
"payload": {
"project": {
"id": 748586,
61 collapsed lines
"type": 0,
"sourceLanguage": {
"id": "en",
"name": "English",
"twoLettersCode": "en",
"threeLettersCode": "eng",
"locale": "en-US",
"pluralCategoryNames": [
"one",
"other"
],
"pluralRules": "(n != 1)",
"pluralExamples": [
"1",
"0, 2-999; 1.2, 2.07..."
],
"textDirection": "ltr",
"dialectOf": null
},
"targetLanguages": [
{
"id": "de",
"name": "German",
"twoLettersCode": "de",
"threeLettersCode": "deu",
"locale": "de-DE",
"pluralCategoryNames": [
"one",
"other"
],
"pluralRules": "(n != 1)",
"pluralExamples": [
"1",
"0, 2-999; 1.2, 2.07..."
],
"textDirection": "ltr",
"dialectOf": null
},
{
"id": "uk",
"name": "Ukrainian",
"twoLettersCode": "uk",
"threeLettersCode": "ukr",
"locale": "uk-UA",
"pluralCategoryNames": [
"one",
"few",
"many",
"other"
],
"pluralRules": "((n%10==1 && n%100!=11) ? 0 : ((n%10 >= 2 && n%10 <=4 && (n%100 < 12 || n%100 > 14)) ? 1 : ((n%10 == 0 || (n%10 >= 5 && n%10 <=9)) || (n%100 >= 11 && n%100 <= 14)) ? 2 : 3))",
"pluralExamples": [
"1, 21, 31, 41, 51, 61, 71, 81...",
"2-4, 22-24, 32-34, 42-44, 52-54, 62...",
"0, 5-19, 100, 1000, 10000...",
"0.0-0.9, 1.1-1.6, 10.0, 100.0..."
],
"textDirection": "ltr",
"dialectOf": null
}
],
"name": "Umbrella Android",
"description": "Localization project for Umbrella Android"
},
"sourceLanguage": {
"id": "en",
"name": "English",
14 collapsed lines
"twoLettersCode": "en",
"threeLettersCode": "eng",
"locale": "en-US",
"pluralCategoryNames": [
"one",
"other"
],
"pluralRules": "(n != 1)",
"pluralExamples": [
"1",
"0, 2-999; 1.2, 2.07..."
],
"textDirection": "ltr",
"dialectOf": null
},
"targetLanguage": {
"id": "de",
"name": "German",
14 collapsed lines
"twoLettersCode": "de",
"threeLettersCode": "deu",
"locale": "de-DE",
"pluralCategoryNames": [
"one",
"other"
],
"pluralRules": "(n != 1)",
"pluralExamples": [
"1",
"0, 2-999; 1.2, 2.07..."
],
"textDirection": "ltr",
"dialectOf": null
},
"strings": [
{
"id": 5511717,
"text": "Welcome!",
"key": "welcome",
"context": "welcome",
"maxLength": null,
"pluralForm": null
},
{
"id": 5511718,
"text": "Save as...",
"key": "save_as",
"context": "save_as",
"maxLength": null,
"pluralForm": null
},
{
"id": 5511719,
"text": "View",
"key": "view",
"context": "view",
"maxLength": null,
"pluralForm": null
}
],
"tmSuggestions": [
{
"tmId": 736613,
"phraseId": 316642,
"source": {
"text": "Welcome!"
},
"target": {
"text": "Willkommen!"
},
"relevant": 100,
"updatedAt": "2024-05-17T09:09:32+00:00"
},
{
"tmId": 736613,
"phraseId": 316643,
"source": {
"text": "Save as..."
},
"target": {
"text": "Speichern unter..."
},
"relevant": 100,
"updatedAt": "2024-05-17T09:09:59+00:00"
}
],
"terms": [
{
"glossaryId": 728017,
"conceptId": 211993,
"source": {
"id": 357901,
"userId": 13575027,
"languageId": "en",
"text": "Welcome",
"description": null,
"partOfSpeech": "PROPN",
"status": null,
"type": null,
"gender": null,
"note": null,
"url": null,
"lemma": "welcome",
"createdAt": "2024-06-21T07:44:26+00:00",
"updatedAt": "2024-06-21T07:44:26+00:00"
},
"target": {
"id": 357902,
"userId": 13575027,
"languageId": "de",
"text": "Willkommen",
"description": null,
"partOfSpeech": "PROPN",
"status": null,
"type": null,
"gender": null,
"note": null,
"url": null,
"lemma": "willkommen",
"createdAt": "2024-06-21T07:44:26+00:00",
"updatedAt": "2024-06-21T07:44:26+00:00"
}
},
{
"glossaryId": 728017,
"conceptId": 211992,
"source": {
"id": 357899,
"userId": 13575027,
"languageId": "en",
"text": "Save",
"description": null,
"partOfSpeech": "PROPN",
"status": "PREFERRED",
"type": "FULL_FORM",
"gender": "OTHER",
"note": null,
"url": null,
"lemma": "save",
"createdAt": "2024-05-17T09:12:36+00:00",
"updatedAt": "2024-05-17T09:12:36+00:00"
},
"target": null
}
],
"file": {
"id": 4549,
"name": "crowdin_sample_android.xml",
"title": null,
"context": "File context",
"type": "android",
"path": "/crowdin_sample_android.xml",
"contentUrl": "https://crowdin-importer.s3.eu-central-1.amazonaws.com/72057531/748586/3407.xml?response-content-disposition=attachment%3B%20filename%3D%22crowdin_sample_android.xml%22&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAWVY4ALJ2RXJ26JGB%2F20240621%2Feu-central-1%2Fs3%2Faws4_request&X-Amz-Date=20240621T080230Z&X-Amz-SignedHeaders=host&X-Amz-Expires=900&X-Amz-Signature=6edfe88dc612a58a83c67ca6d603f61803bb7ebe6c027900e21923cc7c50f07a"
}
}
}

Request to the App from Crowdin for Alignment Action

Request payload example:

{
"action": "alignment",
"provider": "open_ai",
"model": "gpt-4o",
"limitation": {
"contextWindow": 128000,
"output": 4096
},
"options": null,
"payload": {
"project": {
"id": 748586,
61 collapsed lines
"type": 0,
"sourceLanguage": {
"id": "en",
"name": "English",
"twoLettersCode": "en",
"threeLettersCode": "eng",
"locale": "en-US",
"pluralCategoryNames": [
"one",
"other"
],
"pluralRules": "(n != 1)",
"pluralExamples": [
"1",
"0, 2-999; 1.2, 2.07..."
],
"textDirection": "ltr",
"dialectOf": null
},
"targetLanguages": [
{
"id": "de",
"name": "German",
"twoLettersCode": "de",
"threeLettersCode": "deu",
"locale": "de-DE",
"pluralCategoryNames": [
"one",
"other"
],
"pluralRules": "(n != 1)",
"pluralExamples": [
"1",
"0, 2-999; 1.2, 2.07..."
],
"textDirection": "ltr",
"dialectOf": null
},
{
"id": "uk",
"name": "Ukrainian",
"twoLettersCode": "uk",
"threeLettersCode": "ukr",
"locale": "uk-UA",
"pluralCategoryNames": [
"one",
"few",
"many",
"other"
],
"pluralRules": "((n%10==1 && n%100!=11) ? 0 : ((n%10 >= 2 && n%10 <=4 && (n%100 < 12 || n%100 > 14)) ? 1 : ((n%10 == 0 || (n%10 >= 5 && n%10 <=9)) || (n%100 >= 11 && n%100 <= 14)) ? 2 : 3))",
"pluralExamples": [
"1, 21, 31, 41, 51, 61, 71, 81...",
"2-4, 22-24, 32-34, 42-44, 52-54, 62...",
"0, 5-19, 100, 1000, 10000...",
"0.0-0.9, 1.1-1.6, 10.0, 100.0..."
],
"textDirection": "ltr",
"dialectOf": null
}
],
"name": "Umbrella Android",
"description": "Localization project for Umbrella Android"
},
"sourceLanguage": {
"id": "en",
"name": "English",
14 collapsed lines
"twoLettersCode": "en",
"threeLettersCode": "eng",
"locale": "en-US",
"pluralCategoryNames": [
"one",
"other"
],
"pluralRules": "(n != 1)",
"pluralExamples": [
"1",
"0, 2-999; 1.2, 2.07..."
],
"textDirection": "ltr",
"dialectOf": null
},
"targetLanguage": {
"id": "de",
"name": "German",
14 collapsed lines
"twoLettersCode": "de",
"threeLettersCode": "deu",
"locale": "de-DE",
"pluralCategoryNames": [
"one",
"other"
],
"pluralRules": "(n != 1)",
"pluralExamples": [
"1",
"0, 2-999; 1.2, 2.07..."
],
"textDirection": "ltr",
"dialectOf": null
},
"alignmentPairs": [
{
"id": "0c92b4f9-6475-4c9e-9fe2-efc76f2917d5",
"source": "Your password has been reset successfully!",
"translation": "Ihr Passwort wurde erfolgreich zurückgesetzt!"
},
{
"id": "9e5fa3ab-3629-49ef-868d-09a6ea5f3df9",
"source": "Are you sure you want to delete this message?",
"translation": "Sind Sie sicher, dass Sie diese Nachricht löschen möchten?"
}
]
}
}

Expected Response from the App (Plain content)

Response payload example:

{
"data": {
"content": "<prompt>"
}
}

Expected Response from the App (Content parts)

Response payload example:

{
"data": {
"content": [
{
"type": "text",
"text": "<prompt>"
},
{
"type": "image",
"mimeType": "<mime-type>",
"url": "<image-url>"
}
]
}
}

The structure of the responses from the app should correspond to the presented examples, otherwise Crowdin will consider them invalid.

Was this page helpful?