strapi-provider-translate-openai-gpt
v1.0.4
Published
OpenAI GPT provider for translate plugin in Strapi 4
Downloads
50
Maintainers
Readme
OpenAI translation provider for Strapi Translate Plugin
Configure the OpenAi provider through the pluginOptions:
module.exports = {
// ...
translate: {
enabled: true,
config: {
// Add the name of your provider
provider: 'openai-gpt',
providerOptions: {
// your API key
apiKey: 'sk-YOUR_API_KEY',
// model - default: 'gpt-4o'
model: 'gpt-4o',
// max tokens used per one translate operation - default: 4096
maxTokens: 4096,
// additional system prompt for the translation - default: none.
generalPrompt: 'Do not translate paths, slugs, etc.',
},
// Which field types are translated (default string, text, richtext, components and dynamiczones)
// Either string or object with type and format
// Possible formats: plain, markdown, html (default plain)
translatedFieldTypes: [
'string',
{ type: 'text', format: 'plain' },
{ type: 'richtext', format: 'markdown' },
'component',
'dynamiczone',
],
// If relations should be translated (default true)
translateRelations: true,
},
},
// ...
}
or use environment variables:
OPENAI_API_KEY
- defaultundefined
OPENAI_MODEL
- defaultgpt-4o
OPENAI_MAX_TOKENS
- default1000
OPENAI_GENERAL_PROMPT
- defaultnone