Menu

Chat API

Conversational AI with context-aware responses

💰 Cost: variable — credits are consumed when required; session-based users have a daily free allowance

Simple explanation

Send a user query and optional conversation history. The API returns a context-aware reply and updates credit usage. Include X-API-Key and Content-Type: application/json.

Endpoint

POST https://api.bisakofi.com/api/chat

Authentication

🔑 Requires API Key in X-API-Key header. Get your API key by signing up at bisakofi.com/signup.

Request

Headers
X-API-Key: bsk_your_api_key_here
Content-Type: application/json
Body Parameters
  • query (optional): A single user message. If you provide messages or memory, query is optional.

    messages (optional): Array of conversation history for context. Format: [{ role: "user" | "assistant", content: string }]

    memory (optional): Additional context or system instructions.

    userId (optional): Provide when using API-key authentication (server-to-server).

    language (optional): If supplied and not en, incoming messages are translated to English before calling the AI.

Response

{
  "aiResponse": "BisaKofi is an AI platform specialized in Ghanaian languages...",
  "creditsRemaining": 95
}

Examples

Simple Query
const response = await fetch('https://api.bisakofi.com/api/chat', {
  method: 'POST',
  headers: {
    'X-API-Key': 'bsk_your_api_key_here',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    query: 'What is BisaKofi?'
  })
});

const data = await response.json();
Python Example
import requests

response = requests.post('https://api.bisakofi.com/api/chat',
    headers={'X-API-Key': 'bsk_your_api_key_here'},
    json={
    'query': 'Tell me about Twi language',
    'messages': [
      {'role': 'user', 'content': 'What languages do you support?'},
      {'role': 'assistant', 'content': 'I support Twi, Ewe, Ga, Dagbani...'}
    ],
    'language': 'ak'  # optional
    }
)

data = response.json()
print(data['response'])

What did you think of this content?

like-icon

It was helpful

dislike-icon

It was not helpful

feedback-icon

I have a feedback