Chat and Voice
The chat interface is a synchronous interface and does not enter the task list. Points will be deducted immediately according to the background price if the chat is successful, and refunds will be automatically made if the upstream fails.
Send message
curl -X POST https://api.girllab.io/v1/chat/messages \
-H "Authorization: Bearer sk-your-key" \
-H "Content-Type: application/json" \
-d '{
"message":"Hello",
"persona":"You are a concise travel assistant.",
"temperature":0.8,
"top_p":0.8,
"max_tokens":2048
}'If conversation_id is not passed for the first time, the new session ID will be given in the return value. The context is maintained by passing this ID back on subsequent sends. The personas and parameters passed in for the first time will be saved to the session.
Session Management
| Operations | Requests |
|---|---|
| Session List | GET /v1/chat/conversations |
| Message History | GET /v1/chat/conversations/{id}/messages |
| Save settings | PATCH /v1/chat/conversations/{id}/config |
| Delete session | DELETE /v1/chat/conversations/{id} |
The return structure of message history is:
{
"data": {
"config": {"persona":"...","temperature":0.8,"top_p":0.8,"max_tokens":2048},
"messages": [{"id":1,"role":"user","content":"Hello","created_at":"..."}]
}
}Speech to text
POST /v1/chat/transcribe, incoming { "audio": "data:audio/webm;base64,..." }. Pure base64 is also supported, with a maximum decoded size of 10MB; text and language are returned synchronously.
Text to Speech
POST /v1/chat/speech, incoming { "text": "Hello", "voice": "Cherry" }. Synchronously return MP3 data URI: { "audio": "data:audio/mpeg;base64,..." }, which can be directly assigned to src of web page <audio>.