Source: https://ailoot.ai/docs/connect/curl/
Canonical: https://ailoot.ai/docs/en/connect/curl/
Language: en

[Connection](https://ailoot.ai/docs/en/) 

# HTTP requests (curl)

[Markdown](https://ailoot.ai/docs/en/connect/curl/index.md)

Use the API without an SDK: any language or tool that can send an HTTP request.

All requests are sent to `https://api.ailoot.ai` over HTTPS, with a JSON body or multipart for file uploads. Send the key in one of the authentication headers.

The key is in the variable

```bash
export AILOOT_API_KEY="sk-..."
```

## [](https://ailoot.ai/docs/connect/curl/#chat)OpenAI Chat Completions

```bash
curl https://api.ailoot.ai/v1/chat/completions \
  -H "Authorization: Bearer $AILOOT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-5-5",
    "messages": [
      {"role": "user", "content": "Explain what an API is in two sentences."}
    ]
  }' 
```

## [](https://ailoot.ai/docs/connect/curl/#stream)Streaming responses

The `-N` flag disables curl buffering so events are printed as soon as they arrive. Each event starts with `data:`; the stream ends with the line `data: [DONE]`.

Ailoot delivers billed text responses after calculating their cost. With `stream: true` the format is still streaming (SSE), but the text arrives as one block when the model finishes, rather than word by word. If a response takes longer than about 15 seconds, Chat Completions, Responses, and Messages streams first send `: ping` control lines, roughly every 10 seconds, followed by a `: ailoot-charged-usd …` line containing the amount charged and then the data itself. SDKs skip these control lines.

```bash
curl -N https://api.ailoot.ai/v1/chat/completions \
  -H "Authorization: Bearer $AILOOT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "deepseek-v4-pro", "stream": true,
       "messages": [{"role": "user", "content": "Count to five"}]}' 
```

## [](https://ailoot.ai/docs/connect/curl/#responses)OpenAI Responses

```bash
curl https://api.ailoot.ai/v1/responses \
  -H "Authorization: Bearer $AILOOT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "gpt-6.1-sol", "input": "Write a birthday toast for a colleague"}' 
```

## [](https://ailoot.ai/docs/connect/curl/#messages)Anthropic Messages

```bash
curl https://api.ailoot.ai/v1/messages \
  -H "x-api-key: $AILOOT_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-5-5",
    "max_tokens": 1024,
    "messages": [{"role": "user", "content": "Hello! What can you do?"}]
  }' 
```

## [](https://ailoot.ai/docs/connect/curl/#gemini)Gemini

```bash
curl "https://api.ailoot.ai/v1beta/models/gemini-3.8-flash:generateContent" \
  -H "x-goog-api-key: $AILOOT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "contents": [
      {"role": "user", "parts": [{"text": "Come up with three names for a coffee shop."}]}
    ]
  }' 
```

## [](https://ailoot.ai/docs/connect/curl/#models)Model list

```bash
curl -s https://api.ailoot.ai/v1/models \
  -H "Authorization: Bearer $AILOOT_API_KEY" | jq -r '.data[].id'
```

## [](https://ailoot.ai/docs/connect/curl/#headers)Response headers

Add `-i` to view the headers. `X-Request-ID` — the request ID, which also appears in error messages. `X-Ailoot-Charged-USD` — the amount charged for the billed text response. For all headers, see [How it works](https://ailoot.ai/docs/en/how-it-works/#headers).

Still have questions? Send your Request ID and a description — we'll help you troubleshoot.[Contact support](mailto:support@ailoot.ai)

## Ailoot · The company and its project portfolio





Ailoot combines established operating experience, a large client base, stable service and ongoing KPI control.





The company and its project portfolio: millions of customers; monthly sales in the billions.





Ailoot brings that operating experience to API access for AI features in customer products, agents, applications and automations.
