Pawa AI API Reference

Complete reference for Pawa AI platform APIs

API Endpoints

Chat Request

POST/v1/chat/request

This endpoint is used to receive chat request from user in sandbox and return the answer.

NameTypeRequiredDescription
modelstringRequiredThe AI model to use for the chat request
messagesarrayRequiredArray of message objects representing the conversation
temperaturenumberOptionalControls randomness in response generation (0.0 to 1.0)
max_tokensnumberOptionalMaximum number of tokens in the response
streambooleanOptionalWhether to stream the response
Requestbash
curl -X POST "https://staging.api.pawa-ai.com/v1/chat/request" \
  -H "Authorization: Bearer PAWA_AI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "pawa-v1-ember-20240924",
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "type": "text",
            "text": "What is the current president of Tanzania?"
          }
        ]
      }
    ],
    "temperature": 0.1,
    "max_tokens": 4096,
    "stream": false
  }'
JSON Responsejson
{
  "success": true,
  "message": "Chat request processed successfully",
  "data": {
    "request": [
      {
        "finish_reason": "stop",
        "message": {
          "role": "assistant",
          "content": "Mimi ni pawa..."
        },
        "matched_stop": 106
      }
    ],
    "created": "1753304351",
    "model": "pawa-v1-blaze-20250318",
    "object": "chat.request"
  }
}

Create Knowledge Base

POST/v1/store/knowledge-base

This endpoint used to create the new knowledge base in the Pawa platform system.

NameTypeRequiredDescription
namestringRequiredName of the knowledge base
descriptionstringRequiredDescription of the knowledge base content and purpose
Requestbash
curl -X POST "https://staging.api.pawa-ai.com/v1/store/knowledge-base" \
  -H "Authorization: Bearer PAWA_AI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Pawa Knowledge Base",
    "description": "This is a sample knowledge base for Pawa."
  }'
JSON Responsejson
{
  "success": true,
  "message": "Knowledge Base created successful",
  "data": {
    "id": 0,
    "name": "WCF KnoledgeBase",
    "kbReferenceId": "kb-858bf836-b27a-4a1e-8639-3fa1a863d758",
    "description": "The knoledge about answering questions relating to the WCF ( Workers Compensation Fund) in Tanzania",
    "status": "ACTIVE",
    "createdAt": "2021-09-01T00:00:00.000Z",
    "updatedAt": "2021-09-01T00:00:00.000Z"
  }
}

Text to Speech

POST/v1/voice/text-to-speech

This endpoint converts text into streaming audio.

NameTypeRequiredDescription
textstringRequiredThe text to convert to speech
voicestringRequiredVoice model to use for synthesis
modelstringRequiredTTS model version
temperaturenumberOptionalControls voice variation (0.0 to 1.0)
max_tokensnumberOptionalMaximum audio length in tokens
Requestbash
curl -X POST "https://staging.api.pawa-ai.com/v1/voice/text-to-speech" \
  -H "Authorization: Bearer PAWA_AI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Hello, how are you?",
    "voice": "ame",
    "model": "pawa-tts-v1-20250704",
    "temperature": 0.5
  }' \
  --output audio.mp3
Audio Response

This endpoint returns audio data in audio/mpeg format.

Speech to Text

POST/v1/voice/speech-to-text

This endpoint converts a single audio file into text.

NameTypeRequiredDescription
filefileRequiredAudio file to transcribe (multipart/form-data)
modelstringRequiredSpeech-to-text model version
languagestringOptionalLanguage code (e.g., "sw" for Swahili, "en" for English)
promptstringOptionalOptional prompt to guide transcription
temperaturenumberOptionalControls transcription creativity (0.0 to 1.0)
Requestbash
curl -X POST "https://staging.api.pawa-ai.com/v1/voice/speech-to-text" \
  -H "Authorization: Bearer PAWA_AI_API_KEY" \
  -F "file=@audio.mp3" \
  -F "model=pawa-stt-v1-20240701" \
  -F "language=sw" \
  -F "prompt=Nipe maneno yaliyokwenye hii audio" \
  -F "temperature=0.1"
JSON Responsejson
{
  "success": true,
  "message": "Audio transcribed successfully",
  "data": {
    "text": "Hello, my name is Innocent Charles, welcome to Pawa AI"
  }
}

Create Embeddings

POST/v1/vectors/embedding

This endpoint used to create new custom embeddings to the Pawa platform system.

NameTypeRequiredDescription
modelstringRequiredEmbedding model version to use
langstringRequiredLanguage setting ("multi" for multilingual support)
sentencesarrayRequiredArray of text strings to convert to embeddings
Requestbash
curl -X POST "https://staging.api.pawa-ai.com/v1/vectors/embedding" \
  -H "Authorization: Bearer PAWA_AI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "pawa-embedding-v1-20240701",
    "lang": "multi",
    "sentences": [
      "Hello world",
      "How are you?"
    ]
  }'
JSON Responsejson
{
  "success": true,
  "message": "Embeddings created successfully",
  "data": {
    "embeddings": [
      [
        0.0047908169,
        -0.0000800654,
        -0.0000212658,
        0.0144227119,
        0.0173993539,
        -0.0002167973
      ],
      [
        0.0047908169,
        -0.0000800654,
        -0.0000212658,
        0.0144227119,
        0.0173993539,
        -0.0002167973
      ]
    ]
  }
}

Need Help?

Check out our documentation or contact our support team for assistance.