> ## Documentation Index
> Fetch the complete documentation index at: https://docs.doglytdc.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# AI and logs

> Scripts API routes: AI and logs.

| Method | Path | What it does |
| - | - | - |
| `GET` | `/scripts/{script_id}/logs` | Last 100 calls to this API for the script (without body or token). |
| `POST` | `/ai/chat` | DoglyTdc AI (openai/gpt-6-astra, no model switching). Charges actual credits to the script owner. stream:true returns SSE in OpenAI format. |

## GET /scripts/\{script\_id}/logs

Last 100 calls to this API for the script (without body or token).

**Authentication:** Scope: `scripts.read`

**Path parameters:** `script_id`

**Response:** `{ method, route, status, ms, credential, created_at }[]`

```bash cURL theme={null}
curl -X GET "https://ucsyxzpdbnuyehizezvb.supabase.co/functions/v1/doglytdc-scripts-api/scripts/{script_id}/logs" \
  -H "Authorization: Bearer dts_SEU_TOKEN"
```

## POST /ai/chat

DoglyTdc AI (openai/gpt-6-astra, no model switching). Charges actual credits to the script owner. stream:true returns SSE in OpenAI format.

**Authentication:** Scope: `ai`

> [!NOTE]
>
> Fixed GPT-6 Luna model, no model switching. Charges actual credits to the script owner. With `stream: true`, returns `text/event-stream` in OpenAI format. Limit: 20 messages per minute per person and script.

**Body:** `{ script_id? (required unless using a script token), messages: { role, content }[], max_tokens?, stream? }`

**Response:** `{ model, content, usage, credits } | text/event-stream`

```bash cURL theme={null}
curl -X POST "https://ucsyxzpdbnuyehizezvb.supabase.co/functions/v1/doglytdc-scripts-api/ai/chat" \
  -H "Authorization: Bearer dts_SEU_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"script_id":"<script_id>","messages":[{"role":"user","content":"Oi"}]}'
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.