API Reference
Technical specification for AI microservice.
API Reference
The Tars AI service provides a unified interface for LLM text generation and image creation. All requests must be sent as JSON.
Image Generation
Endpoint for high-resolution image synthesis using FLUX.2-dev.
- URL:
/generate-image - Method:
POST - Model:
black-forest-labs/FLUX.2-dev
Body Parameters
| Property | Type | Required | Description |
|---|---|---|---|
prompt | string | Yes | Text description of the image to be generated. |
Response Schema
| Property | Type | Description |
|---|---|---|
success | boolean | Indicates if the generation was successful. |
base64 | string | Base64 encoded string of the generated image. |
mimeType | string | The MIME type of the image (e.g., image/png). |
Chat Completions
Streaming endpoint for multi-provider text generation.
- URL:
/chat - Method:
POST - Protocol: Server-Sent Events (SSE)
Body Parameters
| Property | Type | Required | Description |
|---|---|---|---|
messages | array | Yes | Array of message objects: { role, content }. |
Example Request
curl -X POST https://ai-service.tarsdevs.com/chat \
-H "Content-Type: application/json" \
-d '{
"messages": [
{ "role": "user", "content": "Explain quantum computing." }
]
}'User Management
Direct access to the PostgreSQL user directory.
List Users
- URL:
/users - Method:
GET
Create User
- URL:
/users - Method:
POST - Body:
{ "name": "string", "email": "string" }
Delete User
- URL:
/users/:id - Method:
DELETE
Get User
- URL:
/users/:id - Method:
GET