fature.al është platforma e faturimit dhe fiskalizimit për bizneset në Shqipëri. Hap një llogari
Skip to content
fature.al API Menu

Chat Completions

POST /api/v1/ai/chat/completions Requires authentication Rate limited by the `api-global` limiter v1

Send a bearer token, plus the X-Client-Id and X-Client-Secret headers in the Authorization header.

URL-ja e plotë: https://fature.al/api/v1/ai/chat/completions

Body parameters

Name Tipi E detyrueshme Përshkrimi
model string, maxLength 64 yes
messages array yes
stream boolean no

Përgjigjet

201 Created

Field Tipi Përshkrimi
error object
error.message any
error.type any
error.param any, nullable
error.code any, nullable

401 Unauthenticated

Field Tipi Përshkrimi
message string

Shembull kërkese

cURL
curl -X POST 'https://fature.al/api/v1/ai/chat/completions' \
  -H 'Authorization: Bearer YOUR_TOKEN' \
  -H 'X-Client-Id: YOUR_CLIENT_ID' \
  -H 'X-Client-Secret: YOUR_CLIENT_SECRET' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "model",
    "messages": [
        "Hello there"
    ],
    "stream": true
}'
PHP (Laravel)
use Illuminate\Support\Facades\Http;

$response = Http::withHeaders([
    'Authorization' => 'Bearer YOUR_TOKEN',
    'X-Client-Id' => 'YOUR_CLIENT_ID',
    'X-Client-Secret' => 'YOUR_CLIENT_SECRET',
    'Accept' => 'application/json',
    'Content-Type' => 'application/json',
])->post('https://fature.al/api/v1/ai/chat/completions', [
    'model' => 'model',
    'messages' => [
        'Hello there',
    ],
    'stream' => true,
]);

$data = $response->json();
PHP (Guzzle)
use GuzzleHttp\Client;

$client = new Client();

$response = $client->request('POST', 'https://fature.al/api/v1/ai/chat/completions', [
    'headers' => [
        'Authorization' => 'Bearer YOUR_TOKEN',
        'X-Client-Id' => 'YOUR_CLIENT_ID',
        'X-Client-Secret' => 'YOUR_CLIENT_SECRET',
        'Accept' => 'application/json',
        'Content-Type' => 'application/json',
    ],
    'json' => [
        'model' => 'model',
        'messages' => [
            'Hello there',
        ],
        'stream' => true,
    ],
]);

$data = json_decode((string) $response->getBody(), true);
JavaScript
const response = await fetch('https://fature.al/api/v1/ai/chat/completions', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
    'X-Client-Id': 'YOUR_CLIENT_ID',
    'X-Client-Secret': 'YOUR_CLIENT_SECRET',
    'Accept': 'application/json',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
      "model": "model",
      "messages": [
          "Hello there"
      ],
      "stream": true
  })
});

const data = await response.json();

Shembull përgjigjeje

201
{
    "error": {
        "message": "Hello there",
        "type": "type",
        "param": "param",
        "code": "code"
    }
}
401
{
    "message": "Unauthenticated."
}

Regjistrimi është falas.

Regjistrohu në fature.al

This page as Markdown, or the whole API as OpenAPI.