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

# Guida Rapida LLM

Sunra fornisce tre endpoint API LLM, ciascuno con un formato diverso. Tutti e tre utilizzano la stessa autenticazione e lo stesso base URL (`https://api-llm.sunra.ai`), quindi puoi scegliere il formato più adatto al tuo stack.

Prima di iniziare, ottieni una API key dalla tua [dashboard](https://sunra.ai/dashboard/api-tokens).

## Chat Completions — `/v1/chat/completions`

L'endpoint [Chat Completions](/it/llm/chat) segue il formato **OpenAI Chat Completions**. Accetta un elenco di messaggi con ruoli (`system`, `user`, `assistant`) e restituisce una completion.

Usa questo endpoint quando vuoi compatibilità diretta con gli SDK e i tool di OpenAI.

**Funzionalità principali:** streaming, function calling, vision (immagini, audio, video, file), reasoning, structured outputs (JSON schema / grammar), logprobs.

```bash theme={null}
curl -X POST https://api-llm.sunra.ai/v1/chat/completions \
  -H "Authorization: Bearer <SUNRA_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-4o",
    "messages": [
      { "role": "system", "content": "You are a helpful assistant." },
      { "role": "user", "content": "What is the capital of France?" }
    ]
  }'
```

## Anthropic Messages — `/v1/messages`

L'endpoint [Anthropic Messages](/it/llm/messages) segue il formato **Anthropic Messages API**. Utilizza ruoli di messaggio `user` / `assistant` con blocchi di contenuto ricchi e un parametro `system` separato.

Usa questo endpoint quando vuoi accesso nativo ai modelli Anthropic Claude e a funzionalità come extended thinking, prompt caching, citations e built-in tools (web search, code execution).

**Funzionalità principali:** streaming, extended thinking, prompt caching, tool use (custom + built-in), input PDF/documenti, citations, structured outputs.

```bash theme={null}
curl -X POST https://api-llm.sunra.ai/v1/messages \
  -H "Authorization: Bearer <SUNRA_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "anthropic/claude-sonnet-4-20250514",
    "max_tokens": 1024,
    "messages": [
      { "role": "user", "content": "Hello, how are you?" }
    ]
  }'
```

## Responses — `/v1/responses`

L'endpoint [Responses](/it/llm/responses) segue il formato **OpenAI Responses API**. Accetta input items flessibili (messaggi, function calls, reasoning) e restituisce structured output items.

Usa questo endpoint quando hai bisogno delle funzionalità più recenti di OpenAI Responses come built-in web search, file search, code interpreter, computer use, integrazione MCP tools o image generation.

**Funzionalità principali:** streaming, function calling, web search, file search, code interpreter, computer use, MCP tools, image generation, reasoning, structured outputs.

```bash theme={null}
curl -X POST https://api-llm.sunra.ai/v1/responses \
  -H "Authorization: Bearer <SUNRA_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-4o",
    "input": [
      { "type": "message", "role": "user", "content": "Hello, how are you?" }
    ]
  }'
```

## Scegliere l'endpoint giusto

|                       | Chat Completions         | Anthropic Messages            | Responses                                                    |
| --------------------- | ------------------------ | ----------------------------- | ------------------------------------------------------------ |
| **Formato**           | OpenAI Chat              | Anthropic Messages            | OpenAI Responses                                             |
| **Ideale per**        | Compatibilità SDK OpenAI | Funzionalità native di Claude | Funzionalità più recenti di OpenAI                           |
| **Streaming**         | SSE                      | SSE                           | SSE                                                          |
| **Function calling**  | Sì                       | Sì (custom + built-in)        | Sì                                                           |
| **Reasoning**         | Sì                       | Extended thinking             | Sì                                                           |
| **Structured output** | JSON schema, grammar     | JSON schema                   | JSON schema                                                  |
| **Built-in tools**    | —                        | Web search, code execution    | Web search, file search, code interpreter, computer use, MCP |

Tutti e tre gli endpoint condividono la stessa autenticazione — basta passare la tua API key come Bearer token nell'header `Authorization`.
