Professional Sunflower inference endpoint for multilingual chat completions.
**Deprecated**: use POST /tasks/chat/completions instead.
This endpoint provides access to Sunbird AI's Sunflower model, specialized in:
- Multilingual conversations in Ugandan languages (Luganda, Acholi, Ateso, etc.)
- Cross-lingual translations and explanations
- Cultural context understanding
- Educational content in local languages
Features:
- Automatic retry with exponential backoff
- Context-aware responses
- Usage tracking and monitoring
- Support for custom system messages
- Message history management
Args:
request: The FastAPI request object (required for rate limiting).
chat_request: The chat request containing messages and parameters.
background_tasks: FastAPI background tasks for async operations.
current_user: The authenticated user (enforces authentication).
service: The inference service instance.
Returns:
SunflowerChatResponse containing the AI's response and usage stats.
Raises:
BadRequestError: For validation errors.
ValidationError: For invalid message format.
ServiceUnavailableError: If the model is loading or request times out.
ExternalServiceError: For empty model response or unexpected errors.
Example:
Request body with message history:
{
"messages": [
{"role": "system", "content": "You are Sunflower..."},
{"role": "user", "content": "Translate 'How are you?' to Luganda."},
{"role": "assistant", "content": "In Luganda, 'How are you?' is 'Oli otya?'."},
{"role": "user", "content": "How do I say 'Good morning' in Acholi?"}
],
"model_type": "qwen",
"temperature": 0.3
}
Response:
{
"content": "In Acholi, 'Good morning' is 'Icwiny atir'.",
"model_type": "qwen",
"usage": {"completion_tokens": 15, "prompt_tokens": 50, "total_tokens": 65},
"processing_time": 2.5,
"inference_time": 2.0,
"message_count": 5
}
The access token received from the authorization server in the OAuth 2.0 flow.
Body
application/json
Request model for Sunflower chat inference.
Attributes:
messages: List of conversation messages.
model_type: The model to use ('qwen').
temperature: Sampling temperature (0.0 to 2.0).
stream: Whether to stream the response.
system_message: Optional custom system message.
Attributes:
content: The AI's response text.
model_type: The model used for inference.
usage: Token usage statistics.
processing_time: Total processing time in seconds.
inference_time: Model inference time in seconds.
message_count: Number of messages processed.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Sunbird AI API","colors":{"primary":"#DC7828","light":"#DC7828","dark":"#DC7828"},"logo":{"light":"https://mintcdn.com/analyticssunbirdai/p5dqIvZVDHCsf_tB/logo/logo_light.png?fit=max\u0026auto=format\u0026n=p5dqIvZVDHCsf_tB\u0026q=85\u0026s=9e35440a8c31879452f811688f2db71e","dark":"https://mintcdn.com/analyticssunbirdai/o2R3vhcekRoJdUva/logo/logo_dark.png?fit=max\u0026auto=format\u0026n=o2R3vhcekRoJdUva\u0026q=85\u0026s=fb5b0b475c6531819f7499e09688219c"},"favicon":"https://mintcdn.com/analyticssunbirdai/lsnNQ_5VSHOkM4yt/sunbird-favicon.jpg?fit=max\u0026auto=format\u0026n=lsnNQ_5VSHOkM4yt\u0026q=85\u0026s=d09e99396a7680a793c8da05d92eb604","navbar":{"primary":{"type":"button","label":"Sunflower","href":"https://sunflower.sunbird.ai"}},"footer":{"socials":{"github":"https://github.com/SunbirdAI","x":"https://x.com/SunbirdAI","website":"https://sunbird.ai","linkedin":"https://www.linkedin.com/company/sunbird-ai"}},"fonts":{"family":"Open Sans"},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"analyticssunbirdai","hasAudioNarration":false,"actualSubdomain":"analyticssunbirdai","customDomains":["docs.sunbird.ai"],"gitSource":{"type":"github","owner":"sunbirdai","repo":"official-docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6ab4d4e96db8efdbd0b21b7a","collectionId":"9f1fc6af-58ff-4855-a1da-67d91a963e4c","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6ab4d4e96db8efdbd0b21b7a"},"entitlements":{},"buildId":"6ab4d4e96db8efdbd0b21b7a","clientVersion":"0.0.4054","searchFilterCounts":[{"language":"default","tag":"API Reference","count":23},{"language":"default","tag":"API Reference (Legacy)","count":19},{"language":"default","tag":"General","count":13},{"language":"default","tag":"Authentication","count":11},{"language":"default","tag":"Legacy Text to Speech","count":11},{"language":"default","tag":"Guides","count":7},{"language":"default","tag":"Resources","count":6},{"language":"default","tag":"Models","count":5},{"language":"default","tag":"Sunflower LLM","count":5},{"language":"default","tag":"Legacy Speech to Text","count":4}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableAskAiSearchBar":true},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":true},"customCss":[],"page":{"pagePath":"api-reference/legacy/ai/sunflower-inference","slug":"/api-reference/legacy/ai/sunflower-inference","pageMetadata":{"title":"Sunflower Inference","openapi":"api-reference/openapi-legacy.json POST /tasks/sunflower_inference","deprecated":true,"description":"Professional Sunflower inference endpoint for multilingual chat completions.\n\n**Deprecated**: use POST /tasks/chat/completions instead.\n\nThis endpoint provides access to Sunbird AI's Sunflower model, specialized in:\n- Multilingual conversations in Ugandan languages (Luganda, Acholi, Ateso, etc.)\n- Cross-lingual translations and explanations\n- Cultural context understanding\n- Educational content in local languages\n\nFeatures:\n- Automatic retry with exponential backoff\n- Context-aware responses\n- Usage tracking and monitoring\n- Support for custom system messages\n- Message history management\n\nArgs:\n\n request: The FastAPI request object (required for rate limiting).\n chat_request: The chat request containing messages and parameters.\n background_tasks: FastAPI background tasks for async operations.\n current_user: The authenticated user (enforces authentication).\n service: The inference service instance.\n\nReturns:\n\n SunflowerChatResponse containing the AI's response and usage stats.\n\nRaises:\n\n BadRequestError: For validation errors.\n ValidationError: For invalid message format.\n ServiceUnavailableError: If the model is loading or request times out.\n ExternalServiceError: For empty model response or unexpected errors.\n\nExample:\n\n Request body with message history:\n\n {\n \"messages\": [\n {\"role\": \"system\", \"content\": \"You are Sunflower...\"},\n {\"role\": \"user\", \"content\": \"Translate 'How are you?' to Luganda.\"},\n {\"role\": \"assistant\", \"content\": \"In Luganda, 'How are you?' is 'Oli otya?'.\"},\n {\"role\": \"user\", \"content\": \"How do I say 'Good morning' in Acholi?\"}\n ],\n \"model_type\": \"qwen\",\n \"temperature\": 0.3\n }\n\n Response:\n\n {\n \"content\": \"In Acholi, 'Good morning' is 'Icwiny atir'.\",\n \"model_type\": \"qwen\",\n \"usage\": {\"completion_tokens\": 15, \"prompt_tokens\": 50, \"total_tokens\": 65},\n \"processing_time\": 2.5,\n \"inference_time\": 2.0,\n \"message_count\": 5\n }","href":"/api-reference/legacy/ai/sunflower-inference"},"description":"Professional Sunflower inference endpoint for multilingual chat completions.\n\n**Deprecated**: use POST /tasks/chat/completions instead.\n\nThis endpoint provides access to Sunbird AI's Sunflower model, specialized in:\n- Multilingual conversations in Ugandan languages (Luganda, Acholi, Ateso, etc.)\n- Cross-lingual translations and explanations\n- Cultural context understanding\n- Educational content in local languages\n\nFeatures:\n- Automatic retry with exponential backoff\n- Context-aware responses\n- Usage tracking and monitoring\n- Support for custom system messages\n- Message history management\n\nArgs:\n\n request: The FastAPI request object (required for rate limiting).\n chat_request: The chat request containing messages and parameters.\n background_tasks: FastAPI background tasks for async operations.\n current_user: The authenticated user (enforces authentication).\n service: The inference service instance.\n\nReturns:\n\n SunflowerChatResponse containing the AI's response and usage stats.\n\nRaises:\n\n BadRequestError: For validation errors.\n ValidationError: For invalid message format.\n ServiceUnavailableError: If the model is loading or request times out.\n ExternalServiceError: For empty model response or unexpected errors.\n\nExample:\n\n Request body with message history:\n\n {\n \"messages\": [\n {\"role\": \"system\", \"content\": \"You are Sunflower...\"},\n {\"role\": \"user\", \"content\": \"Translate 'How are you?' to Luganda.\"},\n {\"role\": \"assistant\", \"content\": \"In Luganda, 'How are you?' is 'Oli otya?'.\"},\n {\"role\": \"user\", \"content\": \"How do I say 'Good morning' in Acholi?\"}\n ],\n \"model_type\": \"qwen\",\n \"temperature\": 0.3\n }\n\n Response:\n\n {\n \"content\": \"In Acholi, 'Good morning' is 'Icwiny atir'.\",\n \"model_type\": \"qwen\",\n \"usage\": {\"completion_tokens\": 15, \"prompt_tokens\": 50, \"total_tokens\": 65},\n \"processing_time\": 2.5,\n \"inference_time\": 2.0,\n \"message_count\": 5\n }","pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){return _jsx(_Fragment,{})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Sunflower Inference","openapi":"api-reference/openapi-legacy.json POST /tasks/sunflower_inference","deprecated":true,"description":"Professional Sunflower inference endpoint for multilingual chat completions.\n\n**Deprecated**: use POST /tasks/chat/completions instead.\n\nThis endpoint provides access to Sunbird AI's Sunflower model, specialized in:\n- Multilingual conversations in Ugandan languages (Luganda, Acholi, Ateso, etc.)\n- Cross-lingual translations and explanations\n- Cultural context understanding\n- Educational content in local languages\n\nFeatures:\n- Automatic retry with exponential backoff\n- Context-aware responses\n- Usage tracking and monitoring\n- Support for custom system messages\n- Message history management\n\nArgs:\n\n request: The FastAPI request object (required for rate limiting).\n chat_request: The chat request containing messages and parameters.\n background_tasks: FastAPI background tasks for async operations.\n current_user: The authenticated user (enforces authentication).\n service: The inference service instance.\n\nReturns:\n\n SunflowerChatResponse containing the AI's response and usage stats.\n\nRaises:\n\n BadRequestError: For validation errors.\n ValidationError: For invalid message format.\n ServiceUnavailableError: If the model is loading or request times out.\n ExternalServiceError: For empty model response or unexpected errors.\n\nExample:\n\n Request body with message history:\n\n {\n \"messages\": [\n {\"role\": \"system\", \"content\": \"You are Sunflower...\"},\n {\"role\": \"user\", \"content\": \"Translate 'How are you?' to Luganda.\"},\n {\"role\": \"assistant\", \"content\": \"In Luganda, 'How are you?' is 'Oli otya?'.\"},\n {\"role\": \"user\", \"content\": \"How do I say 'Good morning' in Acholi?\"}\n ],\n \"model_type\": \"qwen\",\n \"temperature\": 0.3\n }\n\n Response:\n\n {\n \"content\": \"In Acholi, 'Good morning' is 'Icwiny atir'.\",\n \"model_type\": \"qwen\",\n \"usage\": {\"completion_tokens\": 15, \"prompt_tokens\": 50, \"total_tokens\": 65},\n \"processing_time\": 2.5,\n \"inference_time\": 2.0,\n \"message_count\": 5\n }","href":"/api-reference/legacy/ai/sunflower-inference"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[],"codeExamples":{}},"jsLinks":[],"openApiReferenceData":{"operation":{"tags":["legacy/deprecated"],"summary":"Sunflower Inference","description":"Professional Sunflower inference endpoint for multilingual chat completions.\n\n**Deprecated**: use POST /tasks/chat/completions instead.\n\nThis endpoint provides access to Sunbird AI's Sunflower model, specialized in:\n- Multilingual conversations in Ugandan languages (Luganda, Acholi, Ateso, etc.)\n- Cross-lingual translations and explanations\n- Cultural context understanding\n- Educational content in local languages\n\nFeatures:\n- Automatic retry with exponential backoff\n- Context-aware responses\n- Usage tracking and monitoring\n- Support for custom system messages\n- Message history management\n\nArgs:\n\n request: The FastAPI request object (required for rate limiting).\n chat_request: The chat request containing messages and parameters.\n background_tasks: FastAPI background tasks for async operations.\n current_user: The authenticated user (enforces authentication).\n service: The inference service instance.\n\nReturns:\n\n SunflowerChatResponse containing the AI's response and usage stats.\n\nRaises:\n\n BadRequestError: For validation errors.\n ValidationError: For invalid message format.\n ServiceUnavailableError: If the model is loading or request times out.\n ExternalServiceError: For empty model response or unexpected errors.\n\nExample:\n\n Request body with message history:\n\n {\n \"messages\": [\n {\"role\": \"system\", \"content\": \"You are Sunflower...\"},\n {\"role\": \"user\", \"content\": \"Translate 'How are you?' to Luganda.\"},\n {\"role\": \"assistant\", \"content\": \"In Luganda, 'How are you?' is 'Oli otya?'.\"},\n {\"role\": \"user\", \"content\": \"How do I say 'Good morning' in Acholi?\"}\n ],\n \"model_type\": \"qwen\",\n \"temperature\": 0.3\n }\n\n Response:\n\n {\n \"content\": \"In Acholi, 'Good morning' is 'Icwiny atir'.\",\n \"model_type\": \"qwen\",\n \"usage\": {\"completion_tokens\": 15, \"prompt_tokens\": 50, \"total_tokens\": 65},\n \"processing_time\": 2.5,\n \"inference_time\": 2.0,\n \"message_count\": 5\n }","operationId":"sunflower_inference_tasks_sunflower_inference_post","requestBody":"9e5b244e-f555-4e24-a664-0853b6833524","responses":{"200":"304bda54-4d1c-45cd-a9c8-d86d80fbd2a6","422":"5ac11a55-cdd5-457f-a494-5552559bde62"},"deprecated":true,"security":["054b2521-6441-4e60-9723-b226911a8c28"],"method":"post","type":"path","servers":["783b71b5-a66d-4fe0-b44d-2c0b0da79665"],"path":"/tasks/sunflower_inference","baseUrlOptions":["https://api.sunbird.ai"],"title":"Sunflower Inference","codeSamples":[],"requiredOnlyExamples":false,"requestExampleType":"generated","responseExampleType":"generated"},"dependencies":{"parameters":{},"requestBody":{"content":{"application/json":{"schema":{"properties":{"messages":{"items":{"properties":{"role":{"type":"string","title":"Role","description":"Message role: 'system', 'user', or 'assistant'","isRequired":true,"uniqueKey":"messages.items.[INDEX].role","typeLabel":"string"},"content":{"type":"string","title":"Content","description":"Message content","isRequired":true,"uniqueKey":"messages.items.[INDEX].content","typeLabel":"string"}},"type":"object","required":["role","content"],"title":"SunflowerChatMessage","description":"A single message in the chat conversation.\n\nAttributes:\n role: The role of the message sender ('system', 'user', or 'assistant').\n content: The content of the message.","uniqueKey":"messages.items.[INDEX]","typeLabel":"SunflowerChatMessage · object"},"type":"array","title":"Messages","description":"List of conversation messages","isRequired":true,"uniqueKey":"messages","typeLabel":"SunflowerChatMessage · object[]"},"model_type":{"type":"string","title":"Model Type","description":"Model type: 'qwen'","default":"qwen","uniqueKey":"model_type","typeLabel":"string"},"temperature":{"type":"number","maximum":2,"minimum":0,"title":"Temperature","description":"Sampling temperature","default":0.3,"uniqueKey":"temperature","typeLabel":"number"},"stream":{"type":"boolean","title":"Stream","description":"Whether to stream the response","default":false,"uniqueKey":"stream","typeLabel":"boolean"},"system_message":{"oneOf":[{"type":"string","title":"System Message","description":"Custom system message","uniqueKey":"system_message.oneOf.0","typeLabel":"string"},{"type":"null","title":"System Message","description":"Custom system message","uniqueKey":"system_message.oneOf.1","typeLabel":"null"}],"uniqueKey":"system_message","typeLabel":"string | null"}},"type":"object","required":["messages"],"title":"SunflowerChatRequest","description":"Request model for Sunflower chat inference.\n\nAttributes:\n messages: List of conversation messages.\n model_type: The model to use ('qwen').\n temperature: Sampling temperature (0.0 to 2.0).\n stream: Whether to stream the response.\n system_message: Optional custom system message.","uniqueKey":"","typeLabel":"SunflowerChatRequest · object"},"examples":{"Example":{"title":"Example","value":{"messages":[{"role":"\u003cstring>","content":"\u003cstring>"}],"model_type":"qwen","temperature":0.3,"stream":false,"system_message":"\u003cstring>"}}},"exampleType":"generated"}},"required":true,"exampleType":"generated"},"responses":{"304bda54-4d1c-45cd-a9c8-d86d80fbd2a6":{"description":"Successful Response","content":{"application/json":{"schema":{"properties":{"content":{"type":"string","title":"Content","description":"The AI's response","isRequired":true,"uniqueKey":"content","typeLabel":"string"},"model_type":{"type":"string","title":"Model Type","description":"Model used for inference","isRequired":true,"uniqueKey":"model_type","typeLabel":"string"},"usage":{"properties":{"completion_tokens":{"oneOf":[{"type":"integer","title":"Completion Tokens","description":"Number of tokens in the completion","uniqueKey":"usage.completion_tokens.oneOf.0","typeLabel":"integer"},{"type":"null","title":"Completion Tokens","description":"Number of tokens in the completion","uniqueKey":"usage.completion_tokens.oneOf.1","typeLabel":"null"}],"uniqueKey":"usage.completion_tokens","typeLabel":"integer | null"},"prompt_tokens":{"oneOf":[{"type":"integer","title":"Prompt Tokens","description":"Number of tokens in the prompt","uniqueKey":"usage.prompt_tokens.oneOf.0","typeLabel":"integer"},{"type":"null","title":"Prompt Tokens","description":"Number of tokens in the prompt","uniqueKey":"usage.prompt_tokens.oneOf.1","typeLabel":"null"}],"uniqueKey":"usage.prompt_tokens","typeLabel":"integer | null"},"total_tokens":{"oneOf":[{"type":"integer","title":"Total Tokens","description":"Total number of tokens used","uniqueKey":"usage.total_tokens.oneOf.0","typeLabel":"integer"},{"type":"null","title":"Total Tokens","description":"Total number of tokens used","uniqueKey":"usage.total_tokens.oneOf.1","typeLabel":"null"}],"uniqueKey":"usage.total_tokens","typeLabel":"integer | null"}},"type":"object","title":"SunflowerUsageStats","description":"Token usage statistics","isRequired":true,"uniqueKey":"usage","typeLabel":"SunflowerUsageStats · object"},"processing_time":{"type":"number","title":"Processing Time","description":"Total processing time in seconds","isRequired":true,"uniqueKey":"processing_time","typeLabel":"number"},"inference_time":{"type":"number","title":"Inference Time","description":"Model inference time in seconds","default":0,"uniqueKey":"inference_time","typeLabel":"number"},"message_count":{"type":"integer","title":"Message Count","description":"Number of messages processed","default":0,"uniqueKey":"message_count","typeLabel":"integer"}},"type":"object","required":["content","model_type","usage","processing_time"],"title":"SunflowerChatResponse","description":"Response model from Sunflower chat inference.\n\nAttributes:\n content: The AI's response text.\n model_type: The model used for inference.\n usage: Token usage statistics.\n processing_time: Total processing time in seconds.\n inference_time: Model inference time in seconds.\n message_count: Number of messages processed.","uniqueKey":"","typeLabel":"SunflowerChatResponse · object"},"examples":{"Example":{"title":"Example","value":{"content":"\u003cstring>","model_type":"\u003cstring>","usage":{"completion_tokens":123,"prompt_tokens":123,"total_tokens":123},"processing_time":123,"inference_time":0,"message_count":0}}},"exampleType":"generated"}},"exampleType":"generated"},"5ac11a55-cdd5-457f-a494-5552559bde62":{"description":"Validation Error","content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"loc":{"items":{"oneOf":[{"type":"string","uniqueKey":"detail.items.[INDEX].loc.items.[INDEX].oneOf.0","typeLabel":"string"},{"type":"integer","uniqueKey":"detail.items.[INDEX].loc.items.[INDEX].oneOf.1","typeLabel":"integer"}],"uniqueKey":"detail.items.[INDEX].loc.items.[INDEX]","typeLabel":"string | integer"},"type":"array","title":"Location","isRequired":true,"uniqueKey":"detail.items.[INDEX].loc","typeLabel":"(string | integer)[]"},"msg":{"type":"string","title":"Message","isRequired":true,"uniqueKey":"detail.items.[INDEX].msg","typeLabel":"string"},"type":{"type":"string","title":"Error Type","isRequired":true,"uniqueKey":"detail.items.[INDEX].type","typeLabel":"string"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError","uniqueKey":"detail.items.[INDEX]","typeLabel":"ValidationError · object"},"type":"array","title":"Detail","uniqueKey":"detail","typeLabel":"ValidationError · object[]"}},"type":"object","title":"HTTPValidationError","uniqueKey":"","typeLabel":"HTTPValidationError · object"},"examples":{"Example":{"title":"Example","value":{"detail":[{"loc":["\u003cstring>"],"msg":"\u003cstring>","type":"\u003cstring>"}]}}},"exampleType":"generated"}},"exampleType":"generated"}},"security":{"054b2521-6441-4e60-9723-b226911a8c28":{"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"/auth/token"}},"scopes":[]}}},"servers":{"783b71b5-a66d-4fe0-b44d-2c0b0da79665":{"url":"https://api.sunbird.ai"}},"processedSecurityOptions":[{"schemes":[{"scheme":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"/auth/token"}},"scopes":[]},"schema":{"title":"OAuth2 Auth","type":"string","isRequired":true,"description":"The access token received from the authorization server in the OAuth 2.0 flow.","format":"bearer","typeLabel":"string\u003cbearer>","deprecated":false},"schemeName":"OAuth2PasswordBearer","name":"Authorization"}],"title":"OAuth2PasswordBearer"}]},"originalFileLocation":"api-reference/openapi-legacy.json"},"subdomain":"analyticssunbirdai","siteName":"Sunbird AI API","title":"Sunflower Inference - Sunbird AI API","navMaps":{"firstHrefInVersion":{"v2.1":{"href":"/introduction","matchLevel":4},"v1":{"href":"/api-reference/legacy/ai/sunflower-inference","matchLevel":0}},"firstHrefInLanguage":{}},"lastModified":"2026-06-18T16:56:26.157Z","originalFileLocation":"api-reference/legacy/ai/sunflower-inference.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Professional Sunflower inference endpoint for multilingual chat completions. Deprecated: use POST /tasks/chat/completions instead. This endpoint provides access to Sunbird AI\u0026#x27;s Sunflower model, specialized in: - Multilingual conversations in Ugandan languages (Luganda, Acholi, Ateso, etc.) - Cross-lingual translations and explanations - Cultural context understanding - Educational content in local languages Features: - Automatic retry with exponential backoff - Context-aware responses - Usage tracking and monitoring - Support for custom system messages - Message history management Args: request: The FastAPI request object (required for rate limiting). chat_request: The chat request containing messages and parameters. background_tasks: FastAPI background tasks for async operations. current_user: The authenticated user (enforces authentication). service: The inference service instance. Returns: SunflowerChatResponse containing the AI\u0026#x27;s response and usage stats. Raises: BadRequestError: For validation errors. ValidationError: For invalid message format. ServiceUnavailableError: If the model is loading or request times out. ExternalServiceError: For empty model response or unexpected errors. Example: Request body with message history: { \u0026quot;messages\u0026quot;: [ {\u0026quot;role\u0026quot;: \u0026quot;system\u0026quot;, \u0026quot;content\u0026quot;: \u0026quot;You are Sunflower...\u0026quot;}, {\u0026quot;role\u0026quot;: \u0026quot;user\u0026quot;, \u0026quot;content\u0026quot;: \u0026quot;Translate \u0026#x27;How are you?\u0026#x27; to Luganda.\u0026quot;}, {\u0026quot;role\u0026quot;: \u0026quot;assistant\u0026quot;, \u0026quot;content\u0026quot;: \u0026quot;In Luganda, \u0026#x27;How are you?\u0026#x27; is \u0026#x27;Oli otya?\u0026#x27;.\u0026quot;}, {\u0026quot;role\u0026quot;: \u0026quot;user\u0026quot;, \u0026quot;content\u0026quot;: \u0026quot;How do I say \u0026#x27;Good morning\u0026#x27; in Acholi?\u0026quot;} ], \u0026quot;model_type\u0026quot;: \u0026quot;qwen\u0026quot;, \u0026quot;temperature\u0026quot;: 0.3 } Response: { \u0026quot;content\u0026quot;: \u0026quot;In Acholi, \u0026#x27;Good morning\u0026#x27; is \u0026#x27;Icwiny atir\u0026#x27;.\u0026quot;, \u0026quot;model_type\u0026quot;: \u0026quot;qwen\u0026quot;, \u0026quot;usage\u0026quot;: {\u0026quot;completion_tokens\u0026quot;: 15, \u0026quot;prompt_tokens\u0026quot;: 50, \u0026quot;total_tokens\u0026quot;: 65}, \u0026quot;processing_time\u0026quot;: 2.5, \u0026quot;inference_time\u0026quot;: 2.0, \u0026quot;message_count\u0026quot;: 5 }\">\u003cmeta data-mint-head name=\"application-name\" content=\"Sunbird AI API\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/analyticssunbirdai/X6F_A1IF4FmJppsS/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/analyticssunbirdai/X6F_A1IF4FmJppsS/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/analyticssunbirdai/X6F_A1IF4FmJppsS/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/analyticssunbirdai/X6F_A1IF4FmJppsS/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/analyticssunbirdai/X6F_A1IF4FmJppsS/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/analyticssunbirdai/X6F_A1IF4FmJppsS/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/analyticssunbirdai/X6F_A1IF4FmJppsS/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/analyticssunbirdai/X6F_A1IF4FmJppsS/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/analyticssunbirdai/X6F_A1IF4FmJppsS/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Sunflower Inference - Sunbird AI API\">\u003cmeta data-mint-head property=\"og:description\" content=\"Professional Sunflower inference endpoint for multilingual chat completions. Deprecated: use POST /tasks/chat/completions instead. This endpoint provides access to Sunbird AI\u0026#x27;s Sunflower model, specialized in: - Multilingual conversations in Ugandan languages (Luganda, Acholi, Ateso, etc.) - Cross-lingual translations and explanations - Cultural context understanding - Educational content in local languages Features: - Automatic retry with exponential backoff - Context-aware responses - Usage tracking and monitoring - Support for custom system messages - Message history management Args: request: The FastAPI request object (required for rate limiting). chat_request: The chat request containing messages and parameters. background_tasks: FastAPI background tasks for async operations. current_user: The authenticated user (enforces authentication). service: The inference service instance. Returns: SunflowerChatResponse containing the AI\u0026#x27;s response and usage stats. Raises: BadRequestError: For validation errors. ValidationError: For invalid message format. ServiceUnavailableError: If the model is loading or request times out. ExternalServiceError: For empty model response or unexpected errors. Example: Request body with message history: { \u0026quot;messages\u0026quot;: [ {\u0026quot;role\u0026quot;: \u0026quot;system\u0026quot;, \u0026quot;content\u0026quot;: \u0026quot;You are Sunflower...\u0026quot;}, {\u0026quot;role\u0026quot;: \u0026quot;user\u0026quot;, \u0026quot;content\u0026quot;: \u0026quot;Translate \u0026#x27;How are you?\u0026#x27; to Luganda.\u0026quot;}, {\u0026quot;role\u0026quot;: \u0026quot;assistant\u0026quot;, \u0026quot;content\u0026quot;: \u0026quot;In Luganda, \u0026#x27;How are you?\u0026#x27; is \u0026#x27;Oli otya?\u0026#x27;.\u0026quot;}, {\u0026quot;role\u0026quot;: \u0026quot;user\u0026quot;, \u0026quot;content\u0026quot;: \u0026quot;How do I say \u0026#x27;Good morning\u0026#x27; in Acholi?\u0026quot;} ], \u0026quot;model_type\u0026quot;: \u0026quot;qwen\u0026quot;, \u0026quot;temperature\u0026quot;: 0.3 } Response: { \u0026quot;content\u0026quot;: \u0026quot;In Acholi, \u0026#x27;Good morning\u0026#x27; is \u0026#x27;Icwiny atir\u0026#x27;.\u0026quot;, \u0026quot;model_type\u0026quot;: \u0026quot;qwen\u0026quot;, \u0026quot;usage\u0026quot;: {\u0026quot;completion_tokens\u0026quot;: 15, \u0026quot;prompt_tokens\u0026quot;: 50, \u0026quot;total_tokens\u0026quot;: 65}, \u0026quot;processing_time\u0026quot;: 2.5, \u0026quot;inference_time\u0026quot;: 2.0, \u0026quot;message_count\u0026quot;: 5 }\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Sunbird AI API\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.sunbird.ai/api-reference/legacy/ai/sunflower-inference\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://analyticssunbirdai.mintlify.app/_mintlify/api/og/v2?division=Legacy+AI\u0026amp;title=Sunflower+Inference\u0026amp;description=Professional+Sunflower+inference+endpoint+for+multilingual+chat+completions.%0A%0A**Deprecated**%3A+use+POST+%2Ftasks%2Fchat%2Fcompletions+instead.%0A%0AThis+endpoint+provides+\u0026amp;theme=98c2a0250bceba930b99aceb\u0026amp;signature=87d7be8e7c15e4878ae407361d2d2fd9fc71de5f00ea230e1d6582a166dee6c2\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Sunflower Inference - Sunbird AI API\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Professional Sunflower inference endpoint for multilingual chat completions. Deprecated: use POST /tasks/chat/completions instead. This endpoint provides access to Sunbird AI\u0026#x27;s Sunflower model, specialized in: - Multilingual conversations in Ugandan languages (Luganda, Acholi, Ateso, etc.) - Cross-lingual translations and explanations - Cultural context understanding - Educational content in local languages Features: - Automatic retry with exponential backoff - Context-aware responses - Usage tracking and monitoring - Support for custom system messages - Message history management Args: request: The FastAPI request object (required for rate limiting). chat_request: The chat request containing messages and parameters. background_tasks: FastAPI background tasks for async operations. current_user: The authenticated user (enforces authentication). service: The inference service instance. Returns: SunflowerChatResponse containing the AI\u0026#x27;s response and usage stats. Raises: BadRequestError: For validation errors. ValidationError: For invalid message format. ServiceUnavailableError: If the model is loading or request times out. ExternalServiceError: For empty model response or unexpected errors. Example: Request body with message history: { \u0026quot;messages\u0026quot;: [ {\u0026quot;role\u0026quot;: \u0026quot;system\u0026quot;, \u0026quot;content\u0026quot;: \u0026quot;You are Sunflower...\u0026quot;}, {\u0026quot;role\u0026quot;: \u0026quot;user\u0026quot;, \u0026quot;content\u0026quot;: \u0026quot;Translate \u0026#x27;How are you?\u0026#x27; to Luganda.\u0026quot;}, {\u0026quot;role\u0026quot;: \u0026quot;assistant\u0026quot;, \u0026quot;content\u0026quot;: \u0026quot;In Luganda, \u0026#x27;How are you?\u0026#x27; is \u0026#x27;Oli otya?\u0026#x27;.\u0026quot;}, {\u0026quot;role\u0026quot;: \u0026quot;user\u0026quot;, \u0026quot;content\u0026quot;: \u0026quot;How do I say \u0026#x27;Good morning\u0026#x27; in Acholi?\u0026quot;} ], \u0026quot;model_type\u0026quot;: \u0026quot;qwen\u0026quot;, \u0026quot;temperature\u0026quot;: 0.3 } Response: { \u0026quot;content\u0026quot;: \u0026quot;In Acholi, \u0026#x27;Good morning\u0026#x27; is \u0026#x27;Icwiny atir\u0026#x27;.\u0026quot;, \u0026quot;model_type\u0026quot;: \u0026quot;qwen\u0026quot;, \u0026quot;usage\u0026quot;: {\u0026quot;completion_tokens\u0026quot;: 15, \u0026quot;prompt_tokens\u0026quot;: 50, \u0026quot;total_tokens\u0026quot;: 65}, \u0026quot;processing_time\u0026quot;: 2.5, \u0026quot;inference_time\u0026quot;: 2.0, \u0026quot;message_count\u0026quot;: 5 }\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://analyticssunbirdai.mintlify.app/_mintlify/api/og/v2?division=Legacy+AI\u0026amp;title=Sunflower+Inference\u0026amp;description=Professional+Sunflower+inference+endpoint+for+multilingual+chat+completions.%0A%0A**Deprecated**%3A+use+POST+%2Ftasks%2Fchat%2Fcompletions+instead.%0A%0AThis+endpoint+provides+\u0026amp;theme=98c2a0250bceba930b99aceb\u0026amp;signature=87d7be8e7c15e4878ae407361d2d2fd9fc71de5f00ea230e1d6582a166dee6c2\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/analyticssunbirdai/X6F_A1IF4FmJppsS/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Sunbird AI API\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#DC7828\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.sunbird.ai/api-reference/legacy/ai/sunflower-inference\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/api-reference/legacy/ai/sunflower-inference.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.sunbird.ai/#organization\",\"name\":\"Sunbird AI API\",\"url\":\"https://docs.sunbird.ai\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/analyticssunbirdai/p5dqIvZVDHCsf_tB/logo/logo_light.png?fit=max\u0026auto=format\u0026n=p5dqIvZVDHCsf_tB\u0026q=85\u0026s=9e35440a8c31879452f811688f2db71e\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.sunbird.ai#website\",\"name\":\"Sunbird AI API\",\"url\":\"https://docs.sunbird.ai\",\"publisher\":{\"@id\":\"https://docs.sunbird.ai/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.sunbird.ai/api-reference/legacy/ai/sunflower-inference#webpage\",\"url\":\"https://docs.sunbird.ai/api-reference/legacy/ai/sunflower-inference\",\"name\":\"Sunflower Inference\",\"description\":\"Professional Sunflower inference endpoint for multilingual chat completions. Deprecated: use POST /tasks/chat/completions instead. This endpoint provides access to Sunbird AI's Sunflower model, specialized in: - Multilingual conversations in Ugandan languages (Luganda, Acholi, Ateso, etc.) - Cross-lingual translations and explanations - Cultural context understanding - Educational content in local languages Features: - Automatic retry with exponential backoff - Context-aware responses - Usage tracking and monitoring - Support for custom system messages - Message history management Args: request: The FastAPI request object (required for rate limiting). chat_request: The chat request containing messages and parameters. background_tasks: FastAPI background tasks for async operations. current_user: The authenticated user (enforces authentication). service: The inference service instance. Returns: SunflowerChatResponse containing the AI's response and usage stats. Raises: BadRequestError: For validation errors. ValidationError: For invalid message format. ServiceUnavailableError: If the model is loading or request times out. ExternalServiceError: For empty model response or unexpected errors. Example: Request body with message history: { \\\"messages\\\": [ {\\\"role\\\": \\\"system\\\", \\\"content\\\": \\\"You are Sunflower...\\\"}, {\\\"role\\\": \\\"user\\\", \\\"content\\\": \\\"Translate 'How are you?' to Luganda.\\\"}, {\\\"role\\\": \\\"assistant\\\", \\\"content\\\": \\\"In Luganda, 'How are you?' is 'Oli otya?'.\\\"}, {\\\"role\\\": \\\"user\\\", \\\"content\\\": \\\"How do I say 'Good morning' in Acholi?\\\"} ], \\\"model_type\\\": \\\"qwen\\\", \\\"temperature\\\": 0.3 } Response: { \\\"content\\\": \\\"In Acholi, 'Good morning' is 'Icwiny atir'.\\\", \\\"model_type\\\": \\\"qwen\\\", \\\"usage\\\": {\\\"completion_tokens\\\": 15, \\\"prompt_tokens\\\": 50, \\\"total_tokens\\\": 65}, \\\"processing_time\\\": 2.5, \\\"inference_time\\\": 2.0, \\\"message_count\\\": 5 }\",\"dateModified\":\"2026-06-18T16:56:26.157Z\",\"isPartOf\":{\"@id\":\"https://docs.sunbird.ai#website\"},\"breadcrumb\":{\"@id\":\"https://docs.sunbird.ai/api-reference/legacy/ai/sunflower-inference#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.sunbird.ai/api-reference/legacy/ai/sunflower-inference#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Sunbird AI API\",\"item\":\"https://docs.sunbird.ai\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Sunflower Inference\",\"item\":\"https://docs.sunbird.ai/api-reference/legacy/ai/sunflower-inference\"}]},{\"@type\":[\"TechArticle\",\"APIReference\"],\"@id\":\"https://docs.sunbird.ai/api-reference/legacy/ai/sunflower-inference#apireference\",\"headline\":\"Sunflower Inference\",\"name\":\"Sunflower Inference\",\"description\":\"Professional Sunflower inference endpoint for multilingual chat completions. Deprecated: use POST /tasks/chat/completions instead. This endpoint provides access to Sunbird AI's Sunflower model, specialized in: - Multilingual conversations in Ugandan languages (Luganda, Acholi, Ateso, etc.) - Cross-lingual translations and explanations - Cultural context understanding - Educational content in local languages Features: - Automatic retry with exponential backoff - Context-aware responses - Usage tracking and monitoring - Support for custom system messages - Message history management Args: request: The FastAPI request object (required for rate limiting). chat_request: The chat request containing messages and parameters. background_tasks: FastAPI background tasks for async operations. current_user: The authenticated user (enforces authentication). service: The inference service instance. Returns: SunflowerChatResponse containing the AI's response and usage stats. Raises: BadRequestError: For validation errors. ValidationError: For invalid message format. ServiceUnavailableError: If the model is loading or request times out. ExternalServiceError: For empty model response or unexpected errors. Example: Request body with message history: { \\\"messages\\\": [ {\\\"role\\\": \\\"system\\\", \\\"content\\\": \\\"You are Sunflower...\\\"}, {\\\"role\\\": \\\"user\\\", \\\"content\\\": \\\"Translate 'How are you?' to Luganda.\\\"}, {\\\"role\\\": \\\"assistant\\\", \\\"content\\\": \\\"In Luganda, 'How are you?' is 'Oli otya?'.\\\"}, {\\\"role\\\": \\\"user\\\", \\\"content\\\": \\\"How do I say 'Good morning' in Acholi?\\\"} ], \\\"model_type\\\": \\\"qwen\\\", \\\"temperature\\\": 0.3 } Response: { \\\"content\\\": \\\"In Acholi, 'Good morning' is 'Icwiny atir'.\\\", \\\"model_type\\\": \\\"qwen\\\", \\\"usage\\\": {\\\"completion_tokens\\\": 15, \\\"prompt_tokens\\\": 50, \\\"total_tokens\\\": 65}, \\\"processing_time\\\": 2.5, \\\"inference_time\\\": 2.0, \\\"message_count\\\": 5 }\",\"url\":\"https://docs.sunbird.ai/api-reference/legacy/ai/sunflower-inference\",\"mainEntityOfPage\":{\"@id\":\"https://docs.sunbird.ai/api-reference/legacy/ai/sunflower-inference#webpage\"},\"dateModified\":\"2026-06-18T16:56:26.157Z\",\"publisher\":{\"@id\":\"https://docs.sunbird.ai/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.sunbird.ai#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Sunbird AI API\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Sunbird AI API","nav":{"global":null,"versions":[{"version":"v2.1","tag":"Latest","pages":[{"title":"v2.1","href":"/introduction"}]},{"version":"v1","tag":"Deprecated","anchors":[{"anchor":"General","icon":"book-open","pages":[{"title":"General","href":"/introduction"}]},{"anchor":"Models","icon":"layer-group","pages":[{"title":"Models","href":"/sunflower/overview"}]},{"anchor":"API Reference (Legacy)","icon":"triangle-exclamation","groups":[{"group":"Overview","pages":[{"title":"Legacy API (Deprecated)","href":"/api-reference/legacy/introduction"}]},{"group":"Legacy Speech to Text","pages":[{"title":"Speech to Text","openapi":"api-reference/openapi-legacy.json POST /tasks/stt","deprecated":true,"href":"/api-reference/legacy/speech/stt"},{"title":"Transcribe Audio (Modal Whisper)","openapi":"api-reference/openapi-legacy.json POST /tasks/modal/stt","deprecated":true,"href":"/api-reference/legacy/speech/modal-stt"},{"title":"Speech to Text from GCS","openapi":"api-reference/openapi-legacy.json POST /tasks/stt_from_gcs","deprecated":true,"href":"/api-reference/legacy/speech/stt-from-gcs"},{"title":"Speech to Text (Org)","openapi":"api-reference/openapi-legacy.json POST /tasks/org/stt","deprecated":true,"href":"/api-reference/legacy/speech/org-stt"}]},{"group":"Legacy Text to Speech","pages":[{"title":"Text to Speech","openapi":"api-reference/openapi-legacy.json POST /tasks/tts","deprecated":true,"href":"/api-reference/legacy/tts/tts"},{"title":"Generate TTS Audio (Modal)","openapi":"api-reference/openapi-legacy.json POST /tasks/modal/tts","deprecated":true,"href":"/api-reference/legacy/tts/modal-tts"},{"title":"Stream TTS Audio","openapi":"api-reference/openapi-legacy.json POST /tasks/modal/tts/stream","deprecated":true,"href":"/api-reference/legacy/tts/modal-tts-stream"},{"title":"Stream TTS Audio with Final URL","openapi":"api-reference/openapi-legacy.json POST /tasks/modal/tts/stream-with-url","deprecated":true,"href":"/api-reference/legacy/tts/modal-tts-stream-url"},{"title":"Refresh Signed URL","openapi":"api-reference/openapi-legacy.json GET /tasks/modal/tts/refresh-url","deprecated":true,"href":"/api-reference/legacy/tts/modal-tts-refresh-url"},{"title":"List Available Speakers","openapi":"api-reference/openapi-legacy.json GET /tasks/modal/tts/speakers","deprecated":true,"href":"/api-reference/legacy/tts/modal-tts-speakers"},{"title":"List Orpheus Speakers","openapi":"api-reference/openapi-legacy.json GET /tasks/modal/orpheus/speakers","deprecated":true,"href":"/api-reference/legacy/tts/orpheus-speakers"},{"title":"List Orpheus Speakers for a Language","openapi":"api-reference/openapi-legacy.json GET /tasks/modal/orpheus/speakers/{language}","deprecated":true,"href":"/api-reference/legacy/tts/orpheus-speakers-language"},{"title":"Synthesize Speech (Orpheus-3B)","openapi":"api-reference/openapi-legacy.json POST /tasks/modal/orpheus/tts","deprecated":true,"href":"/api-reference/legacy/tts/orpheus-tts"},{"title":"Batch Synthesize Speech (Orpheus-3B)","openapi":"api-reference/openapi-legacy.json POST /tasks/modal/orpheus/tts/batch","deprecated":true,"href":"/api-reference/legacy/tts/orpheus-tts-batch"},{"title":"Text to Speech (RunPod)","openapi":"api-reference/openapi-legacy.json POST /tasks/runpod/tts","deprecated":true,"description":"RunPod Text-to-Speech endpoint.\nConverts input text to speech audio using a specified speaker voice.\n\nThis endpoint uses the RunPod inference server for TTS generation.\n\nArgs:\n\n request (Request): The incoming HTTP request object (required for rate limiting).\n tts_request (TTSRequest): The request body containing text, speaker ID, and synthesis parameters.\n background_tasks (BackgroundTasks): FastAPI background tasks for logging.\n current_user (User): The authenticated user making the request.\n\nReturns:\n\n dict: A dictionary containing the generated speech audio with signed URL and metadata.\n\nRaises:\n\n BadRequestError: For invalid input parameters.\n ValidationError: For invalid speaker_id, temperature, or max_new_audio_tokens.\n ServiceUnavailableError: If the service is unavailable due to timeout.\n ExternalServiceError: For connection errors or worker errors.\n\nSpeaker IDs:\n\n 241: Acholi (female)\n 242: Ateso (female)\n 243: Runyankore (female)\n 245: Lugbara (female)\n 246: Swahili (male)\n 248: Luganda (female)\n\nExample Response:\n {\n \"output\": {\n \"audio_url\": \"https:...\",\n \"blob\": \"tts/20251003082338_f2ff97b3-9cb9-42fb-850d-0657f51e539e.mp3\",\n \"sample_rate\": 16000\n }\n }","href":"/api-reference/legacy/tts/runpod-tts"}]},{"group":"Legacy AI","pages":[{"title":"Sunflower Inference","openapi":"api-reference/openapi-legacy.json POST /tasks/sunflower_inference","deprecated":true,"href":"/api-reference/legacy/ai/sunflower-inference"},{"title":"Sunflower Simple Inference","openapi":"api-reference/openapi-legacy.json POST /tasks/sunflower_simple","deprecated":true,"description":"Simple Sunflower inference endpoint for single instruction/response.\n\n**Deprecated**: use POST /tasks/chat/completions instead.\n\nThis is a simplified interface for users who want to send a single instruction\nrather than managing conversation history. Uses form-based input for easier\nintegration with simple clients.\n\nArgs:\n\n request: The FastAPI request object (required for rate limiting).\n background_tasks: FastAPI background tasks for async operations.\n instruction: The question or instruction for the AI.\n model_type: Either 'qwen' (default) or 'gemma'.\n temperature: Controls randomness (0.0 = deterministic, 1.0 = creative).\n system_message: Optional custom system message.\n db: Database session.\n current_user: The authenticated user.\n\nReturns:\n\n Dictionary containing response, model_type, processing_time, usage, and success.\n\nRaises:\n\n BadRequestError: For validation errors.\n ValidationError: For invalid model type.\n ServiceUnavailableError: If the model is loading or request times out.\n ExternalServiceError: For unexpected errors.\n\nExample:\n\n Form data:\n - instruction: \"Translate 'hello' to Luganda\"\n - model_type: \"qwen\"\n - temperature: 0.3\n\n Response:\n {\n \"response\": \"In Luganda, 'hello' is 'Gyebaleko' or 'Wasuze otya' (Good morning).\",\n \"model_type\": \"qwen\",\n \"processing_time\": 1.5,\n \"usage\": {\"completion_tokens\": 20, \"prompt_tokens\": 10, \"total_tokens\": 30},\n \"success\": true\n }","href":"/api-reference/legacy/ai/sunflower-simple"},{"title":"Summarise","openapi":"api-reference/openapi-legacy.json POST /tasks/summarise","deprecated":true,"href":"/api-reference/legacy/ai/summarise"}]}]}]}]},"basePath":"","title":"Sunflower Inference - Sunbird AI API","buildId":"dpl_345ReqzYaAjzS9QpeJemsKdb7KDj","deploymentId":"dpl_345ReqzYaAjzS9QpeJemsKdb7KDj","dynamics":["c2aa737661","2b790eda92","b0f84f53ff","a9bb46feb3"],"chunks":["OpenApiReferenceProvider-C8RPHPxo.js","utils-0BK-9q6z.js","cloneDeep-izs3Hzxb.js","_Uint8Array-BVIqJ90l.js","isObjectLike-C8vmzPEN.js","isArray-Dcu1dQ5t.js","utils-DfjzsUJT.js","toString-BX-iyh8G.js","isSymbol-CSH9U2Gm.js","addUniqueKeysToSchema-B4v9psJ4.js","snippetPresets-CpTQv-Ez.js","style-to-object-BY3JEAdk.js","v4-DIgz8zy6.js","ApiExamples-BNP-Fvr0.js","isEqual-BfaiBbcl.js","usePlaygroundInputsStore-BSgu6h1D.js","shallow-Biv1i9Gs.js","getApiPlaygroundDisplay-BoGOXhtF.js","CodeSnippet-DvQoT18_.js","CodeSnippets-Dnpa15xT.js","Page-Buji1S4J.js","getPastedJson-xAIyhUFE.js","icon-S6FBih11.js","MethodPill-SaYeUZyk.js","DuplicateIcon-Cs-p3v2Q.js","createIcon-DjCFEoHq.js","DynamicMarkdown-BcnBltEQ.js","SectionHeading-BUBl0eEF.js","axios-vUo_bRtp.js","Markdown-h4cOoD8d.js","clsx-B2v50t8t.js","lib-DuNMoZ05.js","lib-B8HbPgcC.js","html-void-elements-mCSPHezU.js","dist-DJnKvr0g.js","katex-YMM-FMeD.js","marked.esm-CZWythHk.js","AssistantPageLink-BHrrjR1K.js"]}