Source: https://ailoot.ai/models/it/grok-4-6/
Canonical: https://ailoot.ai/models/it/grok-4-6/
Language: it

# SpaceXAI: Grok 4.6

[Markdown](https://ailoot.ai/models/it/grok-4-6/index.md) · [JSON](https://ailoot.ai/models/it/grok-4-6/facts.json)

## [SpaceXAI: Grok 4.6](https://ailoot.ai/models/it/grok-4-6/)

Grok 4.6 è stato creato per lavori prolungati su codice, ricerche e progetti interattivi. Riceve testo e immagini e supporta un contesto di 500 000 token e quattro livelli di ragionamento.

- [**Ailoot · Anthropic Messages** `POST /v1/messages` `grok-4.6`](https://ailoot.ai/models/it/grok-4-6/#method-0)
- [**Ailoot · OpenAI Responses** `POST /v1/responses` `grok-4.6`](https://ailoot.ai/models/it/grok-4-6/#method-1)
- [**Ailoot · OpenAI Chat** `POST /v1/chat/completions` `grok-4.6`](https://ailoot.ai/models/it/grok-4-6/#method-2)
- [**Ailoot Ultra · OpenAI Chat** `POST /v1/chat/completions` `grok-4.6`](https://ailoot.ai/models/it/grok-4-6/#method-3)
- [**Ailoot Ultra · Anthropic Messages** `POST /v1/messages` `grok-4.6`](https://ailoot.ai/models/it/grok-4-6/#method-4)
- [**Ailoot · Anthropic Messages** `POST /v1/messages` `grok-4.6-latest`](https://ailoot.ai/models/it/grok-4-6/#method-5)
- [**Ailoot · OpenAI Responses** `POST /v1/responses` `grok-4.6-latest`](https://ailoot.ai/models/it/grok-4-6/#method-6)
- [**Ailoot · OpenAI Chat** `POST /v1/chat/completions` `grok-4.6-latest`](https://ailoot.ai/models/it/grok-4-6/#method-7)
- [**Ailoot Ultra · OpenAI Chat** `POST /v1/chat/completions` `x-ai/grok-4.6`](https://ailoot.ai/models/it/grok-4-6/#method-8)
- [**Ailoot Ultra · Anthropic Messages** `POST /v1/messages` `x-ai/grok-4.6`](https://ailoot.ai/models/it/grok-4-6/#method-9)

Informazioni sul modello

Questa descrizione illustra le funzionalità del modello. Gli input, gli output e le opzioni disponibili in Ailoot per il metodo selezionato sono elencati di seguito.

#### Lavoro prolungato su un progetto

Grok 4.6 è orientato ad attività che proseguono attraverso molti passaggi: studio di un argomento, analisi di materiali, lavoro su una base di codice e creazione di un'applicazione. Negli esempi di xAI, il modello studia un ambito sconosciuto, definisce la struttura del progetto, implementa le interazioni principali e migliora il risultato dopo i riscontri.

L'addestramento ha utilizzato attività di programmazione e lavoro sulle conoscenze, oltre ad ambienti specializzati di sviluppo web, ottimizzazione di kernel di calcolo e progettazione automatizzata. Nei processi prolungati, il produttore segnala la verifica autonoma del lavoro svolto prima di passare alla fase successiva.

#### Progetti interattivi e visivi

Il modello può trasformare un'idea generale di prodotto in una prima versione funzionante, definire struttura e linguaggio visivo dell'applicazione e migliorare poi il progetto per iterazioni. È lavoro su codice e descrizione testuale del risultato: per eseguire, visualizzare e modificare file, l'applicazione ha bisogno degli strumenti corrispondenti.

In ingresso sono supportati **testo e immagini**, in uscita **testo**. In un solo contesto possono rientrare fino a **500 000 token**. Il materiale visivo può essere utilizzato insieme alla domanda; questo modello testuale non crea un'immagine o un video separati.

#### Profondità dell'elaborazione

Sono disponibili `low`, `medium`, `high` e `xhigh`, con `high` come valore standard. La profondità bassa è adatta ad azioni agentiche semplici, quella media all'analisi di dati e materiali lunghi, quella alta ad attività logiche complesse. `xhigh` dedica più impegno alle attività più difficili e, secondo xAI, aumenta la latenza.

Il ragionamento non può essere completamente disattivato. I parametri `presencePenalty`, `frequencyPenalty` e `stop` non vengono utilizzati con modelli di questo tipo. Volume del contesto e profondità scelta dell'elaborazione descrivono proprietà diverse: un'ampia finestra non definisce di per sé una modalità di ragionamento.

#### Collegamento al flusso di lavoro

Grok 4.6 supporta le chiamate di funzioni. Il modello può richiedere più azioni nella stessa risposta; il codice dell'applicazione le esegue, restituisce i risultati e prosegue il dialogo. Per gli strumenti vengono definiti nomi e schemi degli argomenti; la scelta della chiamata può essere automatica o controllata esplicitamente.

Una risposta strutturata è adatta a estrarre dati da documenti e trasmettere il risultato a un programma: si può richiedere JSON oppure JSON secondo uno schema personalizzato. Sono supportati tipi di dati, oggetti annidati, array ed enumerazioni. Per condizioni complesse dello schema, una sola generazione non basta: i vincoli non garantiti strutturalmente vengono verificati nell'applicazione.

Lo scenario principale del modello è proseguire un lavoro significativo su un'attività complessa, unendo analisi, codice e riscontri. Il processo completo è composto da risposte del modello e azioni degli strumenti collegati.

Caso pratico

### Caso pratico

Esempio tecnico in inglese

```
Review a multi-step import design

Review this CSV-import plan: parse rows, insert records, then validate required email fields. Requirement: one invalid row must reject the entire import, with no new records left behind. Propose a corrected sequence, explain transaction boundaries, and list tests for a valid batch, one invalid row and a database failure. Use framework-neutral pseudocode.
```

#### Risultato atteso

```
A corrected import sequence and three test specifications distinguishing validation failure from persistence failure.
```

#### Verificare il risultato

```
Neither an invalid row nor a failed database write leaves a partially imported batch.
```

**Ailoot · Anthropic Messages** `POST /v1/messages` `grok-4.6`

[`grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Core&caller=grok-4.6&fmt=messages)

SpaceXAI /`grok-4.6`

ID del modello

- `grok-4.6`
- `grok-4.6-latest`

### Introduzione

Grok 4.6 è stato creato per lavori prolungati su codice, ricerche e progetti interattivi. Riceve testo e immagini e supporta un contesto di 500 000 token e quattro livelli di ragionamento.

Input accettati

Testo · Immagini

Risultati

Testo

### Disponibile in Ailoot · input e metodi

**Ailoot · Anthropic Messages** `POST /v1/messages`

Tipi di input

`text`, `image`

Tipi di output

`text`

Contesto

500.000 tokens

Output massimo

500.000 tokens

Formato di output

json o SSE

| Campo | Tipo | Requisito | Valori e limiti | Predefinito |
| --- | --- | --- | --- | --- |
| Campo`model` | Tipo`string` | RequisitoObbligatorio | Valori e limiti grok-4.6 | Predefinito— |
| Campo`messages` | Tipo`message[]` | RequisitoObbligatorio | Valori e limiti Numero minimo di elementi: 1 | Predefinito— |
| Campo`messages[].role` | Tipo`string` | RequisitoObbligatorio | Valori e limiti user, assistant | Predefinito— |
| Campo`messages[].content` | Tipo`string\|content_block[]` | RequisitoObbligatorio | Valori e limiti | Predefinito— |
| Campo`system` | Tipo`string\|content_block[]` | RequisitoFacoltativo | Valori e limiti | Predefinito— |
| Campo`max_tokens` | Tipo`integer` | RequisitoObbligatorio | Valori e limiti Minimo: 1 Il limite si applica a: Limite esatto del modello o della scheda selezionati | Predefinito— |
| Campo`stream` | Tipo`boolean` | RequisitoFacoltativo | Valori e limiti | Predefinitofalse |
| Campo`temperature` | Tipo`number` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`top_p` | Tipo`number` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`stop_sequences` | Tipo`string[]` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`tools` | Tipo`tool[]` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`tools[].name` | Tipo`string` | RequisitoFacoltativo | Valori e limiti Si applica quando: Strumento fornito | Predefinito— |
| Campo`tools[].description` | Tipo`string` | RequisitoFacoltativo | Valori e limiti | Predefinito— |
| Campo`tools[].input_schema` | Tipo`JSON_schema` | RequisitoFacoltativo | Valori e limiti | Predefinito— |
| Campo`tool_choice` | Tipo`object` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`thinking.type` | Tipo`string` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`thinking.budget_tokens` | Tipo`integer` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`output_config.effort` | Tipo`string` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`metadata` | Tipo`object` | RequisitoFacoltativo | Valori e limiti | Predefinito— |
| Campo`cache_control` | Tipo`object` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |

Combinazioni di materiali in input

**Testo** · Testo UTF8

`messages[].content o blocco type=text`

**Testo + immagine**

`{type:image,source:{type:base64,media_type,data}} o origine type=url`

Parametri e ciclo di vita del metodo

| Parametro | Contratto |
| --- | --- |
| Parametro`material_types` | Contrattotext, image |
| Parametro`required` | Contrattomodel, messages, max\_tokens |
| Parametro`optional_controls` | Contrattonull |
| Parametro`content_type` | Contrattoapplication/json |
| Parametro`text_file_material` | ContrattoContenuto UTF-8 effettivo inserito come testo; ID di file/URLs richiedono supporto separato ed esatto |

Ciclo di vita: `exact retained published method`

Le strutture dei metodi e gli ID sono esatti; la capacità del fornitore è distinta dall’ammissione delle richieste.

### Tariffe

#### Tariffe dei metodi Ailoot

Input

0,002 USD */ 1K*

Output

0,006 USD */ 1K*

Lettura dalla cache

0,0005 USD */ 1K*

Scrittura nella cache

0,00 USD */ 1K*

Scrittura nella cache, 5 min

0,00 USD */ 1K tokens*

Scrittura nella cache, 1 ora

0,00 USD */ 1K tokens*

#### Prezzi per lunghezza della richiesta · Anthropic Messages

| Dimensione della richiesta, in token | Input | Output | Lettura dalla cache | Scrittura nella cache | Cache 5 min | Cache 1 ora |
| --- | --- | --- | --- | --- | --- | --- |
| Dimensione della richiesta, in token(0; 200.000\] | Input0,002 USD | Output0,006 USD | Lettura dalla cache0,0005 USD | Scrittura nella cache0,00 USD | Cache 5 min0,00 USD | Cache 1 ora0,00 USD |
| Dimensione della richiesta, in token(200.000; ∞) | Input0,004 USD | Output0,012 USD | Lettura dalla cache0,001 USD | Scrittura nella cache0,00 USD | Cache 5 min0,00 USD | Cache 1 ora0,00 USD |

Tariffe in USD per 1K token. Se non è impostata alcuna tariffa, viene ereditata la tariffa base di questo metodo; «—» indica che non è impostata alcuna tariffa base.

Ailoot prenota un importo stimato prima di una richiesta. Dopo il risultato, addebita il costo finale in base all’utilizzo misurato. Per lo streaming, l’addebito usa il record finale di utilizzo. [Come funzionano la prenotazione e l’addebito finale →](https://ailoot.ai/docs/it/billing/reserve/)

#### Dettagli della tariffa di riferimento

I listini di riferimento del modello non modificano la selezione del metodo, i preventivi o gli addebiti. Gli addebiti attivi usano le tariffe del metodo Ailoot selezionato.

Listini di riferimento del modello

#### Prezzi per configurazione

Associa ogni costo alle condizioni indicate. Usa una sola tariffa per ogni insieme di configurazioni alternative.

| Configurazione | Listino delle tariffe | Token di contesto, più di | Token di contesto, fino al limite incluso | Costo |
| --- | --- | --- | --- | --- |
| ConfigurazioneOpenAI Chat · Tariffe base per token | Listino delle tariffeTariffa base | Token di contesto, più di— | Token di contesto, fino al limite inclusoNessun limite superiore | Costo Input · Token in input **$0.004** / 1K token Output · Token in output **$0.012** / 1K token Input · Lettura dalla cache **$0.001** / 1K token Input · Scrittura nella cache **—** / 1K token Input · Scrittura nella cache, 1 ora **—** / 1K token |
| ConfigurazioneOpenAI Chat · Fascia 1 in base alla lunghezza della richiesta | Listino delle tariffe— | Token di contesto, più di0 | Token di contesto, fino al limite incluso200.000 | Costo Input · Token in input **$0.004** / 1K token Output · Token in output **$0.012** / 1K token Input · Lettura dalla cache **$0.001** / 1K token Input · Scrittura nella cache **—** / 1K token Input · Scrittura nella cache, 1 ora **—** / 1K token |
| ConfigurazioneOpenAI Chat · Fascia 2 in base alla lunghezza della richiesta | Listino delle tariffe— | Token di contesto, più di200.000 | Token di contesto, fino al limite inclusoNessun limite superiore | Costo Input · Token in input **$0.008** / 1K token Output · Token in output **$0.024** / 1K token Input · Lettura dalla cache **$0.002** / 1K token Input · Scrittura nella cache **—** / 1K token Input · Scrittura nella cache, 1 ora **—** / 1K token |
| ConfigurazioneAnthropic Messages · Tariffe base per token | Listino delle tariffeTariffa base | Token di contesto, più di— | Token di contesto, fino al limite inclusoNessun limite superiore | Costo Input · Token in input **$0.004** / 1K token Output · Token in output **$0.012** / 1K token Input · Lettura dalla cache **$0.001** / 1K token Input · Scrittura nella cache **—** / 1K token Input · Scrittura nella cache, 1 ora **—** / 1K token |
| ConfigurazioneAnthropic Messages · Fascia 1 in base alla lunghezza della richiesta | Listino delle tariffe— | Token di contesto, più di0 | Token di contesto, fino al limite incluso200.000 | Costo Input · Token in input **$0.004** / 1K token Output · Token in output **$0.012** / 1K token Input · Lettura dalla cache **$0.001** / 1K token Input · Scrittura nella cache **—** / 1K token Input · Scrittura nella cache, 1 ora **—** / 1K token |
| ConfigurazioneAnthropic Messages · Fascia 2 in base alla lunghezza della richiesta | Listino delle tariffe— | Token di contesto, più di200.000 | Token di contesto, fino al limite inclusoNessun limite superiore | Costo Input · Token in input **$0.008** / 1K token Output · Token in output **$0.024** / 1K token Input · Lettura dalla cache **$0.002** / 1K token Input · Scrittura nella cache **—** / 1K token Input · Scrittura nella cache, 1 ora **—** / 1K token |

### Esempi di richieste

#### Ailoot · Anthropic Messages

Esempio di testoInput, immaginePython SDKNode.js SDKStreaming Python

```bash
set -eu
: "${AILOOT_API_KEY:?Set your Ailoot API key}"
: "${AILOOT_TEXT_FILE:?Set your actual UTF-8 source-material file}"
export AILOOT_TEXT_FILE
python3 - <<'PY_REQUEST'
import json,os
from pathlib import Path
p=json.loads('{"model": "grok-4.6", "max_tokens": 1024, "messages": []}')
f=Path(os.environ["AILOOT_TEXT_FILE"])
if not f.is_file():raise SystemExit("Choose your actual UTF-8 source material")
text=f.read_text(encoding="utf-8")
if not text.strip():raise SystemExit("Source material must contain text")
p["messages"]=[{"role":"user","content":"Summarize this material and quote supporting source passages.\n\n"+text}]
Path("request.json").write_text(json.dumps(p,ensure_ascii=False))
PY_REQUEST
curl --fail-with-body --silent --show-error https://api.ailoot.ai/v1/messages \
  -H "x-api-key: $AILOOT_API_KEY" -H 'anthropic-version: 2023-06-01' -H 'Content-Type: application/json' \
  --data-binary @request.json -D response-headers.txt -o result.json
python3 - <<'PY_RESULT'
import json
from pathlib import Path
print(json.dumps(json.loads(Path("result.json").read_text()),ensure_ascii=False,indent=2))
PY_RESULT
```

```bash
set -eu
: "${AILOOT_API_KEY:?Set your Ailoot API key}"
: "${AILOOT_IMAGE_FILE:?Set your actual PNG JPEG or WebP image}"
export AILOOT_IMAGE_FILE
python3 - <<'PY_REQUEST'
import json,os
from pathlib import Path
p=json.loads('{"model": "grok-4.6", "max_tokens": 1024, "messages": [{"role": "user", "content": [{"type": "text", "text": "Read labels and numbers in this image; flag unreadable text."}]}]}')
import base64
f=Path(os.environ["AILOOT_IMAGE_FILE"])
if not f.is_file():raise SystemExit("Choose an actual PNG JPEG or WebP image")
raw=f.read_bytes()
mime="image/png" if raw.startswith(b"\x89PNG\r\n\x1a\n") else "image/jpeg" if raw.startswith(b"\xff\xd8") else "image/webp" if raw[:4]==b"RIFF" and raw[8:12]==b"WEBP" else None
if not mime:raise SystemExit("Use PNG JPEG or WebP")
b64=base64.b64encode(raw).decode()
p["messages"][0]["content"].append({"type":"image","source":{"type":"base64","media_type":mime,"data":b64}})
Path("request.json").write_text(json.dumps(p,ensure_ascii=False))
PY_REQUEST
curl --fail-with-body --silent --show-error https://api.ailoot.ai/v1/messages \
  -H "x-api-key: $AILOOT_API_KEY" -H 'anthropic-version: 2023-06-01' -H 'Content-Type: application/json' \
  --data-binary @request.json -D response-headers.txt -o result.json
python3 - <<'PY_RESULT'
import json
from pathlib import Path
print(json.dumps(json.loads(Path("result.json").read_text()),ensure_ascii=False,indent=2))
PY_RESULT
```

```python
import anthropic
import os

if not os.environ.get("AILOOT_API_KEY", "").strip(): raise SystemExit("Set AILOOT_API_KEY before making a request")
client = anthropic.Anthropic(base_url="https://api.ailoot.ai", api_key=os.environ["AILOOT_API_KEY"], max_retries=0)
msg = client.messages.create(
    model="grok-4.6",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Explain the difference between an observation and a hypothesis in three sentences."}],
)
import base64, json
from pathlib import Path

def save_result(data, stem="result"):
    # Keep every field, including usage, IDs, reasoning and tool requests.
    Path(stem + ".json").write_text(json.dumps(data, ensure_ascii=False, indent=2), encoding="utf-8")
    print(json.dumps(data, ensure_ascii=False, indent=2))
    def save_blob(encoded, suffix, label):
        raw = base64.b64decode(encoded, altchars=b"-_", validate=True)
        ext = "png" if raw.startswith(b"\x89PNG\r\n\x1a\n") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4] == b"RIFF" and raw[8:12] == b"WEBP" else suffix
        file = Path(stem + "-" + label + "." + ext)
        file.write_bytes(raw)
        print("Saved", file)
    for index, block in enumerate(data.get("content") or []):
        print("Content", index, json.dumps(block, ensure_ascii=False))
    for choice in data.get("choices") or []:
        print("Choice", choice.get("index"), json.dumps(choice.get("message", choice.get("delta", {})), ensure_ascii=False))
    for index, item in enumerate(data.get("output") or []):
        print("Output", index, json.dumps(item, ensure_ascii=False))
        if item.get("type") == "image_generation_call" and item.get("result"):
            save_blob(item["result"], item.get("output_format") or "bin", "output-" + str(index))
    for ci, candidate in enumerate(data.get("candidates") or []):
        for pi, part in enumerate((candidate.get("content") or {}).get("parts") or []):
            print("Candidate/part", ci, pi, json.dumps(part, ensure_ascii=False))
            blob = part.get("inlineData") or part.get("inline_data")
            if blob and blob.get("data"):
                mime = blob.get("mimeType") or blob.get("mime_type")
                suffix = {"image/png":"png", "image/jpeg":"jpg", "image/webp":"webp", "audio/wav":"wav", "audio/mpeg":"mp3", "video/mp4":"mp4"}.get(mime, "bin")
                save_blob(blob["data"], suffix, "candidate-" + str(ci) + "-part-" + str(pi))

save_result(msg.to_dict(mode="json"))
```

```js
import Anthropic from "@anthropic-ai/sdk";

if (!process.env.AILOOT_API_KEY?.trim()) throw new Error("Set AILOOT_API_KEY before making a request");
const client = new Anthropic({ baseURL: "https://api.ailoot.ai", apiKey: process.env.AILOOT_API_KEY, maxRetries: 0 });
const msg = await client.messages.create({
  model: "grok-4.6",
  max_tokens: 1024,
  messages: [{ role: "user", content: "Explain the difference between an observation and a hypothesis in three sentences." }],
});
import { writeFileSync } from "node:fs";

function saveResult(data, stem = "result") {
  writeFileSync(stem + ".json", JSON.stringify(data, null, 2));
  console.log(JSON.stringify(data, null, 2));
  const saveBlob = (encoded, suffix, label) => {
    const raw = Buffer.from(encoded, "base64");
    const ext = raw.subarray(0,8).equals(Buffer.from([137,80,78,71,13,10,26,10])) ? "png" : raw[0]===255 && raw[1]===216 ? "jpg" : raw.subarray(0,4).toString()==="RIFF" && raw.subarray(8,12).toString()==="WEBP" ? "webp" : suffix;
    const file = `${stem}-${label}.${ext}`;
    writeFileSync(file, raw); console.log("Saved", file);
  };
  for (const [i, block] of (data.content || []).entries()) console.log("Content", i, JSON.stringify(block));
  for (const choice of data.choices || []) console.log("Choice", choice.index, JSON.stringify(choice.message || choice.delta || {}));
  for (const [i, item] of (data.output || []).entries()) {
    console.log("Output", i, JSON.stringify(item));
    if (item.type === "image_generation_call" && item.result) saveBlob(item.result, item.output_format || "bin", `output-${i}`);
  }
  for (const [ci, candidate] of (data.candidates || []).entries()) {
    for (const [pi, part] of (candidate.content?.parts || []).entries()) {
      console.log("Candidate/part", ci, pi, JSON.stringify(part));
      const blob = part.inlineData || part.inline_data;
      if (blob?.data) {
        const mime = blob.mimeType || blob.mime_type;
        const suffix = ({"image/png":"png", "image/jpeg":"jpg", "image/webp":"webp", "audio/wav":"wav", "audio/mpeg":"mp3", "video/mp4":"mp4"})[mime] || "bin";
        saveBlob(blob.data, suffix, `candidate-${ci}-part-${pi}`);
      }
    }
  }
}

saveResult(msg);
```

```python
import anthropic,os
from pathlib import Path

if not os.environ.get("AILOOT_API_KEY", "").strip(): raise SystemExit("Set AILOOT_API_KEY before making a request")
client=anthropic.Anthropic(base_url="https://api.ailoot.ai",api_key=os.environ["AILOOT_API_KEY"],max_retries=0)
import base64, json
from pathlib import Path

def save_result(data, stem="result"):
    # Keep every field, including usage, IDs, reasoning and tool requests.
    Path(stem + ".json").write_text(json.dumps(data, ensure_ascii=False, indent=2), encoding="utf-8")
    print(json.dumps(data, ensure_ascii=False, indent=2))
    def save_blob(encoded, suffix, label):
        raw = base64.b64decode(encoded, altchars=b"-_", validate=True)
        ext = "png" if raw.startswith(b"\x89PNG\r\n\x1a\n") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4] == b"RIFF" and raw[8:12] == b"WEBP" else suffix
        file = Path(stem + "-" + label + "." + ext)
        file.write_bytes(raw)
        print("Saved", file)
    for index, block in enumerate(data.get("content") or []):
        print("Content", index, json.dumps(block, ensure_ascii=False))
    for choice in data.get("choices") or []:
        print("Choice", choice.get("index"), json.dumps(choice.get("message", choice.get("delta", {})), ensure_ascii=False))
    for index, item in enumerate(data.get("output") or []):
        print("Output", index, json.dumps(item, ensure_ascii=False))
        if item.get("type") == "image_generation_call" and item.get("result"):
            save_blob(item["result"], item.get("output_format") or "bin", "output-" + str(index))
    for ci, candidate in enumerate(data.get("candidates") or []):
        for pi, part in enumerate((candidate.get("content") or {}).get("parts") or []):
            print("Candidate/part", ci, pi, json.dumps(part, ensure_ascii=False))
            blob = part.get("inlineData") or part.get("inline_data")
            if blob and blob.get("data"):
                mime = blob.get("mimeType") or blob.get("mime_type")
                suffix = {"image/png":"png", "image/jpeg":"jpg", "image/webp":"webp", "audio/wav":"wav", "audio/mpeg":"mp3", "video/mp4":"mp4"}.get(mime, "bin")
                save_blob(blob["data"], suffix, "candidate-" + str(ci) + "-part-" + str(pi))

with client.messages.stream(model='grok-4.6',max_tokens=1024,messages=[{"role":"user","content":"Explain observations and hypotheses in three sentences."}]) as stream:
    with Path("stream-events.jsonl").open("w",encoding="utf-8") as log:
        for event in stream:
            payload=event.to_dict(mode="json")
            log.write(json.dumps(payload,ensure_ascii=False)+"\n"); log.flush()
            print(json.dumps(payload,ensure_ascii=False))
    final=stream.get_final_message()
    save_result(final.to_dict(mode="json"),"stream-result")
```

### Ricevi e salva i risultati

#### Ailoot · Anthropic Messages

json o SSE

##### Conserva tutti i risultati completati

Conserva ogni risposta, file e parte di contenuto restituiti per intero.

Conserva tutti i blocchi di contenuto, le firme di ragionamento e gli ID effettivi di utilizzo degli strumenti. Assembla tutti i delta dei blocchi SSE; il primo blocco di testo non è l’uscita completa.

##### Se occorre verificare la risposta originale

Conserva gli ID e le intestazioni di richiesta/risposta. Non viene fornito alcun URL generico per recuperare un’attività testuale.

Campi della risposta

| Campo | Tipo |
| --- | --- |
| Campo`id` | Tipostring |
| Campo`model` | Tipostring |
| Campo`content[]` | Tipotext\|thinking\|tool\_use\|other content block |
| Campo`stop_reason` | Tipostring\|null |
| Campo`usage` | Tipoobject |

Errori e passaggi successivi

| Risposta | Condizione | Passaggio successivo |
| --- | --- | --- |
| Risposta400 · `invalid_request_error` | CondizioneCampi obbligatori, rappresentazione del materiale o valore del parametro non validi | Passaggio successivoCorreggi i campi indicati prima di una nuova richiesta di creazione. |

### Alias

#### Alias del modello

<strong>Ailoot</strong> [`grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Core&caller=grok-4.6&fmt=messages), [`grok-4.6-latest`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Core&caller=grok-4.6-latest&fmt=messages)
**Ailoot Ultra** [`grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Ultra&caller=grok-4.6&fmt=messages), [`x-ai/grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Ultra&caller=x-ai%2Fgrok-4.6&fmt=messages)

#### Alias dei percorsi dei metodi

`/chat/completions`

#### ID di chiamata correlati

[`x-ai/grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Ultra&caller=x-ai%2Fgrok-4.6&fmt=messages), [`grok-4.6-latest`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Core&caller=grok-4.6-latest&fmt=messages), [`grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Core&caller=grok-4.6&fmt=messages), [`grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Ultra&caller=grok-4.6&fmt=messages)

**Ailoot · OpenAI Responses** `POST /v1/responses` `grok-4.6`

[`grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Core&caller=grok-4.6&fmt=responses)

SpaceXAI /`grok-4.6`

ID del modello

- `grok-4.6`
- `grok-4.6-latest`

### Introduzione

Grok 4.6 è stato creato per lavori prolungati su codice, ricerche e progetti interattivi. Riceve testo e immagini e supporta un contesto di 500 000 token e quattro livelli di ragionamento.

Input accettati

Testo · Immagini

Risultati

Testo

### Disponibile in Ailoot · input e metodi

**Ailoot · OpenAI Responses** `POST /v1/responses`

Tipi di input

`text`, `image`

Tipi di output

`text`

Contesto

500.000 tokens

Output massimo

500.000 tokens

Formato di output

json o SSE

| Campo | Tipo | Requisito | Valori e limiti | Predefinito |
| --- | --- | --- | --- | --- |
| Campo`model` | Tipo`string` | RequisitoObbligatorio | Valori e limiti grok-4.6 | Predefinito— |
| Campo`input` | Tipo`string\|input_item[]` | RequisitoObbligatorio | Valori e limiti | Predefinito— |
| Campo`instructions` | Tipo`string` | RequisitoFacoltativo | Valori e limiti | Predefinito— |
| Campo`input[].type` | Tipo`string` | RequisitoFacoltativo | Valori e limiti message, reasoning, function\_call, function\_call\_output | Predefinito— |
| Campo`input[].content` | Tipo`string\|content_part[]` | RequisitoFacoltativo | Valori e limiti | Predefinito— |
| Campo`input[].call_id` | Tipo`string` | RequisitoFacoltativo | Valori e limiti Si applica quando: function\_call\_output; conserva il call\_id effettivamente restituito | Predefinito— |
| Campo`input[].output` | Tipo`string\|content_part[]` | RequisitoFacoltativo | Valori e limiti Si applica quando: function\_call\_output | Predefinito— |
| Campo`max_output_tokens` | Tipo`integer` | RequisitoFacoltativo | Valori e limiti Minimo: 1 Dipende dal modello | Predefinito— |
| Campo`stream` | Tipo`boolean` | RequisitoFacoltativo | Valori e limiti | Predefinitofalse |
| Campo`temperature` | Tipo`number` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`top_p` | Tipo`number` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`tools` | Tipo`tool[]` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`tool_choice` | Tipo`string\|object` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`parallel_tool_calls` | Tipo`boolean` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`reasoning.effort` | Tipo`string` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`reasoning.summary` | Tipo`string` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`text.format` | Tipo`object` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`text.verbosity` | Tipo`string` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`include` | Tipo`string[]` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`store` | Tipo`boolean` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`previous_response_id` | Tipo`string` | RequisitoFacoltativo | Valori e limiti Requisito dell’ID: Solo un ID di risposta effettivo proveniente da una continuazione supportata Dipende dal modello | Predefinito— |
| Campo`service_tier` | Tipo`string` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`prompt_cache_key` | Tipo`string` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`prompt_cache_options` | Tipo`object` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |

Combinazioni di materiali in input

**Testo** · Testo UTF8

`Testo in ingresso o parte input_text`

**Testo + immagine**

`{type:input_image,image_url}`

Parametri e ciclo di vita del metodo

| Parametro | Contratto |
| --- | --- |
| Parametro`material_types` | Contrattotext, image |
| Parametro`required` | Contrattomodel, input |
| Parametro`optional_controls` | Contrattonull |
| Parametro`content_type` | Contrattoapplication/json |
| Parametro`text_file_material` | ContrattoContenuto UTF-8 effettivo inserito come testo; ID di file/URLs richiedono supporto separato ed esatto |

Ciclo di vita: `exact retained published method`

Le strutture dei metodi e gli ID sono esatti; la capacità del fornitore è distinta dall’ammissione delle richieste.

### Tariffe

#### Tariffe dei metodi Ailoot

Input

0,002 USD */ 1K*

Output

0,006 USD */ 1K*

Lettura dalla cache

0,0005 USD */ 1K*

Scrittura nella cache

0,00 USD */ 1K*

Scrittura nella cache, 5 min

0,00 USD */ 1K tokens*

Scrittura nella cache, 1 ora

0,00 USD */ 1K tokens*

#### Prezzi per lunghezza della richiesta · OpenAI Responses

| Dimensione della richiesta, in token | Input | Output | Lettura dalla cache | Scrittura nella cache | Cache 5 min | Cache 1 ora |
| --- | --- | --- | --- | --- | --- | --- |
| Dimensione della richiesta, in token(0; 200.000\] | Input0,002 USD | Output0,006 USD | Lettura dalla cache0,0005 USD | Scrittura nella cache0,00 USD | Cache 5 min0,00 USD | Cache 1 ora0,00 USD |
| Dimensione della richiesta, in token(200.000; ∞) | Input0,004 USD | Output0,012 USD | Lettura dalla cache0,001 USD | Scrittura nella cache0,00 USD | Cache 5 min0,00 USD | Cache 1 ora0,00 USD |

Tariffe in USD per 1K token. Se non è impostata alcuna tariffa, viene ereditata la tariffa base di questo metodo; «—» indica che non è impostata alcuna tariffa base.

Ailoot prenota un importo stimato prima di una richiesta. Dopo il risultato, addebita il costo finale in base all’utilizzo misurato. Per lo streaming, l’addebito usa il record finale di utilizzo. [Come funzionano la prenotazione e l’addebito finale →](https://ailoot.ai/docs/it/billing/reserve/)

#### Dettagli della tariffa di riferimento

I listini di riferimento del modello non modificano la selezione del metodo, i preventivi o gli addebiti. Gli addebiti attivi usano le tariffe del metodo Ailoot selezionato.

Listini di riferimento del modello

#### Prezzi per configurazione

Associa ogni costo alle condizioni indicate. Usa una sola tariffa per ogni insieme di configurazioni alternative.

| Configurazione | Listino delle tariffe | Token di contesto, più di | Token di contesto, fino al limite incluso | Costo |
| --- | --- | --- | --- | --- |
| ConfigurazioneOpenAI Chat · Tariffe base per token | Listino delle tariffeTariffa base | Token di contesto, più di— | Token di contesto, fino al limite inclusoNessun limite superiore | Costo Input · Token in input **$0.004** / 1K token Output · Token in output **$0.012** / 1K token Input · Lettura dalla cache **$0.001** / 1K token Input · Scrittura nella cache **—** / 1K token Input · Scrittura nella cache, 1 ora **—** / 1K token |
| ConfigurazioneOpenAI Chat · Fascia 1 in base alla lunghezza della richiesta | Listino delle tariffe— | Token di contesto, più di0 | Token di contesto, fino al limite incluso200.000 | Costo Input · Token in input **$0.004** / 1K token Output · Token in output **$0.012** / 1K token Input · Lettura dalla cache **$0.001** / 1K token Input · Scrittura nella cache **—** / 1K token Input · Scrittura nella cache, 1 ora **—** / 1K token |
| ConfigurazioneOpenAI Chat · Fascia 2 in base alla lunghezza della richiesta | Listino delle tariffe— | Token di contesto, più di200.000 | Token di contesto, fino al limite inclusoNessun limite superiore | Costo Input · Token in input **$0.008** / 1K token Output · Token in output **$0.024** / 1K token Input · Lettura dalla cache **$0.002** / 1K token Input · Scrittura nella cache **—** / 1K token Input · Scrittura nella cache, 1 ora **—** / 1K token |
| ConfigurazioneAnthropic Messages · Tariffe base per token | Listino delle tariffeTariffa base | Token di contesto, più di— | Token di contesto, fino al limite inclusoNessun limite superiore | Costo Input · Token in input **$0.004** / 1K token Output · Token in output **$0.012** / 1K token Input · Lettura dalla cache **$0.001** / 1K token Input · Scrittura nella cache **—** / 1K token Input · Scrittura nella cache, 1 ora **—** / 1K token |
| ConfigurazioneAnthropic Messages · Fascia 1 in base alla lunghezza della richiesta | Listino delle tariffe— | Token di contesto, più di0 | Token di contesto, fino al limite incluso200.000 | Costo Input · Token in input **$0.004** / 1K token Output · Token in output **$0.012** / 1K token Input · Lettura dalla cache **$0.001** / 1K token Input · Scrittura nella cache **—** / 1K token Input · Scrittura nella cache, 1 ora **—** / 1K token |
| ConfigurazioneAnthropic Messages · Fascia 2 in base alla lunghezza della richiesta | Listino delle tariffe— | Token di contesto, più di200.000 | Token di contesto, fino al limite inclusoNessun limite superiore | Costo Input · Token in input **$0.008** / 1K token Output · Token in output **$0.024** / 1K token Input · Lettura dalla cache **$0.002** / 1K token Input · Scrittura nella cache **—** / 1K token Input · Scrittura nella cache, 1 ora **—** / 1K token |

### Esempi di richieste

#### Ailoot · OpenAI Responses

Esempio di testoInput, immaginePython SDKNode.js SDKStreaming Python

```bash
set -eu
: "${AILOOT_API_KEY:?Set your Ailoot API key}"
: "${AILOOT_TEXT_FILE:?Set your actual UTF-8 source-material file}"
export AILOOT_TEXT_FILE
python3 - <<'PY_REQUEST'
import json,os
from pathlib import Path
p=json.loads('{"model": "grok-4.6", "input": ""}')
f=Path(os.environ["AILOOT_TEXT_FILE"])
if not f.is_file():raise SystemExit("Choose your actual UTF-8 source material")
text=f.read_text(encoding="utf-8")
if not text.strip():raise SystemExit("Source material must contain text")
p["input"]="Summarize this material and quote supporting source passages.\n\n"+text
Path("request.json").write_text(json.dumps(p,ensure_ascii=False))
PY_REQUEST
curl --fail-with-body --silent --show-error https://api.ailoot.ai/v1/responses \
  -H "Authorization: Bearer $AILOOT_API_KEY" -H 'Content-Type: application/json' \
  --data-binary @request.json -D response-headers.txt -o result.json
python3 - <<'PY_RESULT'
import base64, json
from pathlib import Path

def save_result(data, stem="result"):
    # Keep every field, including usage, IDs, reasoning and tool requests.
    Path(stem + ".json").write_text(json.dumps(data, ensure_ascii=False, indent=2), encoding="utf-8")
    print(json.dumps(data, ensure_ascii=False, indent=2))
    def save_blob(encoded, suffix, label):
        raw = base64.b64decode(encoded, altchars=b"-_", validate=True)
        ext = "png" if raw.startswith(b"\x89PNG\r\n\x1a\n") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4] == b"RIFF" and raw[8:12] == b"WEBP" else suffix
        file = Path(stem + "-" + label + "." + ext)
        file.write_bytes(raw)
        print("Saved", file)
    for index, block in enumerate(data.get("content") or []):
        print("Content", index, json.dumps(block, ensure_ascii=False))
    for choice in data.get("choices") or []:
        print("Choice", choice.get("index"), json.dumps(choice.get("message", choice.get("delta", {})), ensure_ascii=False))
    for index, item in enumerate(data.get("output") or []):
        print("Output", index, json.dumps(item, ensure_ascii=False))
        if item.get("type") == "image_generation_call" and item.get("result"):
            save_blob(item["result"], item.get("output_format") or "bin", "output-" + str(index))
    for ci, candidate in enumerate(data.get("candidates") or []):
        for pi, part in enumerate((candidate.get("content") or {}).get("parts") or []):
            print("Candidate/part", ci, pi, json.dumps(part, ensure_ascii=False))
            blob = part.get("inlineData") or part.get("inline_data")
            if blob and blob.get("data"):
                mime = blob.get("mimeType") or blob.get("mime_type")
                suffix = {"image/png":"png", "image/jpeg":"jpg", "image/webp":"webp", "audio/wav":"wav", "audio/mpeg":"mp3", "video/mp4":"mp4"}.get(mime, "bin")
                save_blob(blob["data"], suffix, "candidate-" + str(ci) + "-part-" + str(pi))

save_result(json.loads(Path("result.json").read_text(encoding="utf-8")))
PY_RESULT
```

```bash
set -eu
: "${AILOOT_API_KEY:?Set your Ailoot API key}"
: "${AILOOT_IMAGE_FILE:?Set your actual PNG JPEG or WebP image}"
export AILOOT_IMAGE_FILE
python3 - <<'PY_REQUEST'
import json,os
from pathlib import Path
p=json.loads('{"model": "grok-4.6", "input": [{"role": "user", "content": [{"type": "input_text", "text": "Read labels and numbers in this image; flag unreadable text."}]}]}')
import base64
f=Path(os.environ["AILOOT_IMAGE_FILE"])
if not f.is_file():raise SystemExit("Choose an actual PNG JPEG or WebP image")
raw=f.read_bytes()
mime="image/png" if raw.startswith(b"\x89PNG\r\n\x1a\n") else "image/jpeg" if raw.startswith(b"\xff\xd8") else "image/webp" if raw[:4]==b"RIFF" and raw[8:12]==b"WEBP" else None
if not mime:raise SystemExit("Use PNG JPEG or WebP")
b64=base64.b64encode(raw).decode()
p["input"][0]["content"].append({"type":"input_image","image_url":"data:"+mime+";base64,"+b64})
Path("request.json").write_text(json.dumps(p,ensure_ascii=False))
PY_REQUEST
curl --fail-with-body --silent --show-error https://api.ailoot.ai/v1/responses \
  -H "Authorization: Bearer $AILOOT_API_KEY" -H 'Content-Type: application/json' \
  --data-binary @request.json -D response-headers.txt -o result.json
python3 - <<'PY_RESULT'
import base64, json
from pathlib import Path

def save_result(data, stem="result"):
    # Keep every field, including usage, IDs, reasoning and tool requests.
    Path(stem + ".json").write_text(json.dumps(data, ensure_ascii=False, indent=2), encoding="utf-8")
    print(json.dumps(data, ensure_ascii=False, indent=2))
    def save_blob(encoded, suffix, label):
        raw = base64.b64decode(encoded, altchars=b"-_", validate=True)
        ext = "png" if raw.startswith(b"\x89PNG\r\n\x1a\n") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4] == b"RIFF" and raw[8:12] == b"WEBP" else suffix
        file = Path(stem + "-" + label + "." + ext)
        file.write_bytes(raw)
        print("Saved", file)
    for index, block in enumerate(data.get("content") or []):
        print("Content", index, json.dumps(block, ensure_ascii=False))
    for choice in data.get("choices") or []:
        print("Choice", choice.get("index"), json.dumps(choice.get("message", choice.get("delta", {})), ensure_ascii=False))
    for index, item in enumerate(data.get("output") or []):
        print("Output", index, json.dumps(item, ensure_ascii=False))
        if item.get("type") == "image_generation_call" and item.get("result"):
            save_blob(item["result"], item.get("output_format") or "bin", "output-" + str(index))
    for ci, candidate in enumerate(data.get("candidates") or []):
        for pi, part in enumerate((candidate.get("content") or {}).get("parts") or []):
            print("Candidate/part", ci, pi, json.dumps(part, ensure_ascii=False))
            blob = part.get("inlineData") or part.get("inline_data")
            if blob and blob.get("data"):
                mime = blob.get("mimeType") or blob.get("mime_type")
                suffix = {"image/png":"png", "image/jpeg":"jpg", "image/webp":"webp", "audio/wav":"wav", "audio/mpeg":"mp3", "video/mp4":"mp4"}.get(mime, "bin")
                save_blob(blob["data"], suffix, "candidate-" + str(ci) + "-part-" + str(pi))

save_result(json.loads(Path("result.json").read_text(encoding="utf-8")))
PY_RESULT
```

```python
from openai import OpenAI
import os

if not os.environ.get("AILOOT_API_KEY", "").strip(): raise SystemExit("Set AILOOT_API_KEY before making a request")
client = OpenAI(base_url="https://api.ailoot.ai/v1", api_key=os.environ["AILOOT_API_KEY"], max_retries=0)
resp = client.responses.create(model="grok-4.6", input="Explain the difference between an observation and a hypothesis in three sentences.")
import base64, json
from pathlib import Path

def save_result(data, stem="result"):
    # Keep every field, including usage, IDs, reasoning and tool requests.
    Path(stem + ".json").write_text(json.dumps(data, ensure_ascii=False, indent=2), encoding="utf-8")
    print(json.dumps(data, ensure_ascii=False, indent=2))
    def save_blob(encoded, suffix, label):
        raw = base64.b64decode(encoded, altchars=b"-_", validate=True)
        ext = "png" if raw.startswith(b"\x89PNG\r\n\x1a\n") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4] == b"RIFF" and raw[8:12] == b"WEBP" else suffix
        file = Path(stem + "-" + label + "." + ext)
        file.write_bytes(raw)
        print("Saved", file)
    for index, block in enumerate(data.get("content") or []):
        print("Content", index, json.dumps(block, ensure_ascii=False))
    for choice in data.get("choices") or []:
        print("Choice", choice.get("index"), json.dumps(choice.get("message", choice.get("delta", {})), ensure_ascii=False))
    for index, item in enumerate(data.get("output") or []):
        print("Output", index, json.dumps(item, ensure_ascii=False))
        if item.get("type") == "image_generation_call" and item.get("result"):
            save_blob(item["result"], item.get("output_format") or "bin", "output-" + str(index))
    for ci, candidate in enumerate(data.get("candidates") or []):
        for pi, part in enumerate((candidate.get("content") or {}).get("parts") or []):
            print("Candidate/part", ci, pi, json.dumps(part, ensure_ascii=False))
            blob = part.get("inlineData") or part.get("inline_data")
            if blob and blob.get("data"):
                mime = blob.get("mimeType") or blob.get("mime_type")
                suffix = {"image/png":"png", "image/jpeg":"jpg", "image/webp":"webp", "audio/wav":"wav", "audio/mpeg":"mp3", "video/mp4":"mp4"}.get(mime, "bin")
                save_blob(blob["data"], suffix, "candidate-" + str(ci) + "-part-" + str(pi))

save_result(resp.to_dict(mode="json"))
```

```js
import OpenAI from "openai";

if (!process.env.AILOOT_API_KEY?.trim()) throw new Error("Set AILOOT_API_KEY before making a request");
const client = new OpenAI({ baseURL: "https://api.ailoot.ai/v1", apiKey: process.env.AILOOT_API_KEY, maxRetries: 0 });
const resp = await client.responses.create({ model: "grok-4.6", input: "Explain the difference between an observation and a hypothesis in three sentences." });
import { writeFileSync } from "node:fs";

function saveResult(data, stem = "result") {
  writeFileSync(stem + ".json", JSON.stringify(data, null, 2));
  console.log(JSON.stringify(data, null, 2));
  const saveBlob = (encoded, suffix, label) => {
    const raw = Buffer.from(encoded, "base64");
    const ext = raw.subarray(0,8).equals(Buffer.from([137,80,78,71,13,10,26,10])) ? "png" : raw[0]===255 && raw[1]===216 ? "jpg" : raw.subarray(0,4).toString()==="RIFF" && raw.subarray(8,12).toString()==="WEBP" ? "webp" : suffix;
    const file = `${stem}-${label}.${ext}`;
    writeFileSync(file, raw); console.log("Saved", file);
  };
  for (const [i, block] of (data.content || []).entries()) console.log("Content", i, JSON.stringify(block));
  for (const choice of data.choices || []) console.log("Choice", choice.index, JSON.stringify(choice.message || choice.delta || {}));
  for (const [i, item] of (data.output || []).entries()) {
    console.log("Output", i, JSON.stringify(item));
    if (item.type === "image_generation_call" && item.result) saveBlob(item.result, item.output_format || "bin", `output-${i}`);
  }
  for (const [ci, candidate] of (data.candidates || []).entries()) {
    for (const [pi, part] of (candidate.content?.parts || []).entries()) {
      console.log("Candidate/part", ci, pi, JSON.stringify(part));
      const blob = part.inlineData || part.inline_data;
      if (blob?.data) {
        const mime = blob.mimeType || blob.mime_type;
        const suffix = ({"image/png":"png", "image/jpeg":"jpg", "image/webp":"webp", "audio/wav":"wav", "audio/mpeg":"mp3", "video/mp4":"mp4"})[mime] || "bin";
        saveBlob(blob.data, suffix, `candidate-${ci}-part-${pi}`);
      }
    }
  }
}

saveResult(resp);
```

```python
from openai import OpenAI
import os
from pathlib import Path
import base64, json
from pathlib import Path

def save_result(data, stem="result"):
    # Keep every field, including usage, IDs, reasoning and tool requests.
    Path(stem + ".json").write_text(json.dumps(data, ensure_ascii=False, indent=2), encoding="utf-8")
    print(json.dumps(data, ensure_ascii=False, indent=2))
    def save_blob(encoded, suffix, label):
        raw = base64.b64decode(encoded, altchars=b"-_", validate=True)
        ext = "png" if raw.startswith(b"\x89PNG\r\n\x1a\n") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4] == b"RIFF" and raw[8:12] == b"WEBP" else suffix
        file = Path(stem + "-" + label + "." + ext)
        file.write_bytes(raw)
        print("Saved", file)
    for index, block in enumerate(data.get("content") or []):
        print("Content", index, json.dumps(block, ensure_ascii=False))
    for choice in data.get("choices") or []:
        print("Choice", choice.get("index"), json.dumps(choice.get("message", choice.get("delta", {})), ensure_ascii=False))
    for index, item in enumerate(data.get("output") or []):
        print("Output", index, json.dumps(item, ensure_ascii=False))
        if item.get("type") == "image_generation_call" and item.get("result"):
            save_blob(item["result"], item.get("output_format") or "bin", "output-" + str(index))
    for ci, candidate in enumerate(data.get("candidates") or []):
        for pi, part in enumerate((candidate.get("content") or {}).get("parts") or []):
            print("Candidate/part", ci, pi, json.dumps(part, ensure_ascii=False))
            blob = part.get("inlineData") or part.get("inline_data")
            if blob and blob.get("data"):
                mime = blob.get("mimeType") or blob.get("mime_type")
                suffix = {"image/png":"png", "image/jpeg":"jpg", "image/webp":"webp", "audio/wav":"wav", "audio/mpeg":"mp3", "video/mp4":"mp4"}.get(mime, "bin")
                save_blob(blob["data"], suffix, "candidate-" + str(ci) + "-part-" + str(pi))

if not os.environ.get("AILOOT_API_KEY", "").strip(): raise SystemExit("Set AILOOT_API_KEY before making a request")
client=OpenAI(base_url="https://api.ailoot.ai/v1",api_key=os.environ["AILOOT_API_KEY"],max_retries=0)
with client.responses.stream(model="grok-4.6", input="Explain the difference between an observation and a hypothesis in three sentences.") as stream:
    with Path("stream-events.jsonl").open("w",encoding="utf-8") as log:
        for event in stream:
            payload=event.to_dict(mode="json")
            log.write(json.dumps(payload,ensure_ascii=False)+"\n"); log.flush()
            print(json.dumps(payload,ensure_ascii=False))
    final=stream.get_final_response()
    save_result(final.to_dict(mode="json"),"stream-result")
```

### Ricevi e salva i risultati

#### Ailoot · OpenAI Responses

json o SSE

##### Conserva tutti i risultati completati

Conserva ogni risposta, file e parte di contenuto restituiti per intero.

Conserva ogni elemento di uscita e parte di contenuto, il call\_id effettivo della funzione, il ragionamento cifrato e i dati di utilizzo. Nello streaming conserva l’identità completa di eventi ed elementi.

##### Se occorre verificare la risposta originale

Conserva gli ID e le intestazioni di richiesta/risposta. Non viene fornito alcun URL generico per recuperare un’attività testuale.

Campi della risposta

| Campo | Tipo |
| --- | --- |
| Campo`id` | Tipostring |
| Campo`status` | Tipostring |
| Campo`output[]` | Tipomessage\|reasoning\|function\_call\|other item |
| Campo`output[].content[]` | Tipocontent part |
| Campo`usage` | Tipoobject |

Errori e passaggi successivi

| Risposta | Condizione | Passaggio successivo |
| --- | --- | --- |
| Risposta400 · `invalid_request_error` | CondizioneCampi obbligatori, rappresentazione del materiale o valore del parametro non validi | Passaggio successivoCorreggi i campi indicati prima di una nuova richiesta di creazione. |

### Alias

#### Alias del modello

<strong>Ailoot</strong> [`grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Core&caller=grok-4.6&fmt=responses), [`grok-4.6-latest`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Core&caller=grok-4.6-latest&fmt=responses)
**Ailoot Ultra** [`grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Ultra&caller=grok-4.6), [`x-ai/grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Ultra&caller=x-ai%2Fgrok-4.6)

#### Alias dei percorsi dei metodi

`/chat/completions`

#### ID di chiamata correlati

[`x-ai/grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Ultra&caller=x-ai%2Fgrok-4.6), [`grok-4.6-latest`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Core&caller=grok-4.6-latest&fmt=responses), [`grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Core&caller=grok-4.6&fmt=responses), [`grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Ultra&caller=grok-4.6)

**Ailoot · OpenAI Chat** `POST /v1/chat/completions` `grok-4.6`

[`grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Core&caller=grok-4.6&fmt=chat)

SpaceXAI /`grok-4.6`

ID del modello

- `grok-4.6`
- `grok-4.6-latest`

### Introduzione

Grok 4.6 è stato creato per lavori prolungati su codice, ricerche e progetti interattivi. Riceve testo e immagini e supporta un contesto di 500 000 token e quattro livelli di ragionamento.

Input accettati

Testo · Immagini

Risultati

Testo

### Disponibile in Ailoot · input e metodi

**Ailoot · OpenAI Chat** `POST /v1/chat/completions`

Tipi di input

`text`, `image`

Tipi di output

`text`

Contesto

500.000 tokens

Output massimo

500.000 tokens

Formato di output

json o SSE

| Campo | Tipo | Requisito | Valori e limiti | Predefinito |
| --- | --- | --- | --- | --- |
| Campo`model` | Tipo`string` | RequisitoObbligatorio | Valori e limiti grok-4.6 | Predefinito— |
| Campo`messages` | Tipo`message[]` | RequisitoObbligatorio | Valori e limiti Numero minimo di elementi: 1 | Predefinito— |
| Campo`messages[].role` | Tipo`string` | RequisitoObbligatorio | Valori e limiti Esempi: system, user, assistant, tool, function Condizioni: Questi ruoli sono rappresentati esplicitamente dai tipi di compatibilità del codice sorgente; l’insieme esatto dei ruoli rimane specifico del modello. Dipende dal modello | Predefinito— |
| Campo`messages[].content` | Tipo`string\|content_part[]\|null` | RequisitoFacoltativo | Valori e limiti | Predefinito— |
| Campo`messages[].tool_calls` | Tipo`tool_call[]` | RequisitoFacoltativo | Valori e limiti | Predefinito— |
| Campo`messages[].tool_call_id` | Tipo`string` | RequisitoFacoltativo | Valori e limiti Si applica quando: role=tool; usa l’ID effettivamente restituito | Predefinito— |
| Campo`messages[].name` | Tipo`string` | RequisitoFacoltativo | Valori e limiti | Predefinito— |
| Campo`messages[].reasoning_content` | Tipo`string` | RequisitoFacoltativo | Valori e limiti Si applica quando: Reinserisci il ragionamento effettivamente restituito quando il modello lo utilizza | Predefinito— |
| Campo`messages[].reasoning_details` | Tipo`object\|array` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`max_tokens` | Tipo`integer` | RequisitoFacoltativo | Valori e limiti Minimo: 1 Dipende dal modello | Predefinito— |
| Campo`max_completion_tokens` | Tipo`integer` | RequisitoFacoltativo | Valori e limiti Minimo: 1 Dipende dal modello | Predefinito— |
| Campo`stream` | Tipo`boolean` | RequisitoFacoltativo | Valori e limiti | Predefinitofalse |
| Campo`stream_options.include_usage` | Tipo`boolean` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`temperature` | Tipo`number` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`top_p` | Tipo`number` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`stop` | Tipo`string\|string[]` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`tools` | Tipo`function_tool[]` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`tools[].type` | Tipo`string` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`tools[].function.name` | Tipo`string` | RequisitoObbligatorio | Valori e limiti Si applica quando: Funzione fornita come strumento | Predefinito— |
| Campo`tools[].function.description` | Tipo`string` | RequisitoFacoltativo | Valori e limiti | Predefinito— |
| Campo`tools[].function.parameters` | Tipo`JSON_schema` | RequisitoFacoltativo | Valori e limiti | Predefinito— |
| Campo`tool_choice` | Tipo`string\|object` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`parallel_tool_calls` | Tipo`boolean` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`response_format` | Tipo`object` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`reasoning_effort` | Tipo`string` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`reasoning` | Tipo`object` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`service_tier` | Tipo`string` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`instructions` | Tipo`string` | RequisitoFacoltativo | Valori e limiti Campo di compatibilità | Predefinito— |
| Campo`functions` | Tipo`function[]` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`function_call` | Tipo`string\|object` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`prompt_cache_options` | Tipo`object` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |

Combinazioni di materiali in input

**Testo** · Testo UTF8

`messages[].content`

**Testo + immagine**

`{type:image_url,image_url:{url,detail}}`

Parametri e ciclo di vita del metodo

| Parametro | Contratto |
| --- | --- |
| Parametro`material_types` | Contrattotext, image |
| Parametro`required` | Contrattomodel, messages |
| Parametro`optional_controls` | Contrattonull |
| Parametro`content_type` | Contrattoapplication/json |
| Parametro`text_file_material` | ContrattoContenuto UTF-8 effettivo inserito come testo; ID di file/URLs richiedono supporto separato ed esatto |

Ciclo di vita: `exact retained published method`

Le strutture dei metodi e gli ID sono esatti; la capacità del fornitore è distinta dall’ammissione delle richieste.

### Tariffe

#### Tariffe dei metodi Ailoot

Input

0,002 USD */ 1K*

Output

0,006 USD */ 1K*

Lettura dalla cache

0,0005 USD */ 1K*

Scrittura nella cache

0,00 USD */ 1K*

Scrittura nella cache, 5 min

0,00 USD */ 1K tokens*

Scrittura nella cache, 1 ora

0,00 USD */ 1K tokens*

#### Prezzi per lunghezza della richiesta · OpenAI Chat

| Dimensione della richiesta, in token | Input | Output | Lettura dalla cache | Scrittura nella cache | Cache 5 min | Cache 1 ora |
| --- | --- | --- | --- | --- | --- | --- |
| Dimensione della richiesta, in token(0; 200.000\] | Input0,002 USD | Output0,006 USD | Lettura dalla cache0,0005 USD | Scrittura nella cache0,00 USD | Cache 5 min0,00 USD | Cache 1 ora0,00 USD |
| Dimensione della richiesta, in token(200.000; ∞) | Input0,004 USD | Output0,012 USD | Lettura dalla cache0,001 USD | Scrittura nella cache0,00 USD | Cache 5 min0,00 USD | Cache 1 ora0,00 USD |

Tariffe in USD per 1K token. Se non è impostata alcuna tariffa, viene ereditata la tariffa base di questo metodo; «—» indica che non è impostata alcuna tariffa base.

Ailoot prenota un importo stimato prima di una richiesta. Dopo il risultato, addebita il costo finale in base all’utilizzo misurato. Per lo streaming, l’addebito usa il record finale di utilizzo. [Come funzionano la prenotazione e l’addebito finale →](https://ailoot.ai/docs/it/billing/reserve/)

#### Dettagli della tariffa di riferimento

I listini di riferimento del modello non modificano la selezione del metodo, i preventivi o gli addebiti. Gli addebiti attivi usano le tariffe del metodo Ailoot selezionato.

Listini di riferimento del modello

#### Prezzi per configurazione

Associa ogni costo alle condizioni indicate. Usa una sola tariffa per ogni insieme di configurazioni alternative.

| Configurazione | Listino delle tariffe | Token di contesto, più di | Token di contesto, fino al limite incluso | Costo |
| --- | --- | --- | --- | --- |
| ConfigurazioneOpenAI Chat · Tariffe base per token | Listino delle tariffeTariffa base | Token di contesto, più di— | Token di contesto, fino al limite inclusoNessun limite superiore | Costo Input · Token in input **$0.004** / 1K token Output · Token in output **$0.012** / 1K token Input · Lettura dalla cache **$0.001** / 1K token Input · Scrittura nella cache **—** / 1K token Input · Scrittura nella cache, 1 ora **—** / 1K token |
| ConfigurazioneOpenAI Chat · Fascia 1 in base alla lunghezza della richiesta | Listino delle tariffe— | Token di contesto, più di0 | Token di contesto, fino al limite incluso200.000 | Costo Input · Token in input **$0.004** / 1K token Output · Token in output **$0.012** / 1K token Input · Lettura dalla cache **$0.001** / 1K token Input · Scrittura nella cache **—** / 1K token Input · Scrittura nella cache, 1 ora **—** / 1K token |
| ConfigurazioneOpenAI Chat · Fascia 2 in base alla lunghezza della richiesta | Listino delle tariffe— | Token di contesto, più di200.000 | Token di contesto, fino al limite inclusoNessun limite superiore | Costo Input · Token in input **$0.008** / 1K token Output · Token in output **$0.024** / 1K token Input · Lettura dalla cache **$0.002** / 1K token Input · Scrittura nella cache **—** / 1K token Input · Scrittura nella cache, 1 ora **—** / 1K token |
| ConfigurazioneAnthropic Messages · Tariffe base per token | Listino delle tariffeTariffa base | Token di contesto, più di— | Token di contesto, fino al limite inclusoNessun limite superiore | Costo Input · Token in input **$0.004** / 1K token Output · Token in output **$0.012** / 1K token Input · Lettura dalla cache **$0.001** / 1K token Input · Scrittura nella cache **—** / 1K token Input · Scrittura nella cache, 1 ora **—** / 1K token |
| ConfigurazioneAnthropic Messages · Fascia 1 in base alla lunghezza della richiesta | Listino delle tariffe— | Token di contesto, più di0 | Token di contesto, fino al limite incluso200.000 | Costo Input · Token in input **$0.004** / 1K token Output · Token in output **$0.012** / 1K token Input · Lettura dalla cache **$0.001** / 1K token Input · Scrittura nella cache **—** / 1K token Input · Scrittura nella cache, 1 ora **—** / 1K token |
| ConfigurazioneAnthropic Messages · Fascia 2 in base alla lunghezza della richiesta | Listino delle tariffe— | Token di contesto, più di200.000 | Token di contesto, fino al limite inclusoNessun limite superiore | Costo Input · Token in input **$0.008** / 1K token Output · Token in output **$0.024** / 1K token Input · Lettura dalla cache **$0.002** / 1K token Input · Scrittura nella cache **—** / 1K token Input · Scrittura nella cache, 1 ora **—** / 1K token |

### Esempi di richieste

#### Ailoot · OpenAI Chat

Esempio di testoInput, immaginePython SDKNode.js SDKStreaming Python

```bash
set -eu
: "${AILOOT_API_KEY:?Set your Ailoot API key}"
: "${AILOOT_TEXT_FILE:?Set your actual UTF-8 source-material file}"
export AILOOT_TEXT_FILE
python3 - <<'PY_REQUEST'
import json,os
from pathlib import Path
p=json.loads('{"model": "grok-4.6", "messages": []}')
f=Path(os.environ["AILOOT_TEXT_FILE"])
if not f.is_file():raise SystemExit("Choose your actual UTF-8 source material")
text=f.read_text(encoding="utf-8")
if not text.strip():raise SystemExit("Source material must contain text")
p["messages"]=[{"role":"user","content":"Summarize this material and quote supporting source passages.\n\n"+text}]
Path("request.json").write_text(json.dumps(p,ensure_ascii=False))
PY_REQUEST
curl --fail-with-body --silent --show-error https://api.ailoot.ai/v1/chat/completions \
  -H "Authorization: Bearer $AILOOT_API_KEY" -H 'Content-Type: application/json' \
  --data-binary @request.json -D response-headers.txt -o result.json
python3 - <<'PY_RESULT'
import json
from pathlib import Path
print(json.dumps(json.loads(Path("result.json").read_text()),ensure_ascii=False,indent=2))
PY_RESULT
```

```bash
set -eu
: "${AILOOT_API_KEY:?Set your Ailoot API key}"
: "${AILOOT_IMAGE_FILE:?Set your actual PNG JPEG or WebP image}"
export AILOOT_IMAGE_FILE
python3 - <<'PY_REQUEST'
import json,os
from pathlib import Path
p=json.loads('{"model": "grok-4.6", "messages": [{"role": "user", "content": [{"type": "text", "text": "Read labels and numbers in this image; flag unreadable text."}]}]}')
import base64
f=Path(os.environ["AILOOT_IMAGE_FILE"])
if not f.is_file():raise SystemExit("Choose an actual PNG JPEG or WebP image")
raw=f.read_bytes()
mime="image/png" if raw.startswith(b"\x89PNG\r\n\x1a\n") else "image/jpeg" if raw.startswith(b"\xff\xd8") else "image/webp" if raw[:4]==b"RIFF" and raw[8:12]==b"WEBP" else None
if not mime:raise SystemExit("Use PNG JPEG or WebP")
b64=base64.b64encode(raw).decode()
p["messages"][0]["content"].append({"type":"image_url","image_url":{"url":"data:"+mime+";base64,"+b64}})
Path("request.json").write_text(json.dumps(p,ensure_ascii=False))
PY_REQUEST
curl --fail-with-body --silent --show-error https://api.ailoot.ai/v1/chat/completions \
  -H "Authorization: Bearer $AILOOT_API_KEY" -H 'Content-Type: application/json' \
  --data-binary @request.json -D response-headers.txt -o result.json
python3 - <<'PY_RESULT'
import json
from pathlib import Path
print(json.dumps(json.loads(Path("result.json").read_text()),ensure_ascii=False,indent=2))
PY_RESULT
```

```python
from openai import OpenAI
import os

if not os.environ.get("AILOOT_API_KEY", "").strip(): raise SystemExit("Set AILOOT_API_KEY before making a request")
client = OpenAI(base_url="https://api.ailoot.ai/v1", api_key=os.environ["AILOOT_API_KEY"], max_retries=0)
resp = client.chat.completions.create(
    model="grok-4.6",
    messages=[{"role": "user", "content": "Explain the difference between an observation and a hypothesis in three sentences."}],
)
import base64, json
from pathlib import Path

def save_result(data, stem="result"):
    # Keep every field, including usage, IDs, reasoning and tool requests.
    Path(stem + ".json").write_text(json.dumps(data, ensure_ascii=False, indent=2), encoding="utf-8")
    print(json.dumps(data, ensure_ascii=False, indent=2))
    def save_blob(encoded, suffix, label):
        raw = base64.b64decode(encoded, altchars=b"-_", validate=True)
        ext = "png" if raw.startswith(b"\x89PNG\r\n\x1a\n") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4] == b"RIFF" and raw[8:12] == b"WEBP" else suffix
        file = Path(stem + "-" + label + "." + ext)
        file.write_bytes(raw)
        print("Saved", file)
    for index, block in enumerate(data.get("content") or []):
        print("Content", index, json.dumps(block, ensure_ascii=False))
    for choice in data.get("choices") or []:
        print("Choice", choice.get("index"), json.dumps(choice.get("message", choice.get("delta", {})), ensure_ascii=False))
    for index, item in enumerate(data.get("output") or []):
        print("Output", index, json.dumps(item, ensure_ascii=False))
        if item.get("type") == "image_generation_call" and item.get("result"):
            save_blob(item["result"], item.get("output_format") or "bin", "output-" + str(index))
    for ci, candidate in enumerate(data.get("candidates") or []):
        for pi, part in enumerate((candidate.get("content") or {}).get("parts") or []):
            print("Candidate/part", ci, pi, json.dumps(part, ensure_ascii=False))
            blob = part.get("inlineData") or part.get("inline_data")
            if blob and blob.get("data"):
                mime = blob.get("mimeType") or blob.get("mime_type")
                suffix = {"image/png":"png", "image/jpeg":"jpg", "image/webp":"webp", "audio/wav":"wav", "audio/mpeg":"mp3", "video/mp4":"mp4"}.get(mime, "bin")
                save_blob(blob["data"], suffix, "candidate-" + str(ci) + "-part-" + str(pi))

save_result(resp.to_dict(mode="json"))
```

```js
import OpenAI from "openai";

if (!process.env.AILOOT_API_KEY?.trim()) throw new Error("Set AILOOT_API_KEY before making a request");
const client = new OpenAI({ baseURL: "https://api.ailoot.ai/v1", apiKey: process.env.AILOOT_API_KEY, maxRetries: 0 });
const resp = await client.chat.completions.create({
  model: "grok-4.6",
  messages: [{ role: "user", content: "Explain the difference between an observation and a hypothesis in three sentences." }],
});
import { writeFileSync } from "node:fs";

function saveResult(data, stem = "result") {
  writeFileSync(stem + ".json", JSON.stringify(data, null, 2));
  console.log(JSON.stringify(data, null, 2));
  const saveBlob = (encoded, suffix, label) => {
    const raw = Buffer.from(encoded, "base64");
    const ext = raw.subarray(0,8).equals(Buffer.from([137,80,78,71,13,10,26,10])) ? "png" : raw[0]===255 && raw[1]===216 ? "jpg" : raw.subarray(0,4).toString()==="RIFF" && raw.subarray(8,12).toString()==="WEBP" ? "webp" : suffix;
    const file = `${stem}-${label}.${ext}`;
    writeFileSync(file, raw); console.log("Saved", file);
  };
  for (const [i, block] of (data.content || []).entries()) console.log("Content", i, JSON.stringify(block));
  for (const choice of data.choices || []) console.log("Choice", choice.index, JSON.stringify(choice.message || choice.delta || {}));
  for (const [i, item] of (data.output || []).entries()) {
    console.log("Output", i, JSON.stringify(item));
    if (item.type === "image_generation_call" && item.result) saveBlob(item.result, item.output_format || "bin", `output-${i}`);
  }
  for (const [ci, candidate] of (data.candidates || []).entries()) {
    for (const [pi, part] of (candidate.content?.parts || []).entries()) {
      console.log("Candidate/part", ci, pi, JSON.stringify(part));
      const blob = part.inlineData || part.inline_data;
      if (blob?.data) {
        const mime = blob.mimeType || blob.mime_type;
        const suffix = ({"image/png":"png", "image/jpeg":"jpg", "image/webp":"webp", "audio/wav":"wav", "audio/mpeg":"mp3", "video/mp4":"mp4"})[mime] || "bin";
        saveBlob(blob.data, suffix, `candidate-${ci}-part-${pi}`);
      }
    }
  }
}

saveResult(resp);
```

```python
from openai import OpenAI
import os
from pathlib import Path

if not os.environ.get("AILOOT_API_KEY", "").strip(): raise SystemExit("Set AILOOT_API_KEY before making a request")
client=OpenAI(base_url="https://api.ailoot.ai/v1",api_key=os.environ["AILOOT_API_KEY"],max_retries=0)
import base64, json
from pathlib import Path

def save_result(data, stem="result"):
    # Keep every field, including usage, IDs, reasoning and tool requests.
    Path(stem + ".json").write_text(json.dumps(data, ensure_ascii=False, indent=2), encoding="utf-8")
    print(json.dumps(data, ensure_ascii=False, indent=2))
    def save_blob(encoded, suffix, label):
        raw = base64.b64decode(encoded, altchars=b"-_", validate=True)
        ext = "png" if raw.startswith(b"\x89PNG\r\n\x1a\n") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4] == b"RIFF" and raw[8:12] == b"WEBP" else suffix
        file = Path(stem + "-" + label + "." + ext)
        file.write_bytes(raw)
        print("Saved", file)
    for index, block in enumerate(data.get("content") or []):
        print("Content", index, json.dumps(block, ensure_ascii=False))
    for choice in data.get("choices") or []:
        print("Choice", choice.get("index"), json.dumps(choice.get("message", choice.get("delta", {})), ensure_ascii=False))
    for index, item in enumerate(data.get("output") or []):
        print("Output", index, json.dumps(item, ensure_ascii=False))
        if item.get("type") == "image_generation_call" and item.get("result"):
            save_blob(item["result"], item.get("output_format") or "bin", "output-" + str(index))
    for ci, candidate in enumerate(data.get("candidates") or []):
        for pi, part in enumerate((candidate.get("content") or {}).get("parts") or []):
            print("Candidate/part", ci, pi, json.dumps(part, ensure_ascii=False))
            blob = part.get("inlineData") or part.get("inline_data")
            if blob and blob.get("data"):
                mime = blob.get("mimeType") or blob.get("mime_type")
                suffix = {"image/png":"png", "image/jpeg":"jpg", "image/webp":"webp", "audio/wav":"wav", "audio/mpeg":"mp3", "video/mp4":"mp4"}.get(mime, "bin")
                save_blob(blob["data"], suffix, "candidate-" + str(ci) + "-part-" + str(pi))

with client.chat.completions.stream(model='grok-4.6',messages=[{"role":"user","content":"Explain observations and hypotheses in three sentences."}]) as stream:
    with Path("stream-events.jsonl").open("w",encoding="utf-8") as log:
        for event in stream:
            payload=event.to_dict(mode="json")
            log.write(json.dumps(payload,ensure_ascii=False)+"\n"); log.flush()
            print(json.dumps(payload,ensure_ascii=False))
    final=stream.get_final_completion()
    save_result(final.to_dict(mode="json"),"stream-result")
```

### Ricevi e salva i risultati

#### Ailoot · OpenAI Chat

json o SSE

##### Conserva tutti i risultati completati

Conserva ogni risposta, file e parte di contenuto restituiti per intero.

Conserva ogni scelta con contenuto, chiamate agli strumenti e ragionamento. In SSE assembla i delta per indice di scelta e strumento e conserva il motivo finale di completamento e i dati di utilizzo.

##### Se occorre verificare la risposta originale

Conserva gli ID e le intestazioni di richiesta/risposta. Non viene fornito alcun URL generico per recuperare un’attività testuale.

Campi della risposta

| Campo | Tipo |
| --- | --- |
| Campo`choices[].index` | Tipointeger |
| Campo`choices[].message.content` | Tipostring\|null |
| Campo`choices[].message.tool_calls` | Tipotool\_call\[\] |
| Campo`choices[].message.reasoning_content` | Tipostring |
| Campo`choices[].message.reasoning_details` | Tipoobject\|array |
| Campo`choices[].finish_reason` | Tipostring\|null |
| Campo`usage` | Tipoobject |

Errori e passaggi successivi

| Risposta | Condizione | Passaggio successivo |
| --- | --- | --- |
| Risposta400 · `invalid_request_error` | CondizioneCampi obbligatori, rappresentazione del materiale o valore del parametro non validi | Passaggio successivoCorreggi i campi indicati prima di una nuova richiesta di creazione. |

### Alias

#### Alias del modello

<strong>Ailoot</strong> [`grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Core&caller=grok-4.6&fmt=chat), [`grok-4.6-latest`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Core&caller=grok-4.6-latest&fmt=chat)
**Ailoot Ultra** [`grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Ultra&caller=grok-4.6&fmt=chat), [`x-ai/grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Ultra&caller=x-ai%2Fgrok-4.6&fmt=chat)

#### Alias dei percorsi dei metodi

`/chat/completions`

#### ID di chiamata correlati

[`x-ai/grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Ultra&caller=x-ai%2Fgrok-4.6&fmt=chat), [`grok-4.6-latest`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Core&caller=grok-4.6-latest&fmt=chat), [`grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Core&caller=grok-4.6&fmt=chat), [`grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Ultra&caller=grok-4.6&fmt=chat)

**Ailoot Ultra · OpenAI Chat** `POST /v1/chat/completions` `grok-4.6`

[`grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Ultra&caller=grok-4.6&fmt=chat)

SpaceXAI /`grok-4.6`

ID del modello

- `grok-4.6`
- `x-ai/grok-4.6`

### Introduzione

Grok 4.6 è stato creato per lavori prolungati su codice, ricerche e progetti interattivi. Riceve testo e immagini e supporta un contesto di 500 000 token e quattro livelli di ragionamento.

Input accettati

Testo

Risultati

Testo

### Disponibile in Ailoot · input e metodi

**Ailoot Ultra · OpenAI Chat** `POST /v1/chat/completions`

Tipi di input

`text`

Tipi di output

`text`

Formato di output

json o SSE

| Campo | Tipo | Requisito | Valori e limiti | Predefinito |
| --- | --- | --- | --- | --- |
| Campo`model` | Tipo`string` | RequisitoObbligatorio | Valori e limiti grok-4.6 | Predefinito— |
| Campo`messages` | Tipo`message[]` | RequisitoObbligatorio | Valori e limiti Numero minimo di elementi: 1 | Predefinito— |
| Campo`messages[].role` | Tipo`string` | RequisitoObbligatorio | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`messages[].content` | Tipo`string` | RequisitoFacoltativo | Valori e limiti Si applica quando: Conversazione testuale | Predefinito— |
| Campo`stream` | Tipo`boolean` | RequisitoFacoltativo | Valori e limiti | Predefinitofalse |

Combinazioni di materiali in input

**Testo** · Testo UTF8

`messages[].content`

Parametri e ciclo di vita del metodo

| Parametro | Contratto |
| --- | --- |
| Parametro`content_type` | Contrattoapplication/json |
| Parametro`required` | Contrattomodel, messages |
| Parametro`material_types` | Contrattotext |
| Parametro`messages` | ContrattoArray di messaggi con struttura role/content |
| Parametro`file_material` | ContrattoDocumento UTF-8 effettivo inserito come testo letterale; nessun ID di file dedotto |
| Parametro`optional_controls` | Contrattostream |
| Parametro`control_scope` | ContrattoConversazione testuale; stream è un booleano e per impostazione predefinita vale false. |
| Parametro`output_modalities` | Contrattotext |
| Parametro`hosted_operations` | Contrattofalse |
| Parametro`multimodal_input_binding` | Contrattonull |

Alias del metodo: `/chat/completions`

Ciclo di vita: `synchronous_or_streamed`

Invia l’ID esatto del modello con messages.

La lunghezza del contesto non è un limite di uscita.

Un file di testo può fornire testo letterale; gli ingressi immagine/audio/oggetto file richiedono un’associazione esatta.

### Tariffe

Le tariffe non aggiungono opzioni alla richiesta. I parametri supportati sono elencati nel metodo selezionato.

Modalità rapida

Tariffa standard Quando è selezionata la modalità rapida

Modalità flex

Tariffa standard Quando è selezionata la modalità flex

Sforzo massimo di ragionamento

Tariffa standard Quando lo sforzo massimo di ragionamento usa l'adeguamento predefinito (default)

Sforzo di ragionamento · elevato

Tariffa standard Quando lo sforzo di ragionamento è elevato

Sforzo di ragionamento · basso

Tariffa standard Quando lo sforzo di ragionamento è basso

Sforzo di ragionamento · medio

Tariffa standard Quando lo sforzo di ragionamento è medio

Sforzo di ragionamento · xhigh

Tariffa standard Quando lo sforzo di ragionamento è xhigh

#### Tariffe Ailoot

#### Prezzi per configurazione

Associa ogni costo alle condizioni indicate. Usa una sola tariffa per ogni insieme di configurazioni alternative.

| Configurazione | Listino delle tariffe | Token di contesto, più di | Token di contesto, fino al limite incluso | Costo |
| --- | --- | --- | --- | --- |
| ConfigurazioneTariffe di base dei token | Listino delle tariffeTariffa base | Token di contesto, più di— | Token di contesto, fino al limite inclusoNessun limite superiore | Costo Input · Token in input **$0.004** / 1K token Output · Token in output **$0.012** / 1K token Input · Lettura dalla cache **$0.001** / 1K token Input · Scrittura nella cache **—** / 1K token Input · Scrittura nella cache, 1 ora **—** / 1K token |
| ConfigurazioneFascia 1 di lunghezza della richiesta | Listino delle tariffe— | Token di contesto, più di0 | Token di contesto, fino al limite incluso200.000 | Costo Input · Token in input **$0.004** / 1K token Output · Token in output **$0.012** / 1K token Input · Lettura dalla cache **$0.001** / 1K token Input · Scrittura nella cache **—** / 1K token Input · Scrittura nella cache, 1 ora **—** / 1K token |
| ConfigurazioneFascia 2 di lunghezza della richiesta | Listino delle tariffe— | Token di contesto, più di200.000 | Token di contesto, fino al limite inclusoNessun limite superiore | Costo Input · Token in input **$0.008** / 1K token Output · Token in output **$0.024** / 1K token Input · Lettura dalla cache **$0.002** / 1K token Input · Scrittura nella cache **—** / 1K token Input · Scrittura nella cache, 1 ora **—** / 1K token |

Ailoot prenota un importo stimato prima di una richiesta. Dopo il risultato, addebita il costo finale in base all’utilizzo misurato. Per lo streaming, l’addebito usa il record finale di utilizzo. [Come funzionano la prenotazione e l’addebito finale →](https://ailoot.ai/docs/it/billing/reserve/)

### Esempi di richieste

#### Ailoot Ultra · OpenAI Chat

curlPython SDK

```bash
set -eu
: "${AILOOT_API_KEY:?Set your Ailoot API key}"
python3 - <<'PY_REQUEST'
import json,os
from pathlib import Path
p=json.loads('{"model":"grok-4.6","messages":[{"role":"user","content":"hello"}],"stream":false}')

Path("request.json").write_text(json.dumps(p,ensure_ascii=False))
PY_REQUEST
curl --fail-with-body --silent --show-error https://api.ailoot.ai/v1/chat/completions \
  -H "Authorization: Bearer $AILOOT_API_KEY" -H 'Content-Type: application/json' \
  --data-binary @request.json -D response-headers.txt -o result.json
python3 - <<'PY_RESULT'
import json
from pathlib import Path
r=json.loads(Path("result.json").read_text())
for x in r.get("choices",[]):
    if x.get("message",{}).get("content"): print(x["message"]["content"])
PY_RESULT
```

```python
from openai import OpenAI
import os

if not os.environ.get("AILOOT_API_KEY", "").strip(): raise SystemExit("Set AILOOT_API_KEY before making a request")
client=OpenAI(base_url="https://api.ailoot.ai/v1",api_key=os.environ["AILOOT_API_KEY"],max_retries=0)
result=client.chat.completions.create(model="grok-4.6", messages=[{"role":"user","content":"hello"}], stream=False)
import base64, json
from pathlib import Path

def save_result(data, stem="result"):
    # Keep every field, including usage, IDs, reasoning and tool requests.
    Path(stem + ".json").write_text(json.dumps(data, ensure_ascii=False, indent=2), encoding="utf-8")
    print(json.dumps(data, ensure_ascii=False, indent=2))
    def save_blob(encoded, suffix, label):
        raw = base64.b64decode(encoded, altchars=b"-_", validate=True)
        ext = "png" if raw.startswith(b"\x89PNG\r\n\x1a\n") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4] == b"RIFF" and raw[8:12] == b"WEBP" else suffix
        file = Path(stem + "-" + label + "." + ext)
        file.write_bytes(raw)
        print("Saved", file)
    for index, block in enumerate(data.get("content") or []):
        print("Content", index, json.dumps(block, ensure_ascii=False))
    for choice in data.get("choices") or []:
        print("Choice", choice.get("index"), json.dumps(choice.get("message", choice.get("delta", {})), ensure_ascii=False))
    for index, item in enumerate(data.get("output") or []):
        print("Output", index, json.dumps(item, ensure_ascii=False))
        if item.get("type") == "image_generation_call" and item.get("result"):
            save_blob(item["result"], item.get("output_format") or "bin", "output-" + str(index))
    for ci, candidate in enumerate(data.get("candidates") or []):
        for pi, part in enumerate((candidate.get("content") or {}).get("parts") or []):
            print("Candidate/part", ci, pi, json.dumps(part, ensure_ascii=False))
            blob = part.get("inlineData") or part.get("inline_data")
            if blob and blob.get("data"):
                mime = blob.get("mimeType") or blob.get("mime_type")
                suffix = {"image/png":"png", "image/jpeg":"jpg", "image/webp":"webp", "audio/wav":"wav", "audio/mpeg":"mp3", "video/mp4":"mp4"}.get(mime, "bin")
                save_blob(blob["data"], suffix, "candidate-" + str(ci) + "-part-" + str(pi))

save_result(result.to_dict(mode="json"))
```

### Ricevi e salva i risultati

#### Ailoot Ultra · OpenAI Chat

json o SSE

##### Conserva tutti i risultati completati

Conserva ogni risposta, file e parte di contenuto restituiti per intero.

Conserva ogni scelta con contenuto, chiamate agli strumenti e ragionamento. In SSE assembla i delta per indice di scelta e strumento e conserva il motivo finale di completamento e i dati di utilizzo.

##### Se occorre verificare la risposta originale

Conserva gli ID e le intestazioni di richiesta/risposta. Non viene fornito alcun URL generico per recuperare un’attività testuale.

Campi della risposta

| Campo | Tipo |
| --- | --- |
| Campo`choices[].index` | Tipointeger |
| Campo`choices[].message.content` | Tipostring\|null |
| Campo`choices[].message.tool_calls` | Tipotool\_call\[\] |
| Campo`choices[].message.reasoning_content` | Tipostring |
| Campo`choices[].message.reasoning_details` | Tipoobject\|array |
| Campo`choices[].finish_reason` | Tipostring\|null |
| Campo`usage` | Tipoobject |

Errori e passaggi successivi

| Risposta | Condizione | Passaggio successivo |
| --- | --- | --- |
| Risposta400 · `invalid_request_error` | CondizioneCampi obbligatori, rappresentazione del materiale o valore del parametro non validi | Passaggio successivoCorreggi i campi indicati prima di una nuova richiesta di creazione. |

### Alias

#### Alias del modello

<strong>Ailoot</strong> [`grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Core&caller=grok-4.6&fmt=chat), [`grok-4.6-latest`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Core&caller=grok-4.6-latest&fmt=chat)
**Ailoot Ultra** [`grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Ultra&caller=grok-4.6&fmt=chat), [`x-ai/grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Ultra&caller=x-ai%2Fgrok-4.6&fmt=chat)

#### Alias dei percorsi dei metodi

`/chat/completions`

#### ID di chiamata correlati

[`x-ai/grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Ultra&caller=x-ai%2Fgrok-4.6&fmt=chat), [`grok-4.6-latest`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Core&caller=grok-4.6-latest&fmt=chat), [`grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Core&caller=grok-4.6&fmt=chat), [`grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Ultra&caller=grok-4.6&fmt=chat)

**Ailoot Ultra · Anthropic Messages** `POST /v1/messages` `grok-4.6`

[`grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Ultra&caller=grok-4.6&fmt=messages)

SpaceXAI /`grok-4.6`

ID del modello

- `grok-4.6`
- `x-ai/grok-4.6`

### Introduzione

Grok 4.6 è stato creato per lavori prolungati su codice, ricerche e progetti interattivi. Riceve testo e immagini e supporta un contesto di 500 000 token e quattro livelli di ragionamento.

Input accettati

Testo

Risultati

json · sse

### Disponibile in Ailoot · input e metodi

**Ailoot Ultra · Anthropic Messages** `POST /v1/messages`

Tipi di input

`text`

Tipi di output

`json`, `sse`

Formato di output

JSON o SSE

| Campo | Tipo | Requisito | Valori e limiti | Predefinito |
| --- | --- | --- | --- | --- |
| Campo`model` | Tipo`string` | RequisitoObbligatorio | Valori e limiti grok-4.6 | Predefinito— |
| Campo`messages` | Tipo`message[]` | RequisitoObbligatorio | Valori e limiti | Predefinito— |
| Campo`messages[].role` | Tipo`string` | RequisitoObbligatorio | Valori e limiti user, assistant | Predefinito— |
| Campo`messages[].content` | Tipo`string` | RequisitoObbligatorio | Valori e limiti | Predefinito— |
| Campo`max_tokens` | Tipo`integer` | RequisitoObbligatorio | Valori e limiti | Predefinito— |
| Campo`stream` | Tipo`boolean` | RequisitoFacoltativo | Valori e limiti | Predefinitofalse |

Combinazioni di materiali in input

**Testo** · Testo UTF-8

`Stringa messages[].content`

Parametri e ciclo di vita del metodo

| Parametro | Contratto |
| --- | --- |
| Parametro`content_type` | Contrattoapplication/json |
| Parametro`required` | Contrattomodel, messages, max\_tokens |
| Parametro`optional_controls` | Contrattostream |
| Parametro`material_types` | Contrattotext |
| Parametro`text_file_material` | ContrattoLeggi il documento UTF-8 effettivo e inserisci il testo nell’ingresso indicato o nella stringa del contenuto del messaggio. |

Ciclo di vita: `synchronous_or_streamed`

### Tariffe

Le tariffe non aggiungono opzioni alla richiesta. I parametri supportati sono elencati nel metodo selezionato.

Modalità rapida

Tariffa standard Quando è selezionata la modalità rapida

Modalità flex

Tariffa standard Quando è selezionata la modalità flex

Sforzo massimo di ragionamento

Tariffa standard Quando lo sforzo massimo di ragionamento usa l'adeguamento predefinito (default)

Sforzo di ragionamento · elevato

Tariffa standard Quando lo sforzo di ragionamento è elevato

Sforzo di ragionamento · basso

Tariffa standard Quando lo sforzo di ragionamento è basso

Sforzo di ragionamento · medio

Tariffa standard Quando lo sforzo di ragionamento è medio

Sforzo di ragionamento · xhigh

Tariffa standard Quando lo sforzo di ragionamento è xhigh

#### Tariffe Ailoot

#### Prezzi per configurazione

Associa ogni costo alle condizioni indicate. Usa una sola tariffa per ogni insieme di configurazioni alternative.

| Configurazione | Listino delle tariffe | Token di contesto, più di | Token di contesto, fino al limite incluso | Costo |
| --- | --- | --- | --- | --- |
| ConfigurazioneTariffe di base dei token | Listino delle tariffeTariffa base | Token di contesto, più di— | Token di contesto, fino al limite inclusoNessun limite superiore | Costo Input · Token in input **$0.004** / 1K token Output · Token in output **$0.012** / 1K token Input · Lettura dalla cache **$0.001** / 1K token Input · Scrittura nella cache **—** / 1K token Input · Scrittura nella cache, 1 ora **—** / 1K token |
| ConfigurazioneFascia 1 di lunghezza della richiesta | Listino delle tariffe— | Token di contesto, più di0 | Token di contesto, fino al limite incluso200.000 | Costo Input · Token in input **$0.004** / 1K token Output · Token in output **$0.012** / 1K token Input · Lettura dalla cache **$0.001** / 1K token Input · Scrittura nella cache **—** / 1K token Input · Scrittura nella cache, 1 ora **—** / 1K token |
| ConfigurazioneFascia 2 di lunghezza della richiesta | Listino delle tariffe— | Token di contesto, più di200.000 | Token di contesto, fino al limite inclusoNessun limite superiore | Costo Input · Token in input **$0.008** / 1K token Output · Token in output **$0.024** / 1K token Input · Lettura dalla cache **$0.002** / 1K token Input · Scrittura nella cache **—** / 1K token Input · Scrittura nella cache, 1 ora **—** / 1K token |

Ailoot prenota un importo stimato prima di una richiesta. Dopo il risultato, addebita il costo finale in base all’utilizzo misurato. Per lo streaming, l’addebito usa il record finale di utilizzo. [Come funzionano la prenotazione e l’addebito finale →](https://ailoot.ai/docs/it/billing/reserve/)

### Esempi di richieste

#### Ailoot Ultra · Anthropic Messages

Corpo JSON minimo completocurl · usa il tuo documento UTF-8Python · salva il risultato completo

```json
{
  "model": "grok-4.6",
  "max_tokens": 128,
  "messages": [
    {
      "role": "user",
      "content": "Summarize the incident report."
    }
  ],
  "stream": false
}
```

```bash
set -eu
: "${AILOOT_API_KEY:?Set your Ailoot API key}"
: "${AILOOT_TEXT_FILE:?Set your actual UTF-8 document}"
export AILOOT_TEXT_FILE
python3 - <<'PY_REQUEST'
import json, os
from pathlib import Path

source_file = Path(os.environ['AILOOT_TEXT_FILE'])
if not source_file.is_file():
    raise SystemExit('Set AILOOT_TEXT_FILE to your actual UTF-8 document')
text = source_file.read_text(encoding='utf-8')
if not text.strip():
    raise SystemExit('Choose a document containing text')
payload = {'model': 'grok-4.6', 'max_tokens': 128, 'messages': [{'role': 'user', 'content': 'Summarize the incident report.'}]}
payload['messages'][0]['content'] = 'Summarize this material and quote supporting source passages.\n\n' + text
Path('request.json').write_text(json.dumps(payload, ensure_ascii=False), encoding='utf-8')
PY_REQUEST
curl --fail-with-body --silent --show-error https://api.ailoot.ai/v1/messages \
  -H "x-api-key: $AILOOT_API_KEY" -H 'anthropic-version: 2023-06-01' -H 'Content-Type: application/json' \
  --data-binary @request.json -D response-headers.txt -o result.json
python3 - <<'PY_RESULT'
import json
from pathlib import Path

result = json.loads(Path('result.json').read_text(encoding='utf-8'))
print(json.dumps(result, ensure_ascii=False, indent=2))
PY_RESULT
```

```python
import json, os
from pathlib import Path

source_file = Path(os.environ['AILOOT_TEXT_FILE'])
if not source_file.is_file():
    raise SystemExit('Set AILOOT_TEXT_FILE to your actual UTF-8 document')
text = source_file.read_text(encoding='utf-8')
if not text.strip():
    raise SystemExit('Choose a document containing text')
payload = {'model': 'grok-4.6', 'max_tokens': 128, 'messages': [{'role': 'user', 'content': 'Summarize the incident report.'}]}
payload['messages'][0]['content'] = 'Summarize this material and quote supporting source passages.\n\n' + text
from urllib.request import Request, urlopen
from urllib.error import HTTPError

api_key = os.environ['AILOOT_API_KEY']
if not api_key.strip():
    raise SystemExit('Set AILOOT_API_KEY before making a request')
headers = {'x-api-key': 'PLACEHOLDER_KEY', 'anthropic-version': '2023-06-01', 'Content-Type': 'application/json'}
headers['x-api-key'] = api_key
request = Request('https://api.ailoot.ai/v1/messages', data=json.dumps(payload, ensure_ascii=False).encode('utf-8'), headers=headers, method='POST')
try:
    with urlopen(request, timeout=120) as response:
        raw = response.read()
        Path('response-headers.txt').write_text(str(response.headers), encoding='utf-8')
except HTTPError as error:
    Path('result.json').write_bytes(error.read())
    Path('response-headers.txt').write_text(str(error.headers), encoding='utf-8')
    raise
Path('result.json').write_bytes(raw)
import json
from pathlib import Path

result = json.loads(Path('result.json').read_text(encoding='utf-8'))
print(json.dumps(result, ensure_ascii=False, indent=2))
```

### Ricevi e salva i risultati

#### Ailoot Ultra · Anthropic Messages

JSON o SSE

##### Conserva tutti i risultati completati

Conserva ogni risposta, file e parte di contenuto restituiti per intero.

Conserva tutti i blocchi di contenuto, le firme di ragionamento e gli ID effettivi di utilizzo degli strumenti. Assembla tutti i delta dei blocchi SSE; il primo blocco di testo non è l’uscita completa.

##### Se occorre verificare la risposta originale

Conserva gli ID e le intestazioni di richiesta/risposta. Non viene fornito alcun URL generico per recuperare un’attività testuale.

Campi della risposta

| Campo | Tipo |
| --- | --- |
| Campo`id` | Tipostring |
| Campo`model` | Tipostring |
| Campo`content[]` | Tipotext\|thinking\|tool\_use\|other content block |
| Campo`stop_reason` | Tipostring\|null |
| Campo`usage` | Tipoobject |

Errori e passaggi successivi

| Risposta | Condizione | Passaggio successivo |
| --- | --- | --- |
| Risposta400 · `invalid_request_error` | CondizioneCampi obbligatori, rappresentazione del materiale o valore del parametro non validi | Passaggio successivoCorreggi i campi indicati prima di una nuova richiesta di creazione. |

### Alias

#### Alias del modello

<strong>Ailoot</strong> [`grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Core&caller=grok-4.6&fmt=messages), [`grok-4.6-latest`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Core&caller=grok-4.6-latest&fmt=messages)
**Ailoot Ultra** [`grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Ultra&caller=grok-4.6&fmt=messages), [`x-ai/grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Ultra&caller=x-ai%2Fgrok-4.6&fmt=messages)

#### Alias dei percorsi dei metodi

`/chat/completions`

#### ID di chiamata correlati

[`x-ai/grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Ultra&caller=x-ai%2Fgrok-4.6&fmt=messages), [`grok-4.6-latest`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Core&caller=grok-4.6-latest&fmt=messages), [`grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Core&caller=grok-4.6&fmt=messages), [`grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Ultra&caller=grok-4.6&fmt=messages)

**Ailoot · Anthropic Messages** `POST /v1/messages` `grok-4.6-latest`

[`grok-4.6-latest`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Core&caller=grok-4.6-latest&fmt=messages)

SpaceXAI /`grok-4.6-latest`

ID del modello

- `grok-4.6`
- `grok-4.6-latest`

### Introduzione

Grok 4.6 è stato creato per lavori prolungati su codice, ricerche e progetti interattivi. Riceve testo e immagini e supporta un contesto di 500 000 token e quattro livelli di ragionamento.

Input accettati

Testo · Immagini

Risultati

Testo

### Disponibile in Ailoot · input e metodi

**Ailoot · Anthropic Messages** `POST /v1/messages`

Tipi di input

`text`, `image`

Tipi di output

`text`

Contesto

500.000 tokens

Output massimo

500.000 tokens

Formato di output

json o SSE

| Campo | Tipo | Requisito | Valori e limiti | Predefinito |
| --- | --- | --- | --- | --- |
| Campo`model` | Tipo`string` | RequisitoObbligatorio | Valori e limiti grok-4.6-latest | Predefinito— |
| Campo`messages` | Tipo`message[]` | RequisitoObbligatorio | Valori e limiti Numero minimo di elementi: 1 | Predefinito— |
| Campo`messages[].role` | Tipo`string` | RequisitoObbligatorio | Valori e limiti user, assistant | Predefinito— |
| Campo`messages[].content` | Tipo`string\|content_block[]` | RequisitoObbligatorio | Valori e limiti | Predefinito— |
| Campo`system` | Tipo`string\|content_block[]` | RequisitoFacoltativo | Valori e limiti | Predefinito— |
| Campo`max_tokens` | Tipo`integer` | RequisitoObbligatorio | Valori e limiti Minimo: 1 Il limite si applica a: Limite esatto del modello o della scheda selezionati | Predefinito— |
| Campo`stream` | Tipo`boolean` | RequisitoFacoltativo | Valori e limiti | Predefinitofalse |
| Campo`temperature` | Tipo`number` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`top_p` | Tipo`number` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`stop_sequences` | Tipo`string[]` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`tools` | Tipo`tool[]` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`tools[].name` | Tipo`string` | RequisitoFacoltativo | Valori e limiti Si applica quando: Strumento fornito | Predefinito— |
| Campo`tools[].description` | Tipo`string` | RequisitoFacoltativo | Valori e limiti | Predefinito— |
| Campo`tools[].input_schema` | Tipo`JSON_schema` | RequisitoFacoltativo | Valori e limiti | Predefinito— |
| Campo`tool_choice` | Tipo`object` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`thinking.type` | Tipo`string` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`thinking.budget_tokens` | Tipo`integer` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`output_config.effort` | Tipo`string` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`metadata` | Tipo`object` | RequisitoFacoltativo | Valori e limiti | Predefinito— |
| Campo`cache_control` | Tipo`object` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |

Combinazioni di materiali in input

**Testo** · Testo UTF8

`messages[].content o blocco type=text`

**Testo + immagine**

`{type:image,source:{type:base64,media_type,data}} o origine type=url`

Parametri e ciclo di vita del metodo

| Parametro | Contratto |
| --- | --- |
| Parametro`material_types` | Contrattotext, image |
| Parametro`required` | Contrattomodel, messages, max\_tokens |
| Parametro`optional_controls` | Contrattonull |
| Parametro`content_type` | Contrattoapplication/json |
| Parametro`text_file_material` | ContrattoContenuto UTF-8 effettivo inserito come testo; ID di file/URLs richiedono supporto separato ed esatto |

Ciclo di vita: `exact retained published method`

Le strutture dei metodi e gli ID sono esatti; la capacità del fornitore è distinta dall’ammissione delle richieste.

### Tariffe

#### Tariffe dei metodi Ailoot

Input

0,002 USD */ 1K*

Output

0,006 USD */ 1K*

Lettura dalla cache

0,0005 USD */ 1K*

Scrittura nella cache

0,00 USD */ 1K*

Scrittura nella cache, 5 min

0,00 USD */ 1K tokens*

Scrittura nella cache, 1 ora

0,00 USD */ 1K tokens*

#### Prezzi per lunghezza della richiesta · Anthropic Messages

| Dimensione della richiesta, in token | Input | Output | Lettura dalla cache | Scrittura nella cache | Cache 5 min | Cache 1 ora |
| --- | --- | --- | --- | --- | --- | --- |
| Dimensione della richiesta, in token(0; 200.000\] | Input0,002 USD | Output0,006 USD | Lettura dalla cache0,0005 USD | Scrittura nella cache0,00 USD | Cache 5 min0,00 USD | Cache 1 ora0,00 USD |
| Dimensione della richiesta, in token(200.000; ∞) | Input0,004 USD | Output0,012 USD | Lettura dalla cache0,001 USD | Scrittura nella cache0,00 USD | Cache 5 min0,00 USD | Cache 1 ora0,00 USD |

Tariffe in USD per 1K token. Se non è impostata alcuna tariffa, viene ereditata la tariffa base di questo metodo; «—» indica che non è impostata alcuna tariffa base.

Ailoot prenota un importo stimato prima di una richiesta. Dopo il risultato, addebita il costo finale in base all’utilizzo misurato. Per lo streaming, l’addebito usa il record finale di utilizzo. [Come funzionano la prenotazione e l’addebito finale →](https://ailoot.ai/docs/it/billing/reserve/)

#### Dettagli della tariffa di riferimento

I listini di riferimento del modello non modificano la selezione del metodo, i preventivi o gli addebiti. Gli addebiti attivi usano le tariffe del metodo Ailoot selezionato.

Listini di riferimento del modello

#### Prezzi per configurazione

Associa ogni costo alle condizioni indicate. Usa una sola tariffa per ogni insieme di configurazioni alternative.

| Configurazione | Listino delle tariffe | Token di contesto, più di | Token di contesto, fino al limite incluso | Costo |
| --- | --- | --- | --- | --- |
| ConfigurazioneOpenAI Chat · Tariffe base per token | Listino delle tariffeTariffa base | Token di contesto, più di— | Token di contesto, fino al limite inclusoNessun limite superiore | Costo Input · Token in input **$0.004** / 1K token Output · Token in output **$0.012** / 1K token Input · Lettura dalla cache **$0.001** / 1K token Input · Scrittura nella cache **—** / 1K token Input · Scrittura nella cache, 1 ora **—** / 1K token |
| ConfigurazioneOpenAI Chat · Fascia 1 in base alla lunghezza della richiesta | Listino delle tariffe— | Token di contesto, più di0 | Token di contesto, fino al limite incluso200.000 | Costo Input · Token in input **$0.004** / 1K token Output · Token in output **$0.012** / 1K token Input · Lettura dalla cache **$0.001** / 1K token Input · Scrittura nella cache **—** / 1K token Input · Scrittura nella cache, 1 ora **—** / 1K token |
| ConfigurazioneOpenAI Chat · Fascia 2 in base alla lunghezza della richiesta | Listino delle tariffe— | Token di contesto, più di200.000 | Token di contesto, fino al limite inclusoNessun limite superiore | Costo Input · Token in input **$0.008** / 1K token Output · Token in output **$0.024** / 1K token Input · Lettura dalla cache **$0.002** / 1K token Input · Scrittura nella cache **—** / 1K token Input · Scrittura nella cache, 1 ora **—** / 1K token |
| ConfigurazioneAnthropic Messages · Tariffe base per token | Listino delle tariffeTariffa base | Token di contesto, più di— | Token di contesto, fino al limite inclusoNessun limite superiore | Costo Input · Token in input **$0.004** / 1K token Output · Token in output **$0.012** / 1K token Input · Lettura dalla cache **$0.001** / 1K token Input · Scrittura nella cache **—** / 1K token Input · Scrittura nella cache, 1 ora **—** / 1K token |
| ConfigurazioneAnthropic Messages · Fascia 1 in base alla lunghezza della richiesta | Listino delle tariffe— | Token di contesto, più di0 | Token di contesto, fino al limite incluso200.000 | Costo Input · Token in input **$0.004** / 1K token Output · Token in output **$0.012** / 1K token Input · Lettura dalla cache **$0.001** / 1K token Input · Scrittura nella cache **—** / 1K token Input · Scrittura nella cache, 1 ora **—** / 1K token |
| ConfigurazioneAnthropic Messages · Fascia 2 in base alla lunghezza della richiesta | Listino delle tariffe— | Token di contesto, più di200.000 | Token di contesto, fino al limite inclusoNessun limite superiore | Costo Input · Token in input **$0.008** / 1K token Output · Token in output **$0.024** / 1K token Input · Lettura dalla cache **$0.002** / 1K token Input · Scrittura nella cache **—** / 1K token Input · Scrittura nella cache, 1 ora **—** / 1K token |

### Esempi di richieste

#### Ailoot · Anthropic Messages

Esempio di testoInput, immaginePython SDKNode.js SDKStreaming Python

```bash
set -eu
: "${AILOOT_API_KEY:?Set your Ailoot API key}"
: "${AILOOT_TEXT_FILE:?Set your actual UTF-8 source-material file}"
export AILOOT_TEXT_FILE
python3 - <<'PY_REQUEST'
import json,os
from pathlib import Path
p=json.loads('{"model": "grok-4.6-latest", "max_tokens": 1024, "messages": []}')
f=Path(os.environ["AILOOT_TEXT_FILE"])
if not f.is_file():raise SystemExit("Choose your actual UTF-8 source material")
text=f.read_text(encoding="utf-8")
if not text.strip():raise SystemExit("Source material must contain text")
p["messages"]=[{"role":"user","content":"Summarize this material and quote supporting source passages.\n\n"+text}]
Path("request.json").write_text(json.dumps(p,ensure_ascii=False))
PY_REQUEST
curl --fail-with-body --silent --show-error https://api.ailoot.ai/v1/messages \
  -H "x-api-key: $AILOOT_API_KEY" -H 'anthropic-version: 2023-06-01' -H 'Content-Type: application/json' \
  --data-binary @request.json -D response-headers.txt -o result.json
python3 - <<'PY_RESULT'
import json
from pathlib import Path
print(json.dumps(json.loads(Path("result.json").read_text()),ensure_ascii=False,indent=2))
PY_RESULT
```

```bash
set -eu
: "${AILOOT_API_KEY:?Set your Ailoot API key}"
: "${AILOOT_IMAGE_FILE:?Set your actual PNG JPEG or WebP image}"
export AILOOT_IMAGE_FILE
python3 - <<'PY_REQUEST'
import json,os
from pathlib import Path
p=json.loads('{"model": "grok-4.6-latest", "max_tokens": 1024, "messages": [{"role": "user", "content": [{"type": "text", "text": "Read labels and numbers in this image; flag unreadable text."}]}]}')
import base64
f=Path(os.environ["AILOOT_IMAGE_FILE"])
if not f.is_file():raise SystemExit("Choose an actual PNG JPEG or WebP image")
raw=f.read_bytes()
mime="image/png" if raw.startswith(b"\x89PNG\r\n\x1a\n") else "image/jpeg" if raw.startswith(b"\xff\xd8") else "image/webp" if raw[:4]==b"RIFF" and raw[8:12]==b"WEBP" else None
if not mime:raise SystemExit("Use PNG JPEG or WebP")
b64=base64.b64encode(raw).decode()
p["messages"][0]["content"].append({"type":"image","source":{"type":"base64","media_type":mime,"data":b64}})
Path("request.json").write_text(json.dumps(p,ensure_ascii=False))
PY_REQUEST
curl --fail-with-body --silent --show-error https://api.ailoot.ai/v1/messages \
  -H "x-api-key: $AILOOT_API_KEY" -H 'anthropic-version: 2023-06-01' -H 'Content-Type: application/json' \
  --data-binary @request.json -D response-headers.txt -o result.json
python3 - <<'PY_RESULT'
import json
from pathlib import Path
print(json.dumps(json.loads(Path("result.json").read_text()),ensure_ascii=False,indent=2))
PY_RESULT
```

```python
import anthropic
import os

if not os.environ.get("AILOOT_API_KEY", "").strip(): raise SystemExit("Set AILOOT_API_KEY before making a request")
client = anthropic.Anthropic(base_url="https://api.ailoot.ai", api_key=os.environ["AILOOT_API_KEY"], max_retries=0)
msg = client.messages.create(
    model="grok-4.6-latest",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Explain the difference between an observation and a hypothesis in three sentences."}],
)
import base64, json
from pathlib import Path

def save_result(data, stem="result"):
    # Keep every field, including usage, IDs, reasoning and tool requests.
    Path(stem + ".json").write_text(json.dumps(data, ensure_ascii=False, indent=2), encoding="utf-8")
    print(json.dumps(data, ensure_ascii=False, indent=2))
    def save_blob(encoded, suffix, label):
        raw = base64.b64decode(encoded, altchars=b"-_", validate=True)
        ext = "png" if raw.startswith(b"\x89PNG\r\n\x1a\n") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4] == b"RIFF" and raw[8:12] == b"WEBP" else suffix
        file = Path(stem + "-" + label + "." + ext)
        file.write_bytes(raw)
        print("Saved", file)
    for index, block in enumerate(data.get("content") or []):
        print("Content", index, json.dumps(block, ensure_ascii=False))
    for choice in data.get("choices") or []:
        print("Choice", choice.get("index"), json.dumps(choice.get("message", choice.get("delta", {})), ensure_ascii=False))
    for index, item in enumerate(data.get("output") or []):
        print("Output", index, json.dumps(item, ensure_ascii=False))
        if item.get("type") == "image_generation_call" and item.get("result"):
            save_blob(item["result"], item.get("output_format") or "bin", "output-" + str(index))
    for ci, candidate in enumerate(data.get("candidates") or []):
        for pi, part in enumerate((candidate.get("content") or {}).get("parts") or []):
            print("Candidate/part", ci, pi, json.dumps(part, ensure_ascii=False))
            blob = part.get("inlineData") or part.get("inline_data")
            if blob and blob.get("data"):
                mime = blob.get("mimeType") or blob.get("mime_type")
                suffix = {"image/png":"png", "image/jpeg":"jpg", "image/webp":"webp", "audio/wav":"wav", "audio/mpeg":"mp3", "video/mp4":"mp4"}.get(mime, "bin")
                save_blob(blob["data"], suffix, "candidate-" + str(ci) + "-part-" + str(pi))

save_result(msg.to_dict(mode="json"))
```

```js
import Anthropic from "@anthropic-ai/sdk";

if (!process.env.AILOOT_API_KEY?.trim()) throw new Error("Set AILOOT_API_KEY before making a request");
const client = new Anthropic({ baseURL: "https://api.ailoot.ai", apiKey: process.env.AILOOT_API_KEY, maxRetries: 0 });
const msg = await client.messages.create({
  model: "grok-4.6-latest",
  max_tokens: 1024,
  messages: [{ role: "user", content: "Explain the difference between an observation and a hypothesis in three sentences." }],
});
import { writeFileSync } from "node:fs";

function saveResult(data, stem = "result") {
  writeFileSync(stem + ".json", JSON.stringify(data, null, 2));
  console.log(JSON.stringify(data, null, 2));
  const saveBlob = (encoded, suffix, label) => {
    const raw = Buffer.from(encoded, "base64");
    const ext = raw.subarray(0,8).equals(Buffer.from([137,80,78,71,13,10,26,10])) ? "png" : raw[0]===255 && raw[1]===216 ? "jpg" : raw.subarray(0,4).toString()==="RIFF" && raw.subarray(8,12).toString()==="WEBP" ? "webp" : suffix;
    const file = `${stem}-${label}.${ext}`;
    writeFileSync(file, raw); console.log("Saved", file);
  };
  for (const [i, block] of (data.content || []).entries()) console.log("Content", i, JSON.stringify(block));
  for (const choice of data.choices || []) console.log("Choice", choice.index, JSON.stringify(choice.message || choice.delta || {}));
  for (const [i, item] of (data.output || []).entries()) {
    console.log("Output", i, JSON.stringify(item));
    if (item.type === "image_generation_call" && item.result) saveBlob(item.result, item.output_format || "bin", `output-${i}`);
  }
  for (const [ci, candidate] of (data.candidates || []).entries()) {
    for (const [pi, part] of (candidate.content?.parts || []).entries()) {
      console.log("Candidate/part", ci, pi, JSON.stringify(part));
      const blob = part.inlineData || part.inline_data;
      if (blob?.data) {
        const mime = blob.mimeType || blob.mime_type;
        const suffix = ({"image/png":"png", "image/jpeg":"jpg", "image/webp":"webp", "audio/wav":"wav", "audio/mpeg":"mp3", "video/mp4":"mp4"})[mime] || "bin";
        saveBlob(blob.data, suffix, `candidate-${ci}-part-${pi}`);
      }
    }
  }
}

saveResult(msg);
```

```python
import anthropic,os
from pathlib import Path

if not os.environ.get("AILOOT_API_KEY", "").strip(): raise SystemExit("Set AILOOT_API_KEY before making a request")
client=anthropic.Anthropic(base_url="https://api.ailoot.ai",api_key=os.environ["AILOOT_API_KEY"],max_retries=0)
import base64, json
from pathlib import Path

def save_result(data, stem="result"):
    # Keep every field, including usage, IDs, reasoning and tool requests.
    Path(stem + ".json").write_text(json.dumps(data, ensure_ascii=False, indent=2), encoding="utf-8")
    print(json.dumps(data, ensure_ascii=False, indent=2))
    def save_blob(encoded, suffix, label):
        raw = base64.b64decode(encoded, altchars=b"-_", validate=True)
        ext = "png" if raw.startswith(b"\x89PNG\r\n\x1a\n") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4] == b"RIFF" and raw[8:12] == b"WEBP" else suffix
        file = Path(stem + "-" + label + "." + ext)
        file.write_bytes(raw)
        print("Saved", file)
    for index, block in enumerate(data.get("content") or []):
        print("Content", index, json.dumps(block, ensure_ascii=False))
    for choice in data.get("choices") or []:
        print("Choice", choice.get("index"), json.dumps(choice.get("message", choice.get("delta", {})), ensure_ascii=False))
    for index, item in enumerate(data.get("output") or []):
        print("Output", index, json.dumps(item, ensure_ascii=False))
        if item.get("type") == "image_generation_call" and item.get("result"):
            save_blob(item["result"], item.get("output_format") or "bin", "output-" + str(index))
    for ci, candidate in enumerate(data.get("candidates") or []):
        for pi, part in enumerate((candidate.get("content") or {}).get("parts") or []):
            print("Candidate/part", ci, pi, json.dumps(part, ensure_ascii=False))
            blob = part.get("inlineData") or part.get("inline_data")
            if blob and blob.get("data"):
                mime = blob.get("mimeType") or blob.get("mime_type")
                suffix = {"image/png":"png", "image/jpeg":"jpg", "image/webp":"webp", "audio/wav":"wav", "audio/mpeg":"mp3", "video/mp4":"mp4"}.get(mime, "bin")
                save_blob(blob["data"], suffix, "candidate-" + str(ci) + "-part-" + str(pi))

with client.messages.stream(model='grok-4.6-latest',max_tokens=1024,messages=[{"role":"user","content":"Explain observations and hypotheses in three sentences."}]) as stream:
    with Path("stream-events.jsonl").open("w",encoding="utf-8") as log:
        for event in stream:
            payload=event.to_dict(mode="json")
            log.write(json.dumps(payload,ensure_ascii=False)+"\n"); log.flush()
            print(json.dumps(payload,ensure_ascii=False))
    final=stream.get_final_message()
    save_result(final.to_dict(mode="json"),"stream-result")
```

### Ricevi e salva i risultati

#### Ailoot · Anthropic Messages

json o SSE

##### Conserva tutti i risultati completati

Conserva ogni risposta, file e parte di contenuto restituiti per intero.

Conserva tutti i blocchi di contenuto, le firme di ragionamento e gli ID effettivi di utilizzo degli strumenti. Assembla tutti i delta dei blocchi SSE; il primo blocco di testo non è l’uscita completa.

##### Se occorre verificare la risposta originale

Conserva gli ID e le intestazioni di richiesta/risposta. Non viene fornito alcun URL generico per recuperare un’attività testuale.

Campi della risposta

| Campo | Tipo |
| --- | --- |
| Campo`id` | Tipostring |
| Campo`model` | Tipostring |
| Campo`content[]` | Tipotext\|thinking\|tool\_use\|other content block |
| Campo`stop_reason` | Tipostring\|null |
| Campo`usage` | Tipoobject |

Errori e passaggi successivi

| Risposta | Condizione | Passaggio successivo |
| --- | --- | --- |
| Risposta400 · `invalid_request_error` | CondizioneCampi obbligatori, rappresentazione del materiale o valore del parametro non validi | Passaggio successivoCorreggi i campi indicati prima di una nuova richiesta di creazione. |

### Alias

#### Alias del modello

<strong>Ailoot</strong> [`grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Core&caller=grok-4.6&fmt=messages), [`grok-4.6-latest`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Core&caller=grok-4.6-latest&fmt=messages)
**Ailoot Ultra** [`grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Ultra&caller=grok-4.6&fmt=messages), [`x-ai/grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Ultra&caller=x-ai%2Fgrok-4.6&fmt=messages)

#### Alias dei percorsi dei metodi

`/chat/completions`

#### ID di chiamata correlati

[`x-ai/grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Ultra&caller=x-ai%2Fgrok-4.6&fmt=messages), [`grok-4.6-latest`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Core&caller=grok-4.6-latest&fmt=messages), [`grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Core&caller=grok-4.6&fmt=messages), [`grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Ultra&caller=grok-4.6&fmt=messages)

**Ailoot · OpenAI Responses** `POST /v1/responses` `grok-4.6-latest`

[`grok-4.6-latest`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Core&caller=grok-4.6-latest&fmt=responses)

SpaceXAI /`grok-4.6-latest`

ID del modello

- `grok-4.6`
- `grok-4.6-latest`

### Introduzione

Grok 4.6 è stato creato per lavori prolungati su codice, ricerche e progetti interattivi. Riceve testo e immagini e supporta un contesto di 500 000 token e quattro livelli di ragionamento.

Input accettati

Testo · Immagini

Risultati

Testo

### Disponibile in Ailoot · input e metodi

**Ailoot · OpenAI Responses** `POST /v1/responses`

Tipi di input

`text`, `image`

Tipi di output

`text`

Contesto

500.000 tokens

Output massimo

500.000 tokens

Formato di output

json o SSE

| Campo | Tipo | Requisito | Valori e limiti | Predefinito |
| --- | --- | --- | --- | --- |
| Campo`model` | Tipo`string` | RequisitoObbligatorio | Valori e limiti grok-4.6-latest | Predefinito— |
| Campo`input` | Tipo`string\|input_item[]` | RequisitoObbligatorio | Valori e limiti | Predefinito— |
| Campo`instructions` | Tipo`string` | RequisitoFacoltativo | Valori e limiti | Predefinito— |
| Campo`input[].type` | Tipo`string` | RequisitoFacoltativo | Valori e limiti message, reasoning, function\_call, function\_call\_output | Predefinito— |
| Campo`input[].content` | Tipo`string\|content_part[]` | RequisitoFacoltativo | Valori e limiti | Predefinito— |
| Campo`input[].call_id` | Tipo`string` | RequisitoFacoltativo | Valori e limiti Si applica quando: function\_call\_output; conserva il call\_id effettivamente restituito | Predefinito— |
| Campo`input[].output` | Tipo`string\|content_part[]` | RequisitoFacoltativo | Valori e limiti Si applica quando: function\_call\_output | Predefinito— |
| Campo`max_output_tokens` | Tipo`integer` | RequisitoFacoltativo | Valori e limiti Minimo: 1 Dipende dal modello | Predefinito— |
| Campo`stream` | Tipo`boolean` | RequisitoFacoltativo | Valori e limiti | Predefinitofalse |
| Campo`temperature` | Tipo`number` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`top_p` | Tipo`number` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`tools` | Tipo`tool[]` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`tool_choice` | Tipo`string\|object` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`parallel_tool_calls` | Tipo`boolean` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`reasoning.effort` | Tipo`string` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`reasoning.summary` | Tipo`string` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`text.format` | Tipo`object` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`text.verbosity` | Tipo`string` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`include` | Tipo`string[]` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`store` | Tipo`boolean` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`previous_response_id` | Tipo`string` | RequisitoFacoltativo | Valori e limiti Requisito dell’ID: Solo un ID di risposta effettivo proveniente da una continuazione supportata Dipende dal modello | Predefinito— |
| Campo`service_tier` | Tipo`string` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`prompt_cache_key` | Tipo`string` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`prompt_cache_options` | Tipo`object` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |

Combinazioni di materiali in input

**Testo** · Testo UTF8

`Testo in ingresso o parte input_text`

**Testo + immagine**

`{type:input_image,image_url}`

Parametri e ciclo di vita del metodo

| Parametro | Contratto |
| --- | --- |
| Parametro`material_types` | Contrattotext, image |
| Parametro`required` | Contrattomodel, input |
| Parametro`optional_controls` | Contrattonull |
| Parametro`content_type` | Contrattoapplication/json |
| Parametro`text_file_material` | ContrattoContenuto UTF-8 effettivo inserito come testo; ID di file/URLs richiedono supporto separato ed esatto |

Ciclo di vita: `exact retained published method`

Le strutture dei metodi e gli ID sono esatti; la capacità del fornitore è distinta dall’ammissione delle richieste.

### Tariffe

#### Tariffe dei metodi Ailoot

Input

0,002 USD */ 1K*

Output

0,006 USD */ 1K*

Lettura dalla cache

0,0005 USD */ 1K*

Scrittura nella cache

0,00 USD */ 1K*

Scrittura nella cache, 5 min

0,00 USD */ 1K tokens*

Scrittura nella cache, 1 ora

0,00 USD */ 1K tokens*

#### Prezzi per lunghezza della richiesta · OpenAI Responses

| Dimensione della richiesta, in token | Input | Output | Lettura dalla cache | Scrittura nella cache | Cache 5 min | Cache 1 ora |
| --- | --- | --- | --- | --- | --- | --- |
| Dimensione della richiesta, in token(0; 200.000\] | Input0,002 USD | Output0,006 USD | Lettura dalla cache0,0005 USD | Scrittura nella cache0,00 USD | Cache 5 min0,00 USD | Cache 1 ora0,00 USD |
| Dimensione della richiesta, in token(200.000; ∞) | Input0,004 USD | Output0,012 USD | Lettura dalla cache0,001 USD | Scrittura nella cache0,00 USD | Cache 5 min0,00 USD | Cache 1 ora0,00 USD |

Tariffe in USD per 1K token. Se non è impostata alcuna tariffa, viene ereditata la tariffa base di questo metodo; «—» indica che non è impostata alcuna tariffa base.

Ailoot prenota un importo stimato prima di una richiesta. Dopo il risultato, addebita il costo finale in base all’utilizzo misurato. Per lo streaming, l’addebito usa il record finale di utilizzo. [Come funzionano la prenotazione e l’addebito finale →](https://ailoot.ai/docs/it/billing/reserve/)

#### Dettagli della tariffa di riferimento

I listini di riferimento del modello non modificano la selezione del metodo, i preventivi o gli addebiti. Gli addebiti attivi usano le tariffe del metodo Ailoot selezionato.

Listini di riferimento del modello

#### Prezzi per configurazione

Associa ogni costo alle condizioni indicate. Usa una sola tariffa per ogni insieme di configurazioni alternative.

| Configurazione | Listino delle tariffe | Token di contesto, più di | Token di contesto, fino al limite incluso | Costo |
| --- | --- | --- | --- | --- |
| ConfigurazioneOpenAI Chat · Tariffe base per token | Listino delle tariffeTariffa base | Token di contesto, più di— | Token di contesto, fino al limite inclusoNessun limite superiore | Costo Input · Token in input **$0.004** / 1K token Output · Token in output **$0.012** / 1K token Input · Lettura dalla cache **$0.001** / 1K token Input · Scrittura nella cache **—** / 1K token Input · Scrittura nella cache, 1 ora **—** / 1K token |
| ConfigurazioneOpenAI Chat · Fascia 1 in base alla lunghezza della richiesta | Listino delle tariffe— | Token di contesto, più di0 | Token di contesto, fino al limite incluso200.000 | Costo Input · Token in input **$0.004** / 1K token Output · Token in output **$0.012** / 1K token Input · Lettura dalla cache **$0.001** / 1K token Input · Scrittura nella cache **—** / 1K token Input · Scrittura nella cache, 1 ora **—** / 1K token |
| ConfigurazioneOpenAI Chat · Fascia 2 in base alla lunghezza della richiesta | Listino delle tariffe— | Token di contesto, più di200.000 | Token di contesto, fino al limite inclusoNessun limite superiore | Costo Input · Token in input **$0.008** / 1K token Output · Token in output **$0.024** / 1K token Input · Lettura dalla cache **$0.002** / 1K token Input · Scrittura nella cache **—** / 1K token Input · Scrittura nella cache, 1 ora **—** / 1K token |
| ConfigurazioneAnthropic Messages · Tariffe base per token | Listino delle tariffeTariffa base | Token di contesto, più di— | Token di contesto, fino al limite inclusoNessun limite superiore | Costo Input · Token in input **$0.004** / 1K token Output · Token in output **$0.012** / 1K token Input · Lettura dalla cache **$0.001** / 1K token Input · Scrittura nella cache **—** / 1K token Input · Scrittura nella cache, 1 ora **—** / 1K token |
| ConfigurazioneAnthropic Messages · Fascia 1 in base alla lunghezza della richiesta | Listino delle tariffe— | Token di contesto, più di0 | Token di contesto, fino al limite incluso200.000 | Costo Input · Token in input **$0.004** / 1K token Output · Token in output **$0.012** / 1K token Input · Lettura dalla cache **$0.001** / 1K token Input · Scrittura nella cache **—** / 1K token Input · Scrittura nella cache, 1 ora **—** / 1K token |
| ConfigurazioneAnthropic Messages · Fascia 2 in base alla lunghezza della richiesta | Listino delle tariffe— | Token di contesto, più di200.000 | Token di contesto, fino al limite inclusoNessun limite superiore | Costo Input · Token in input **$0.008** / 1K token Output · Token in output **$0.024** / 1K token Input · Lettura dalla cache **$0.002** / 1K token Input · Scrittura nella cache **—** / 1K token Input · Scrittura nella cache, 1 ora **—** / 1K token |

### Esempi di richieste

#### Ailoot · OpenAI Responses

Esempio di testoInput, immaginePython SDKNode.js SDKStreaming Python

```bash
set -eu
: "${AILOOT_API_KEY:?Set your Ailoot API key}"
: "${AILOOT_TEXT_FILE:?Set your actual UTF-8 source-material file}"
export AILOOT_TEXT_FILE
python3 - <<'PY_REQUEST'
import json,os
from pathlib import Path
p=json.loads('{"model": "grok-4.6-latest", "input": ""}')
f=Path(os.environ["AILOOT_TEXT_FILE"])
if not f.is_file():raise SystemExit("Choose your actual UTF-8 source material")
text=f.read_text(encoding="utf-8")
if not text.strip():raise SystemExit("Source material must contain text")
p["input"]="Summarize this material and quote supporting source passages.\n\n"+text
Path("request.json").write_text(json.dumps(p,ensure_ascii=False))
PY_REQUEST
curl --fail-with-body --silent --show-error https://api.ailoot.ai/v1/responses \
  -H "Authorization: Bearer $AILOOT_API_KEY" -H 'Content-Type: application/json' \
  --data-binary @request.json -D response-headers.txt -o result.json
python3 - <<'PY_RESULT'
import base64, json
from pathlib import Path

def save_result(data, stem="result"):
    # Keep every field, including usage, IDs, reasoning and tool requests.
    Path(stem + ".json").write_text(json.dumps(data, ensure_ascii=False, indent=2), encoding="utf-8")
    print(json.dumps(data, ensure_ascii=False, indent=2))
    def save_blob(encoded, suffix, label):
        raw = base64.b64decode(encoded, altchars=b"-_", validate=True)
        ext = "png" if raw.startswith(b"\x89PNG\r\n\x1a\n") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4] == b"RIFF" and raw[8:12] == b"WEBP" else suffix
        file = Path(stem + "-" + label + "." + ext)
        file.write_bytes(raw)
        print("Saved", file)
    for index, block in enumerate(data.get("content") or []):
        print("Content", index, json.dumps(block, ensure_ascii=False))
    for choice in data.get("choices") or []:
        print("Choice", choice.get("index"), json.dumps(choice.get("message", choice.get("delta", {})), ensure_ascii=False))
    for index, item in enumerate(data.get("output") or []):
        print("Output", index, json.dumps(item, ensure_ascii=False))
        if item.get("type") == "image_generation_call" and item.get("result"):
            save_blob(item["result"], item.get("output_format") or "bin", "output-" + str(index))
    for ci, candidate in enumerate(data.get("candidates") or []):
        for pi, part in enumerate((candidate.get("content") or {}).get("parts") or []):
            print("Candidate/part", ci, pi, json.dumps(part, ensure_ascii=False))
            blob = part.get("inlineData") or part.get("inline_data")
            if blob and blob.get("data"):
                mime = blob.get("mimeType") or blob.get("mime_type")
                suffix = {"image/png":"png", "image/jpeg":"jpg", "image/webp":"webp", "audio/wav":"wav", "audio/mpeg":"mp3", "video/mp4":"mp4"}.get(mime, "bin")
                save_blob(blob["data"], suffix, "candidate-" + str(ci) + "-part-" + str(pi))

save_result(json.loads(Path("result.json").read_text(encoding="utf-8")))
PY_RESULT
```

```bash
set -eu
: "${AILOOT_API_KEY:?Set your Ailoot API key}"
: "${AILOOT_IMAGE_FILE:?Set your actual PNG JPEG or WebP image}"
export AILOOT_IMAGE_FILE
python3 - <<'PY_REQUEST'
import json,os
from pathlib import Path
p=json.loads('{"model": "grok-4.6-latest", "input": [{"role": "user", "content": [{"type": "input_text", "text": "Read labels and numbers in this image; flag unreadable text."}]}]}')
import base64
f=Path(os.environ["AILOOT_IMAGE_FILE"])
if not f.is_file():raise SystemExit("Choose an actual PNG JPEG or WebP image")
raw=f.read_bytes()
mime="image/png" if raw.startswith(b"\x89PNG\r\n\x1a\n") else "image/jpeg" if raw.startswith(b"\xff\xd8") else "image/webp" if raw[:4]==b"RIFF" and raw[8:12]==b"WEBP" else None
if not mime:raise SystemExit("Use PNG JPEG or WebP")
b64=base64.b64encode(raw).decode()
p["input"][0]["content"].append({"type":"input_image","image_url":"data:"+mime+";base64,"+b64})
Path("request.json").write_text(json.dumps(p,ensure_ascii=False))
PY_REQUEST
curl --fail-with-body --silent --show-error https://api.ailoot.ai/v1/responses \
  -H "Authorization: Bearer $AILOOT_API_KEY" -H 'Content-Type: application/json' \
  --data-binary @request.json -D response-headers.txt -o result.json
python3 - <<'PY_RESULT'
import base64, json
from pathlib import Path

def save_result(data, stem="result"):
    # Keep every field, including usage, IDs, reasoning and tool requests.
    Path(stem + ".json").write_text(json.dumps(data, ensure_ascii=False, indent=2), encoding="utf-8")
    print(json.dumps(data, ensure_ascii=False, indent=2))
    def save_blob(encoded, suffix, label):
        raw = base64.b64decode(encoded, altchars=b"-_", validate=True)
        ext = "png" if raw.startswith(b"\x89PNG\r\n\x1a\n") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4] == b"RIFF" and raw[8:12] == b"WEBP" else suffix
        file = Path(stem + "-" + label + "." + ext)
        file.write_bytes(raw)
        print("Saved", file)
    for index, block in enumerate(data.get("content") or []):
        print("Content", index, json.dumps(block, ensure_ascii=False))
    for choice in data.get("choices") or []:
        print("Choice", choice.get("index"), json.dumps(choice.get("message", choice.get("delta", {})), ensure_ascii=False))
    for index, item in enumerate(data.get("output") or []):
        print("Output", index, json.dumps(item, ensure_ascii=False))
        if item.get("type") == "image_generation_call" and item.get("result"):
            save_blob(item["result"], item.get("output_format") or "bin", "output-" + str(index))
    for ci, candidate in enumerate(data.get("candidates") or []):
        for pi, part in enumerate((candidate.get("content") or {}).get("parts") or []):
            print("Candidate/part", ci, pi, json.dumps(part, ensure_ascii=False))
            blob = part.get("inlineData") or part.get("inline_data")
            if blob and blob.get("data"):
                mime = blob.get("mimeType") or blob.get("mime_type")
                suffix = {"image/png":"png", "image/jpeg":"jpg", "image/webp":"webp", "audio/wav":"wav", "audio/mpeg":"mp3", "video/mp4":"mp4"}.get(mime, "bin")
                save_blob(blob["data"], suffix, "candidate-" + str(ci) + "-part-" + str(pi))

save_result(json.loads(Path("result.json").read_text(encoding="utf-8")))
PY_RESULT
```

```python
from openai import OpenAI
import os

if not os.environ.get("AILOOT_API_KEY", "").strip(): raise SystemExit("Set AILOOT_API_KEY before making a request")
client = OpenAI(base_url="https://api.ailoot.ai/v1", api_key=os.environ["AILOOT_API_KEY"], max_retries=0)
resp = client.responses.create(model="grok-4.6-latest", input="Explain the difference between an observation and a hypothesis in three sentences.")
import base64, json
from pathlib import Path

def save_result(data, stem="result"):
    # Keep every field, including usage, IDs, reasoning and tool requests.
    Path(stem + ".json").write_text(json.dumps(data, ensure_ascii=False, indent=2), encoding="utf-8")
    print(json.dumps(data, ensure_ascii=False, indent=2))
    def save_blob(encoded, suffix, label):
        raw = base64.b64decode(encoded, altchars=b"-_", validate=True)
        ext = "png" if raw.startswith(b"\x89PNG\r\n\x1a\n") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4] == b"RIFF" and raw[8:12] == b"WEBP" else suffix
        file = Path(stem + "-" + label + "." + ext)
        file.write_bytes(raw)
        print("Saved", file)
    for index, block in enumerate(data.get("content") or []):
        print("Content", index, json.dumps(block, ensure_ascii=False))
    for choice in data.get("choices") or []:
        print("Choice", choice.get("index"), json.dumps(choice.get("message", choice.get("delta", {})), ensure_ascii=False))
    for index, item in enumerate(data.get("output") or []):
        print("Output", index, json.dumps(item, ensure_ascii=False))
        if item.get("type") == "image_generation_call" and item.get("result"):
            save_blob(item["result"], item.get("output_format") or "bin", "output-" + str(index))
    for ci, candidate in enumerate(data.get("candidates") or []):
        for pi, part in enumerate((candidate.get("content") or {}).get("parts") or []):
            print("Candidate/part", ci, pi, json.dumps(part, ensure_ascii=False))
            blob = part.get("inlineData") or part.get("inline_data")
            if blob and blob.get("data"):
                mime = blob.get("mimeType") or blob.get("mime_type")
                suffix = {"image/png":"png", "image/jpeg":"jpg", "image/webp":"webp", "audio/wav":"wav", "audio/mpeg":"mp3", "video/mp4":"mp4"}.get(mime, "bin")
                save_blob(blob["data"], suffix, "candidate-" + str(ci) + "-part-" + str(pi))

save_result(resp.to_dict(mode="json"))
```

```js
import OpenAI from "openai";

if (!process.env.AILOOT_API_KEY?.trim()) throw new Error("Set AILOOT_API_KEY before making a request");
const client = new OpenAI({ baseURL: "https://api.ailoot.ai/v1", apiKey: process.env.AILOOT_API_KEY, maxRetries: 0 });
const resp = await client.responses.create({ model: "grok-4.6-latest", input: "Explain the difference between an observation and a hypothesis in three sentences." });
import { writeFileSync } from "node:fs";

function saveResult(data, stem = "result") {
  writeFileSync(stem + ".json", JSON.stringify(data, null, 2));
  console.log(JSON.stringify(data, null, 2));
  const saveBlob = (encoded, suffix, label) => {
    const raw = Buffer.from(encoded, "base64");
    const ext = raw.subarray(0,8).equals(Buffer.from([137,80,78,71,13,10,26,10])) ? "png" : raw[0]===255 && raw[1]===216 ? "jpg" : raw.subarray(0,4).toString()==="RIFF" && raw.subarray(8,12).toString()==="WEBP" ? "webp" : suffix;
    const file = `${stem}-${label}.${ext}`;
    writeFileSync(file, raw); console.log("Saved", file);
  };
  for (const [i, block] of (data.content || []).entries()) console.log("Content", i, JSON.stringify(block));
  for (const choice of data.choices || []) console.log("Choice", choice.index, JSON.stringify(choice.message || choice.delta || {}));
  for (const [i, item] of (data.output || []).entries()) {
    console.log("Output", i, JSON.stringify(item));
    if (item.type === "image_generation_call" && item.result) saveBlob(item.result, item.output_format || "bin", `output-${i}`);
  }
  for (const [ci, candidate] of (data.candidates || []).entries()) {
    for (const [pi, part] of (candidate.content?.parts || []).entries()) {
      console.log("Candidate/part", ci, pi, JSON.stringify(part));
      const blob = part.inlineData || part.inline_data;
      if (blob?.data) {
        const mime = blob.mimeType || blob.mime_type;
        const suffix = ({"image/png":"png", "image/jpeg":"jpg", "image/webp":"webp", "audio/wav":"wav", "audio/mpeg":"mp3", "video/mp4":"mp4"})[mime] || "bin";
        saveBlob(blob.data, suffix, `candidate-${ci}-part-${pi}`);
      }
    }
  }
}

saveResult(resp);
```

```python
from openai import OpenAI
import os
from pathlib import Path
import base64, json
from pathlib import Path

def save_result(data, stem="result"):
    # Keep every field, including usage, IDs, reasoning and tool requests.
    Path(stem + ".json").write_text(json.dumps(data, ensure_ascii=False, indent=2), encoding="utf-8")
    print(json.dumps(data, ensure_ascii=False, indent=2))
    def save_blob(encoded, suffix, label):
        raw = base64.b64decode(encoded, altchars=b"-_", validate=True)
        ext = "png" if raw.startswith(b"\x89PNG\r\n\x1a\n") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4] == b"RIFF" and raw[8:12] == b"WEBP" else suffix
        file = Path(stem + "-" + label + "." + ext)
        file.write_bytes(raw)
        print("Saved", file)
    for index, block in enumerate(data.get("content") or []):
        print("Content", index, json.dumps(block, ensure_ascii=False))
    for choice in data.get("choices") or []:
        print("Choice", choice.get("index"), json.dumps(choice.get("message", choice.get("delta", {})), ensure_ascii=False))
    for index, item in enumerate(data.get("output") or []):
        print("Output", index, json.dumps(item, ensure_ascii=False))
        if item.get("type") == "image_generation_call" and item.get("result"):
            save_blob(item["result"], item.get("output_format") or "bin", "output-" + str(index))
    for ci, candidate in enumerate(data.get("candidates") or []):
        for pi, part in enumerate((candidate.get("content") or {}).get("parts") or []):
            print("Candidate/part", ci, pi, json.dumps(part, ensure_ascii=False))
            blob = part.get("inlineData") or part.get("inline_data")
            if blob and blob.get("data"):
                mime = blob.get("mimeType") or blob.get("mime_type")
                suffix = {"image/png":"png", "image/jpeg":"jpg", "image/webp":"webp", "audio/wav":"wav", "audio/mpeg":"mp3", "video/mp4":"mp4"}.get(mime, "bin")
                save_blob(blob["data"], suffix, "candidate-" + str(ci) + "-part-" + str(pi))

if not os.environ.get("AILOOT_API_KEY", "").strip(): raise SystemExit("Set AILOOT_API_KEY before making a request")
client=OpenAI(base_url="https://api.ailoot.ai/v1",api_key=os.environ["AILOOT_API_KEY"],max_retries=0)
with client.responses.stream(model="grok-4.6-latest", input="Explain the difference between an observation and a hypothesis in three sentences.") as stream:
    with Path("stream-events.jsonl").open("w",encoding="utf-8") as log:
        for event in stream:
            payload=event.to_dict(mode="json")
            log.write(json.dumps(payload,ensure_ascii=False)+"\n"); log.flush()
            print(json.dumps(payload,ensure_ascii=False))
    final=stream.get_final_response()
    save_result(final.to_dict(mode="json"),"stream-result")
```

### Ricevi e salva i risultati

#### Ailoot · OpenAI Responses

json o SSE

##### Conserva tutti i risultati completati

Conserva ogni risposta, file e parte di contenuto restituiti per intero.

Conserva ogni elemento di uscita e parte di contenuto, il call\_id effettivo della funzione, il ragionamento cifrato e i dati di utilizzo. Nello streaming conserva l’identità completa di eventi ed elementi.

##### Se occorre verificare la risposta originale

Conserva gli ID e le intestazioni di richiesta/risposta. Non viene fornito alcun URL generico per recuperare un’attività testuale.

Campi della risposta

| Campo | Tipo |
| --- | --- |
| Campo`id` | Tipostring |
| Campo`status` | Tipostring |
| Campo`output[]` | Tipomessage\|reasoning\|function\_call\|other item |
| Campo`output[].content[]` | Tipocontent part |
| Campo`usage` | Tipoobject |

Errori e passaggi successivi

| Risposta | Condizione | Passaggio successivo |
| --- | --- | --- |
| Risposta400 · `invalid_request_error` | CondizioneCampi obbligatori, rappresentazione del materiale o valore del parametro non validi | Passaggio successivoCorreggi i campi indicati prima di una nuova richiesta di creazione. |

### Alias

#### Alias del modello

<strong>Ailoot</strong> [`grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Core&caller=grok-4.6&fmt=responses), [`grok-4.6-latest`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Core&caller=grok-4.6-latest&fmt=responses)
**Ailoot Ultra** [`grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Ultra&caller=grok-4.6), [`x-ai/grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Ultra&caller=x-ai%2Fgrok-4.6)

#### Alias dei percorsi dei metodi

`/chat/completions`

#### ID di chiamata correlati

[`x-ai/grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Ultra&caller=x-ai%2Fgrok-4.6), [`grok-4.6-latest`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Core&caller=grok-4.6-latest&fmt=responses), [`grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Core&caller=grok-4.6&fmt=responses), [`grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Ultra&caller=grok-4.6)

**Ailoot · OpenAI Chat** `POST /v1/chat/completions` `grok-4.6-latest`

[`grok-4.6-latest`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Core&caller=grok-4.6-latest&fmt=chat)

SpaceXAI /`grok-4.6-latest`

ID del modello

- `grok-4.6`
- `grok-4.6-latest`

### Introduzione

Grok 4.6 è stato creato per lavori prolungati su codice, ricerche e progetti interattivi. Riceve testo e immagini e supporta un contesto di 500 000 token e quattro livelli di ragionamento.

Input accettati

Testo · Immagini

Risultati

Testo

### Disponibile in Ailoot · input e metodi

**Ailoot · OpenAI Chat** `POST /v1/chat/completions`

Tipi di input

`text`, `image`

Tipi di output

`text`

Contesto

500.000 tokens

Output massimo

500.000 tokens

Formato di output

json o SSE

| Campo | Tipo | Requisito | Valori e limiti | Predefinito |
| --- | --- | --- | --- | --- |
| Campo`model` | Tipo`string` | RequisitoObbligatorio | Valori e limiti grok-4.6-latest | Predefinito— |
| Campo`messages` | Tipo`message[]` | RequisitoObbligatorio | Valori e limiti Numero minimo di elementi: 1 | Predefinito— |
| Campo`messages[].role` | Tipo`string` | RequisitoObbligatorio | Valori e limiti Esempi: system, user, assistant, tool, function Condizioni: Questi ruoli sono rappresentati esplicitamente dai tipi di compatibilità del codice sorgente; l’insieme esatto dei ruoli rimane specifico del modello. Dipende dal modello | Predefinito— |
| Campo`messages[].content` | Tipo`string\|content_part[]\|null` | RequisitoFacoltativo | Valori e limiti | Predefinito— |
| Campo`messages[].tool_calls` | Tipo`tool_call[]` | RequisitoFacoltativo | Valori e limiti | Predefinito— |
| Campo`messages[].tool_call_id` | Tipo`string` | RequisitoFacoltativo | Valori e limiti Si applica quando: role=tool; usa l’ID effettivamente restituito | Predefinito— |
| Campo`messages[].name` | Tipo`string` | RequisitoFacoltativo | Valori e limiti | Predefinito— |
| Campo`messages[].reasoning_content` | Tipo`string` | RequisitoFacoltativo | Valori e limiti Si applica quando: Reinserisci il ragionamento effettivamente restituito quando il modello lo utilizza | Predefinito— |
| Campo`messages[].reasoning_details` | Tipo`object\|array` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`max_tokens` | Tipo`integer` | RequisitoFacoltativo | Valori e limiti Minimo: 1 Dipende dal modello | Predefinito— |
| Campo`max_completion_tokens` | Tipo`integer` | RequisitoFacoltativo | Valori e limiti Minimo: 1 Dipende dal modello | Predefinito— |
| Campo`stream` | Tipo`boolean` | RequisitoFacoltativo | Valori e limiti | Predefinitofalse |
| Campo`stream_options.include_usage` | Tipo`boolean` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`temperature` | Tipo`number` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`top_p` | Tipo`number` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`stop` | Tipo`string\|string[]` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`tools` | Tipo`function_tool[]` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`tools[].type` | Tipo`string` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`tools[].function.name` | Tipo`string` | RequisitoObbligatorio | Valori e limiti Si applica quando: Funzione fornita come strumento | Predefinito— |
| Campo`tools[].function.description` | Tipo`string` | RequisitoFacoltativo | Valori e limiti | Predefinito— |
| Campo`tools[].function.parameters` | Tipo`JSON_schema` | RequisitoFacoltativo | Valori e limiti | Predefinito— |
| Campo`tool_choice` | Tipo`string\|object` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`parallel_tool_calls` | Tipo`boolean` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`response_format` | Tipo`object` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`reasoning_effort` | Tipo`string` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`reasoning` | Tipo`object` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`service_tier` | Tipo`string` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`instructions` | Tipo`string` | RequisitoFacoltativo | Valori e limiti Campo di compatibilità | Predefinito— |
| Campo`functions` | Tipo`function[]` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`function_call` | Tipo`string\|object` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`prompt_cache_options` | Tipo`object` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |

Combinazioni di materiali in input

**Testo** · Testo UTF8

`messages[].content`

**Testo + immagine**

`{type:image_url,image_url:{url,detail}}`

Parametri e ciclo di vita del metodo

| Parametro | Contratto |
| --- | --- |
| Parametro`material_types` | Contrattotext, image |
| Parametro`required` | Contrattomodel, messages |
| Parametro`optional_controls` | Contrattonull |
| Parametro`content_type` | Contrattoapplication/json |
| Parametro`text_file_material` | ContrattoContenuto UTF-8 effettivo inserito come testo; ID di file/URLs richiedono supporto separato ed esatto |

Ciclo di vita: `exact retained published method`

Le strutture dei metodi e gli ID sono esatti; la capacità del fornitore è distinta dall’ammissione delle richieste.

### Tariffe

#### Tariffe dei metodi Ailoot

Input

0,002 USD */ 1K*

Output

0,006 USD */ 1K*

Lettura dalla cache

0,0005 USD */ 1K*

Scrittura nella cache

0,00 USD */ 1K*

Scrittura nella cache, 5 min

0,00 USD */ 1K tokens*

Scrittura nella cache, 1 ora

0,00 USD */ 1K tokens*

#### Prezzi per lunghezza della richiesta · OpenAI Chat

| Dimensione della richiesta, in token | Input | Output | Lettura dalla cache | Scrittura nella cache | Cache 5 min | Cache 1 ora |
| --- | --- | --- | --- | --- | --- | --- |
| Dimensione della richiesta, in token(0; 200.000\] | Input0,002 USD | Output0,006 USD | Lettura dalla cache0,0005 USD | Scrittura nella cache0,00 USD | Cache 5 min0,00 USD | Cache 1 ora0,00 USD |
| Dimensione della richiesta, in token(200.000; ∞) | Input0,004 USD | Output0,012 USD | Lettura dalla cache0,001 USD | Scrittura nella cache0,00 USD | Cache 5 min0,00 USD | Cache 1 ora0,00 USD |

Tariffe in USD per 1K token. Se non è impostata alcuna tariffa, viene ereditata la tariffa base di questo metodo; «—» indica che non è impostata alcuna tariffa base.

Ailoot prenota un importo stimato prima di una richiesta. Dopo il risultato, addebita il costo finale in base all’utilizzo misurato. Per lo streaming, l’addebito usa il record finale di utilizzo. [Come funzionano la prenotazione e l’addebito finale →](https://ailoot.ai/docs/it/billing/reserve/)

#### Dettagli della tariffa di riferimento

I listini di riferimento del modello non modificano la selezione del metodo, i preventivi o gli addebiti. Gli addebiti attivi usano le tariffe del metodo Ailoot selezionato.

Listini di riferimento del modello

#### Prezzi per configurazione

Associa ogni costo alle condizioni indicate. Usa una sola tariffa per ogni insieme di configurazioni alternative.

| Configurazione | Listino delle tariffe | Token di contesto, più di | Token di contesto, fino al limite incluso | Costo |
| --- | --- | --- | --- | --- |
| ConfigurazioneOpenAI Chat · Tariffe base per token | Listino delle tariffeTariffa base | Token di contesto, più di— | Token di contesto, fino al limite inclusoNessun limite superiore | Costo Input · Token in input **$0.004** / 1K token Output · Token in output **$0.012** / 1K token Input · Lettura dalla cache **$0.001** / 1K token Input · Scrittura nella cache **—** / 1K token Input · Scrittura nella cache, 1 ora **—** / 1K token |
| ConfigurazioneOpenAI Chat · Fascia 1 in base alla lunghezza della richiesta | Listino delle tariffe— | Token di contesto, più di0 | Token di contesto, fino al limite incluso200.000 | Costo Input · Token in input **$0.004** / 1K token Output · Token in output **$0.012** / 1K token Input · Lettura dalla cache **$0.001** / 1K token Input · Scrittura nella cache **—** / 1K token Input · Scrittura nella cache, 1 ora **—** / 1K token |
| ConfigurazioneOpenAI Chat · Fascia 2 in base alla lunghezza della richiesta | Listino delle tariffe— | Token di contesto, più di200.000 | Token di contesto, fino al limite inclusoNessun limite superiore | Costo Input · Token in input **$0.008** / 1K token Output · Token in output **$0.024** / 1K token Input · Lettura dalla cache **$0.002** / 1K token Input · Scrittura nella cache **—** / 1K token Input · Scrittura nella cache, 1 ora **—** / 1K token |
| ConfigurazioneAnthropic Messages · Tariffe base per token | Listino delle tariffeTariffa base | Token di contesto, più di— | Token di contesto, fino al limite inclusoNessun limite superiore | Costo Input · Token in input **$0.004** / 1K token Output · Token in output **$0.012** / 1K token Input · Lettura dalla cache **$0.001** / 1K token Input · Scrittura nella cache **—** / 1K token Input · Scrittura nella cache, 1 ora **—** / 1K token |
| ConfigurazioneAnthropic Messages · Fascia 1 in base alla lunghezza della richiesta | Listino delle tariffe— | Token di contesto, più di0 | Token di contesto, fino al limite incluso200.000 | Costo Input · Token in input **$0.004** / 1K token Output · Token in output **$0.012** / 1K token Input · Lettura dalla cache **$0.001** / 1K token Input · Scrittura nella cache **—** / 1K token Input · Scrittura nella cache, 1 ora **—** / 1K token |
| ConfigurazioneAnthropic Messages · Fascia 2 in base alla lunghezza della richiesta | Listino delle tariffe— | Token di contesto, più di200.000 | Token di contesto, fino al limite inclusoNessun limite superiore | Costo Input · Token in input **$0.008** / 1K token Output · Token in output **$0.024** / 1K token Input · Lettura dalla cache **$0.002** / 1K token Input · Scrittura nella cache **—** / 1K token Input · Scrittura nella cache, 1 ora **—** / 1K token |

### Esempi di richieste

#### Ailoot · OpenAI Chat

Esempio di testoInput, immaginePython SDKNode.js SDKStreaming Python

```bash
set -eu
: "${AILOOT_API_KEY:?Set your Ailoot API key}"
: "${AILOOT_TEXT_FILE:?Set your actual UTF-8 source-material file}"
export AILOOT_TEXT_FILE
python3 - <<'PY_REQUEST'
import json,os
from pathlib import Path
p=json.loads('{"model": "grok-4.6-latest", "messages": []}')
f=Path(os.environ["AILOOT_TEXT_FILE"])
if not f.is_file():raise SystemExit("Choose your actual UTF-8 source material")
text=f.read_text(encoding="utf-8")
if not text.strip():raise SystemExit("Source material must contain text")
p["messages"]=[{"role":"user","content":"Summarize this material and quote supporting source passages.\n\n"+text}]
Path("request.json").write_text(json.dumps(p,ensure_ascii=False))
PY_REQUEST
curl --fail-with-body --silent --show-error https://api.ailoot.ai/v1/chat/completions \
  -H "Authorization: Bearer $AILOOT_API_KEY" -H 'Content-Type: application/json' \
  --data-binary @request.json -D response-headers.txt -o result.json
python3 - <<'PY_RESULT'
import json
from pathlib import Path
print(json.dumps(json.loads(Path("result.json").read_text()),ensure_ascii=False,indent=2))
PY_RESULT
```

```bash
set -eu
: "${AILOOT_API_KEY:?Set your Ailoot API key}"
: "${AILOOT_IMAGE_FILE:?Set your actual PNG JPEG or WebP image}"
export AILOOT_IMAGE_FILE
python3 - <<'PY_REQUEST'
import json,os
from pathlib import Path
p=json.loads('{"model": "grok-4.6-latest", "messages": [{"role": "user", "content": [{"type": "text", "text": "Read labels and numbers in this image; flag unreadable text."}]}]}')
import base64
f=Path(os.environ["AILOOT_IMAGE_FILE"])
if not f.is_file():raise SystemExit("Choose an actual PNG JPEG or WebP image")
raw=f.read_bytes()
mime="image/png" if raw.startswith(b"\x89PNG\r\n\x1a\n") else "image/jpeg" if raw.startswith(b"\xff\xd8") else "image/webp" if raw[:4]==b"RIFF" and raw[8:12]==b"WEBP" else None
if not mime:raise SystemExit("Use PNG JPEG or WebP")
b64=base64.b64encode(raw).decode()
p["messages"][0]["content"].append({"type":"image_url","image_url":{"url":"data:"+mime+";base64,"+b64}})
Path("request.json").write_text(json.dumps(p,ensure_ascii=False))
PY_REQUEST
curl --fail-with-body --silent --show-error https://api.ailoot.ai/v1/chat/completions \
  -H "Authorization: Bearer $AILOOT_API_KEY" -H 'Content-Type: application/json' \
  --data-binary @request.json -D response-headers.txt -o result.json
python3 - <<'PY_RESULT'
import json
from pathlib import Path
print(json.dumps(json.loads(Path("result.json").read_text()),ensure_ascii=False,indent=2))
PY_RESULT
```

```python
from openai import OpenAI
import os

if not os.environ.get("AILOOT_API_KEY", "").strip(): raise SystemExit("Set AILOOT_API_KEY before making a request")
client = OpenAI(base_url="https://api.ailoot.ai/v1", api_key=os.environ["AILOOT_API_KEY"], max_retries=0)
resp = client.chat.completions.create(
    model="grok-4.6-latest",
    messages=[{"role": "user", "content": "Explain the difference between an observation and a hypothesis in three sentences."}],
)
import base64, json
from pathlib import Path

def save_result(data, stem="result"):
    # Keep every field, including usage, IDs, reasoning and tool requests.
    Path(stem + ".json").write_text(json.dumps(data, ensure_ascii=False, indent=2), encoding="utf-8")
    print(json.dumps(data, ensure_ascii=False, indent=2))
    def save_blob(encoded, suffix, label):
        raw = base64.b64decode(encoded, altchars=b"-_", validate=True)
        ext = "png" if raw.startswith(b"\x89PNG\r\n\x1a\n") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4] == b"RIFF" and raw[8:12] == b"WEBP" else suffix
        file = Path(stem + "-" + label + "." + ext)
        file.write_bytes(raw)
        print("Saved", file)
    for index, block in enumerate(data.get("content") or []):
        print("Content", index, json.dumps(block, ensure_ascii=False))
    for choice in data.get("choices") or []:
        print("Choice", choice.get("index"), json.dumps(choice.get("message", choice.get("delta", {})), ensure_ascii=False))
    for index, item in enumerate(data.get("output") or []):
        print("Output", index, json.dumps(item, ensure_ascii=False))
        if item.get("type") == "image_generation_call" and item.get("result"):
            save_blob(item["result"], item.get("output_format") or "bin", "output-" + str(index))
    for ci, candidate in enumerate(data.get("candidates") or []):
        for pi, part in enumerate((candidate.get("content") or {}).get("parts") or []):
            print("Candidate/part", ci, pi, json.dumps(part, ensure_ascii=False))
            blob = part.get("inlineData") or part.get("inline_data")
            if blob and blob.get("data"):
                mime = blob.get("mimeType") or blob.get("mime_type")
                suffix = {"image/png":"png", "image/jpeg":"jpg", "image/webp":"webp", "audio/wav":"wav", "audio/mpeg":"mp3", "video/mp4":"mp4"}.get(mime, "bin")
                save_blob(blob["data"], suffix, "candidate-" + str(ci) + "-part-" + str(pi))

save_result(resp.to_dict(mode="json"))
```

```js
import OpenAI from "openai";

if (!process.env.AILOOT_API_KEY?.trim()) throw new Error("Set AILOOT_API_KEY before making a request");
const client = new OpenAI({ baseURL: "https://api.ailoot.ai/v1", apiKey: process.env.AILOOT_API_KEY, maxRetries: 0 });
const resp = await client.chat.completions.create({
  model: "grok-4.6-latest",
  messages: [{ role: "user", content: "Explain the difference between an observation and a hypothesis in three sentences." }],
});
import { writeFileSync } from "node:fs";

function saveResult(data, stem = "result") {
  writeFileSync(stem + ".json", JSON.stringify(data, null, 2));
  console.log(JSON.stringify(data, null, 2));
  const saveBlob = (encoded, suffix, label) => {
    const raw = Buffer.from(encoded, "base64");
    const ext = raw.subarray(0,8).equals(Buffer.from([137,80,78,71,13,10,26,10])) ? "png" : raw[0]===255 && raw[1]===216 ? "jpg" : raw.subarray(0,4).toString()==="RIFF" && raw.subarray(8,12).toString()==="WEBP" ? "webp" : suffix;
    const file = `${stem}-${label}.${ext}`;
    writeFileSync(file, raw); console.log("Saved", file);
  };
  for (const [i, block] of (data.content || []).entries()) console.log("Content", i, JSON.stringify(block));
  for (const choice of data.choices || []) console.log("Choice", choice.index, JSON.stringify(choice.message || choice.delta || {}));
  for (const [i, item] of (data.output || []).entries()) {
    console.log("Output", i, JSON.stringify(item));
    if (item.type === "image_generation_call" && item.result) saveBlob(item.result, item.output_format || "bin", `output-${i}`);
  }
  for (const [ci, candidate] of (data.candidates || []).entries()) {
    for (const [pi, part] of (candidate.content?.parts || []).entries()) {
      console.log("Candidate/part", ci, pi, JSON.stringify(part));
      const blob = part.inlineData || part.inline_data;
      if (blob?.data) {
        const mime = blob.mimeType || blob.mime_type;
        const suffix = ({"image/png":"png", "image/jpeg":"jpg", "image/webp":"webp", "audio/wav":"wav", "audio/mpeg":"mp3", "video/mp4":"mp4"})[mime] || "bin";
        saveBlob(blob.data, suffix, `candidate-${ci}-part-${pi}`);
      }
    }
  }
}

saveResult(resp);
```

```python
from openai import OpenAI
import os
from pathlib import Path

if not os.environ.get("AILOOT_API_KEY", "").strip(): raise SystemExit("Set AILOOT_API_KEY before making a request")
client=OpenAI(base_url="https://api.ailoot.ai/v1",api_key=os.environ["AILOOT_API_KEY"],max_retries=0)
import base64, json
from pathlib import Path

def save_result(data, stem="result"):
    # Keep every field, including usage, IDs, reasoning and tool requests.
    Path(stem + ".json").write_text(json.dumps(data, ensure_ascii=False, indent=2), encoding="utf-8")
    print(json.dumps(data, ensure_ascii=False, indent=2))
    def save_blob(encoded, suffix, label):
        raw = base64.b64decode(encoded, altchars=b"-_", validate=True)
        ext = "png" if raw.startswith(b"\x89PNG\r\n\x1a\n") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4] == b"RIFF" and raw[8:12] == b"WEBP" else suffix
        file = Path(stem + "-" + label + "." + ext)
        file.write_bytes(raw)
        print("Saved", file)
    for index, block in enumerate(data.get("content") or []):
        print("Content", index, json.dumps(block, ensure_ascii=False))
    for choice in data.get("choices") or []:
        print("Choice", choice.get("index"), json.dumps(choice.get("message", choice.get("delta", {})), ensure_ascii=False))
    for index, item in enumerate(data.get("output") or []):
        print("Output", index, json.dumps(item, ensure_ascii=False))
        if item.get("type") == "image_generation_call" and item.get("result"):
            save_blob(item["result"], item.get("output_format") or "bin", "output-" + str(index))
    for ci, candidate in enumerate(data.get("candidates") or []):
        for pi, part in enumerate((candidate.get("content") or {}).get("parts") or []):
            print("Candidate/part", ci, pi, json.dumps(part, ensure_ascii=False))
            blob = part.get("inlineData") or part.get("inline_data")
            if blob and blob.get("data"):
                mime = blob.get("mimeType") or blob.get("mime_type")
                suffix = {"image/png":"png", "image/jpeg":"jpg", "image/webp":"webp", "audio/wav":"wav", "audio/mpeg":"mp3", "video/mp4":"mp4"}.get(mime, "bin")
                save_blob(blob["data"], suffix, "candidate-" + str(ci) + "-part-" + str(pi))

with client.chat.completions.stream(model='grok-4.6-latest',messages=[{"role":"user","content":"Explain observations and hypotheses in three sentences."}]) as stream:
    with Path("stream-events.jsonl").open("w",encoding="utf-8") as log:
        for event in stream:
            payload=event.to_dict(mode="json")
            log.write(json.dumps(payload,ensure_ascii=False)+"\n"); log.flush()
            print(json.dumps(payload,ensure_ascii=False))
    final=stream.get_final_completion()
    save_result(final.to_dict(mode="json"),"stream-result")
```

### Ricevi e salva i risultati

#### Ailoot · OpenAI Chat

json o SSE

##### Conserva tutti i risultati completati

Conserva ogni risposta, file e parte di contenuto restituiti per intero.

Conserva ogni scelta con contenuto, chiamate agli strumenti e ragionamento. In SSE assembla i delta per indice di scelta e strumento e conserva il motivo finale di completamento e i dati di utilizzo.

##### Se occorre verificare la risposta originale

Conserva gli ID e le intestazioni di richiesta/risposta. Non viene fornito alcun URL generico per recuperare un’attività testuale.

Campi della risposta

| Campo | Tipo |
| --- | --- |
| Campo`choices[].index` | Tipointeger |
| Campo`choices[].message.content` | Tipostring\|null |
| Campo`choices[].message.tool_calls` | Tipotool\_call\[\] |
| Campo`choices[].message.reasoning_content` | Tipostring |
| Campo`choices[].message.reasoning_details` | Tipoobject\|array |
| Campo`choices[].finish_reason` | Tipostring\|null |
| Campo`usage` | Tipoobject |

Errori e passaggi successivi

| Risposta | Condizione | Passaggio successivo |
| --- | --- | --- |
| Risposta400 · `invalid_request_error` | CondizioneCampi obbligatori, rappresentazione del materiale o valore del parametro non validi | Passaggio successivoCorreggi i campi indicati prima di una nuova richiesta di creazione. |

### Alias

#### Alias del modello

<strong>Ailoot</strong> [`grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Core&caller=grok-4.6&fmt=chat), [`grok-4.6-latest`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Core&caller=grok-4.6-latest&fmt=chat)
**Ailoot Ultra** [`grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Ultra&caller=grok-4.6&fmt=chat), [`x-ai/grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Ultra&caller=x-ai%2Fgrok-4.6&fmt=chat)

#### Alias dei percorsi dei metodi

`/chat/completions`

#### ID di chiamata correlati

[`x-ai/grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Ultra&caller=x-ai%2Fgrok-4.6&fmt=chat), [`grok-4.6-latest`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Core&caller=grok-4.6-latest&fmt=chat), [`grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Core&caller=grok-4.6&fmt=chat), [`grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Ultra&caller=grok-4.6&fmt=chat)

**Ailoot Ultra · OpenAI Chat** `POST /v1/chat/completions` `x-ai/grok-4.6`

[`x-ai/grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Ultra&caller=x-ai%2Fgrok-4.6&fmt=chat)

SpaceXAI /`x-ai/grok-4.6`

ID del modello

- `grok-4.6`
- `x-ai/grok-4.6`

### Introduzione

Grok 4.6 è stato creato per lavori prolungati su codice, ricerche e progetti interattivi. Riceve testo e immagini e supporta un contesto di 500 000 token e quattro livelli di ragionamento.

Input accettati

Testo

Risultati

Testo

### Disponibile in Ailoot · input e metodi

**Ailoot Ultra · OpenAI Chat** `POST /v1/chat/completions`

Tipi di input

`text`

Tipi di output

`text`

Formato di output

json o SSE

| Campo | Tipo | Requisito | Valori e limiti | Predefinito |
| --- | --- | --- | --- | --- |
| Campo`model` | Tipo`string` | RequisitoObbligatorio | Valori e limiti x-ai/grok-4.6 | Predefinito— |
| Campo`messages` | Tipo`message[]` | RequisitoObbligatorio | Valori e limiti Numero minimo di elementi: 1 | Predefinito— |
| Campo`messages[].role` | Tipo`string` | RequisitoObbligatorio | Valori e limiti Esempi: system, user, assistant, tool, function Condizioni: Questi ruoli sono rappresentati esplicitamente dai tipi di compatibilità del codice sorgente; l’insieme esatto dei ruoli rimane specifico del modello. Dipende dal modello | Predefinito— |
| Campo`messages[].content` | Tipo`string\|content_part[]\|null` | RequisitoFacoltativo | Valori e limiti | Predefinito— |
| Campo`messages[].tool_calls` | Tipo`tool_call[]` | RequisitoFacoltativo | Valori e limiti | Predefinito— |
| Campo`messages[].tool_call_id` | Tipo`string` | RequisitoFacoltativo | Valori e limiti Si applica quando: role=tool; usa l’ID effettivamente restituito | Predefinito— |
| Campo`messages[].name` | Tipo`string` | RequisitoFacoltativo | Valori e limiti | Predefinito— |
| Campo`messages[].reasoning_content` | Tipo`string` | RequisitoFacoltativo | Valori e limiti Si applica quando: Reinserisci il ragionamento effettivamente restituito quando il modello lo utilizza | Predefinito— |
| Campo`messages[].reasoning_details` | Tipo`object\|array` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`max_tokens` | Tipo`integer` | RequisitoFacoltativo | Valori e limiti Minimo: 1 Dipende dal modello | Predefinito— |
| Campo`max_completion_tokens` | Tipo`integer` | RequisitoFacoltativo | Valori e limiti Minimo: 1 Dipende dal modello | Predefinito— |
| Campo`stream` | Tipo`boolean` | RequisitoFacoltativo | Valori e limiti | Predefinitofalse |
| Campo`stream_options.include_usage` | Tipo`boolean` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`temperature` | Tipo`number` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`top_p` | Tipo`number` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`stop` | Tipo`string\|string[]` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`tools` | Tipo`function_tool[]` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`tools[].type` | Tipo`string` | RequisitoFacoltativo | Valori e limiti function Dipende dal modello | Predefinito— |
| Campo`tools[].function.name` | Tipo`string` | RequisitoObbligatorio | Valori e limiti Si applica quando: Funzione fornita come strumento | Predefinito— |
| Campo`tools[].function.description` | Tipo`string` | RequisitoFacoltativo | Valori e limiti | Predefinito— |
| Campo`tools[].function.parameters` | Tipo`JSON_schema` | RequisitoFacoltativo | Valori e limiti | Predefinito— |
| Campo`tool_choice` | Tipo`string\|object` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`parallel_tool_calls` | Tipo`boolean` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`response_format` | Tipo`object` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`reasoning_effort` | Tipo`string` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`reasoning` | Tipo`object` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`service_tier` | Tipo`string` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`instructions` | Tipo`string` | RequisitoFacoltativo | Valori e limiti Campo di compatibilità | Predefinito— |
| Campo`functions` | Tipo`function[]` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`function_call` | Tipo`string\|object` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`prompt_cache_options` | Tipo`object` | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
| Campo`modalities` | Tipo`string[]` | RequisitoFacoltativo | Valori e limiti text | Predefinito— |
| Campo`provider` | Tipo`object` | RequisitoFacoltativo | Valori e limiti Condizioni: provider.options viene rifiutato su questa rotta testuale Ultra | Predefinito— |
| Campo`cache_control.ttl` | Tipo`string` | RequisitoFacoltativo | Valori e limiti Condizioni: 1h viene rifiutato nelle posizioni effettive della cache dei prompt | Predefinito— |

Combinazioni di materiali in input

**Testo** · Testo UTF8

`messages[].content`

Parametri e ciclo di vita del metodo

| Parametro | Contratto |
| --- | --- |
| Parametro`content_type` | Contrattoapplication/json |
| Parametro`required` | Contrattomodel, messages |
| Parametro`material_types` | Contrattotext |
| Parametro`messages` | ContrattoArray di messaggi con struttura role/content |
| Parametro`file_material` | ContrattoDocumento UTF-8 effettivo inserito come testo letterale; nessun ID di file dedotto |
| Parametro`optional_controls` | Contrattostream, temperature, top\_p, stop, max\_tokens, max\_completion\_tokens, reasoning, response\_format, tools, tool\_choice |
| Parametro`control_scope` | ContrattoSpecifico del modello; gli strumenti di funzione dell’utente differiscono dagli strumenti ospitati |
| Parametro`output_modalities` | Contrattotext |
| Parametro`hosted_operations` | Contrattofalse |
| Parametro`multimodal_input_binding` | Contrattonull |

Ciclo di vita: `synchronous_or_streamed`

Invia l’ID esatto del modello con messages.

La lunghezza del contesto non è un limite di uscita.

Un file di testo può fornire testo letterale; gli ingressi immagine/audio/oggetto file richiedono un’associazione esatta.

### Tariffe

Le tariffe non aggiungono opzioni alla richiesta. I parametri supportati sono elencati nel metodo selezionato.

Modalità rapida

Tariffa standard Quando è selezionata la modalità rapida

Modalità flex

Tariffa standard Quando è selezionata la modalità flex

Sforzo massimo di ragionamento

Tariffa standard Quando lo sforzo massimo di ragionamento usa l'adeguamento predefinito (default)

Sforzo di ragionamento · elevato

Tariffa standard Quando lo sforzo di ragionamento è elevato

Sforzo di ragionamento · basso

Tariffa standard Quando lo sforzo di ragionamento è basso

Sforzo di ragionamento · medio

Tariffa standard Quando lo sforzo di ragionamento è medio

Sforzo di ragionamento · xhigh

Tariffa standard Quando lo sforzo di ragionamento è xhigh

#### Tariffe Ailoot

#### Prezzi per configurazione

Associa ogni costo alle condizioni indicate. Usa una sola tariffa per ogni insieme di configurazioni alternative.

| Configurazione | Listino delle tariffe | Token di contesto, più di | Token di contesto, fino al limite incluso | Costo |
| --- | --- | --- | --- | --- |
| ConfigurazioneTariffe di base dei token | Listino delle tariffeTariffa base | Token di contesto, più di— | Token di contesto, fino al limite inclusoNessun limite superiore | Costo Input · Token in input **$0.004** / 1K token Output · Token in output **$0.012** / 1K token Input · Lettura dalla cache **$0.001** / 1K token Input · Scrittura nella cache **—** / 1K token Input · Scrittura nella cache, 1 ora **—** / 1K token |
| ConfigurazioneFascia 1 di lunghezza della richiesta | Listino delle tariffe— | Token di contesto, più di0 | Token di contesto, fino al limite incluso200.000 | Costo Input · Token in input **$0.004** / 1K token Output · Token in output **$0.012** / 1K token Input · Lettura dalla cache **$0.001** / 1K token Input · Scrittura nella cache **—** / 1K token Input · Scrittura nella cache, 1 ora **—** / 1K token |
| ConfigurazioneFascia 2 di lunghezza della richiesta | Listino delle tariffe— | Token di contesto, più di200.000 | Token di contesto, fino al limite inclusoNessun limite superiore | Costo Input · Token in input **$0.008** / 1K token Output · Token in output **$0.024** / 1K token Input · Lettura dalla cache **$0.002** / 1K token Input · Scrittura nella cache **—** / 1K token Input · Scrittura nella cache, 1 ora **—** / 1K token |

Ailoot prenota un importo stimato prima di una richiesta. Dopo il risultato, addebita il costo finale in base all’utilizzo misurato. Per lo streaming, l’addebito usa il record finale di utilizzo. [Come funzionano la prenotazione e l’addebito finale →](https://ailoot.ai/docs/it/billing/reserve/)

### Esempi di richieste

#### Ailoot Ultra · OpenAI Chat

curlPython SDKStreaming Python

```bash
set -eu
: "${AILOOT_API_KEY:?Set your Ailoot API key}"
python3 - <<'PY_REQUEST'
import json,os
from pathlib import Path
p=json.loads('{"model": "x-ai/grok-4.6", "messages": [{"role": "user", "content": "Explain the difference between an observation and a hypothesis in three sentences."}]}')

Path("request.json").write_text(json.dumps(p,ensure_ascii=False))
PY_REQUEST
curl --fail-with-body --silent --show-error https://api.ailoot.ai/v1/chat/completions \
  -H "Authorization: Bearer $AILOOT_API_KEY" -H 'Content-Type: application/json' \
  --data-binary @request.json -D response-headers.txt -o result.json
python3 - <<'PY_RESULT'
import json
from pathlib import Path
r=json.loads(Path("result.json").read_text())
for x in r.get("choices",[]):
    if x.get("message",{}).get("content"): print(x["message"]["content"])
PY_RESULT
```

```python
from openai import OpenAI
import os

if not os.environ.get("AILOOT_API_KEY", "").strip(): raise SystemExit("Set AILOOT_API_KEY before making a request")
client=OpenAI(base_url="https://api.ailoot.ai/v1",api_key=os.environ["AILOOT_API_KEY"],max_retries=0)
result=client.chat.completions.create(model='x-ai/grok-4.6',messages=[{"role":"user","content":"Explain observations and hypotheses in three sentences."}])
import base64, json
from pathlib import Path

def save_result(data, stem="result"):
    # Keep every field, including usage, IDs, reasoning and tool requests.
    Path(stem + ".json").write_text(json.dumps(data, ensure_ascii=False, indent=2), encoding="utf-8")
    print(json.dumps(data, ensure_ascii=False, indent=2))
    def save_blob(encoded, suffix, label):
        raw = base64.b64decode(encoded, altchars=b"-_", validate=True)
        ext = "png" if raw.startswith(b"\x89PNG\r\n\x1a\n") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4] == b"RIFF" and raw[8:12] == b"WEBP" else suffix
        file = Path(stem + "-" + label + "." + ext)
        file.write_bytes(raw)
        print("Saved", file)
    for index, block in enumerate(data.get("content") or []):
        print("Content", index, json.dumps(block, ensure_ascii=False))
    for choice in data.get("choices") or []:
        print("Choice", choice.get("index"), json.dumps(choice.get("message", choice.get("delta", {})), ensure_ascii=False))
    for index, item in enumerate(data.get("output") or []):
        print("Output", index, json.dumps(item, ensure_ascii=False))
        if item.get("type") == "image_generation_call" and item.get("result"):
            save_blob(item["result"], item.get("output_format") or "bin", "output-" + str(index))
    for ci, candidate in enumerate(data.get("candidates") or []):
        for pi, part in enumerate((candidate.get("content") or {}).get("parts") or []):
            print("Candidate/part", ci, pi, json.dumps(part, ensure_ascii=False))
            blob = part.get("inlineData") or part.get("inline_data")
            if blob and blob.get("data"):
                mime = blob.get("mimeType") or blob.get("mime_type")
                suffix = {"image/png":"png", "image/jpeg":"jpg", "image/webp":"webp", "audio/wav":"wav", "audio/mpeg":"mp3", "video/mp4":"mp4"}.get(mime, "bin")
                save_blob(blob["data"], suffix, "candidate-" + str(ci) + "-part-" + str(pi))

save_result(result.to_dict(mode="json"))
```

```python
from openai import OpenAI
import os
from pathlib import Path

if not os.environ.get("AILOOT_API_KEY", "").strip(): raise SystemExit("Set AILOOT_API_KEY before making a request")
client=OpenAI(base_url="https://api.ailoot.ai/v1",api_key=os.environ["AILOOT_API_KEY"],max_retries=0)
import base64, json
from pathlib import Path

def save_result(data, stem="result"):
    # Keep every field, including usage, IDs, reasoning and tool requests.
    Path(stem + ".json").write_text(json.dumps(data, ensure_ascii=False, indent=2), encoding="utf-8")
    print(json.dumps(data, ensure_ascii=False, indent=2))
    def save_blob(encoded, suffix, label):
        raw = base64.b64decode(encoded, altchars=b"-_", validate=True)
        ext = "png" if raw.startswith(b"\x89PNG\r\n\x1a\n") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4] == b"RIFF" and raw[8:12] == b"WEBP" else suffix
        file = Path(stem + "-" + label + "." + ext)
        file.write_bytes(raw)
        print("Saved", file)
    for index, block in enumerate(data.get("content") or []):
        print("Content", index, json.dumps(block, ensure_ascii=False))
    for choice in data.get("choices") or []:
        print("Choice", choice.get("index"), json.dumps(choice.get("message", choice.get("delta", {})), ensure_ascii=False))
    for index, item in enumerate(data.get("output") or []):
        print("Output", index, json.dumps(item, ensure_ascii=False))
        if item.get("type") == "image_generation_call" and item.get("result"):
            save_blob(item["result"], item.get("output_format") or "bin", "output-" + str(index))
    for ci, candidate in enumerate(data.get("candidates") or []):
        for pi, part in enumerate((candidate.get("content") or {}).get("parts") or []):
            print("Candidate/part", ci, pi, json.dumps(part, ensure_ascii=False))
            blob = part.get("inlineData") or part.get("inline_data")
            if blob and blob.get("data"):
                mime = blob.get("mimeType") or blob.get("mime_type")
                suffix = {"image/png":"png", "image/jpeg":"jpg", "image/webp":"webp", "audio/wav":"wav", "audio/mpeg":"mp3", "video/mp4":"mp4"}.get(mime, "bin")
                save_blob(blob["data"], suffix, "candidate-" + str(ci) + "-part-" + str(pi))

with client.chat.completions.stream(model='x-ai/grok-4.6',messages=[{"role":"user","content":"Explain observations and hypotheses in three sentences."}]) as stream:
    with Path("stream-events.jsonl").open("w",encoding="utf-8") as log:
        for event in stream:
            payload=event.to_dict(mode="json")
            log.write(json.dumps(payload,ensure_ascii=False)+"\n"); log.flush()
            print(json.dumps(payload,ensure_ascii=False))
    final=stream.get_final_completion()
    save_result(final.to_dict(mode="json"),"stream-result")
```

### Ricevi e salva i risultati

#### Ailoot Ultra · OpenAI Chat

json o SSE

##### Conserva tutti i risultati completati

Conserva ogni risposta, file e parte di contenuto restituiti per intero.

Conserva ogni scelta con contenuto, chiamate agli strumenti e ragionamento. In SSE assembla i delta per indice di scelta e strumento e conserva il motivo finale di completamento e i dati di utilizzo.

##### Se occorre verificare la risposta originale

Conserva gli ID e le intestazioni di richiesta/risposta. Non viene fornito alcun URL generico per recuperare un’attività testuale.

Campi della risposta

| Campo | Tipo |
| --- | --- |
| Campo`choices[].index` | Tipointeger |
| Campo`choices[].message.content` | Tipostring\|null |
| Campo`choices[].message.tool_calls` | Tipotool\_call\[\] |
| Campo`choices[].message.reasoning_content` | Tipostring |
| Campo`choices[].message.reasoning_details` | Tipoobject\|array |
| Campo`choices[].finish_reason` | Tipostring\|null |
| Campo`usage` | Tipoobject |

Errori e passaggi successivi

| Risposta | Condizione | Passaggio successivo |
| --- | --- | --- |
| Risposta400 · `invalid_request_error` | CondizioneCampi obbligatori, rappresentazione del materiale o valore del parametro non validi | Passaggio successivoCorreggi i campi indicati prima di una nuova richiesta di creazione. |

### Alias

#### Alias del modello

<strong>Ailoot</strong> [`grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Core&caller=grok-4.6&fmt=chat), [`grok-4.6-latest`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Core&caller=grok-4.6-latest&fmt=chat)
**Ailoot Ultra** [`grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Ultra&caller=grok-4.6&fmt=chat), [`x-ai/grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Ultra&caller=x-ai%2Fgrok-4.6&fmt=chat)

#### Alias dei percorsi dei metodi

`/chat/completions`

#### ID di chiamata correlati

[`x-ai/grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Ultra&caller=x-ai%2Fgrok-4.6&fmt=chat), [`grok-4.6-latest`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Core&caller=grok-4.6-latest&fmt=chat), [`grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Core&caller=grok-4.6&fmt=chat), [`grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Ultra&caller=grok-4.6&fmt=chat)

**Ailoot Ultra · Anthropic Messages** `POST /v1/messages` `x-ai/grok-4.6`

[`x-ai/grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Ultra&caller=x-ai%2Fgrok-4.6&fmt=messages)

SpaceXAI /`x-ai/grok-4.6`

ID del modello

- `grok-4.6`
- `x-ai/grok-4.6`

### Introduzione

Grok 4.6 è stato creato per lavori prolungati su codice, ricerche e progetti interattivi. Riceve testo e immagini e supporta un contesto di 500 000 token e quattro livelli di ragionamento.

Input accettati

Testo

Risultati

json · sse

### Disponibile in Ailoot · input e metodi

**Ailoot Ultra · Anthropic Messages** `POST /v1/messages`

Tipi di input

`text`

Tipi di output

`json`, `sse`

Formato di output

JSON o SSE

| Campo | Tipo | Requisito | Valori e limiti | Predefinito |
| --- | --- | --- | --- | --- |
| Campo`model` | Tipo`string` | RequisitoObbligatorio | Valori e limiti x-ai/grok-4.6 | Predefinito— |
| Campo`messages` | Tipo`message[]` | RequisitoObbligatorio | Valori e limiti | Predefinito— |
| Campo`messages[].role` | Tipo`string` | RequisitoObbligatorio | Valori e limiti user, assistant | Predefinito— |
| Campo`messages[].content` | Tipo`string` | RequisitoObbligatorio | Valori e limiti | Predefinito— |
| Campo`max_tokens` | Tipo`integer` | RequisitoObbligatorio | Valori e limiti | Predefinito— |
| Campo`stream` | Tipo`boolean` | RequisitoFacoltativo | Valori e limiti | Predefinitofalse |

Combinazioni di materiali in input

**Testo** · Testo UTF-8

`Stringa messages[].content`

Parametri e ciclo di vita del metodo

| Parametro | Contratto |
| --- | --- |
| Parametro`content_type` | Contrattoapplication/json |
| Parametro`required` | Contrattomodel, messages, max\_tokens |
| Parametro`optional_controls` | Contrattostream |
| Parametro`material_types` | Contrattotext |
| Parametro`text_file_material` | ContrattoLeggi il documento UTF-8 effettivo e inserisci il testo nell’ingresso indicato o nella stringa del contenuto del messaggio. |

Ciclo di vita: `synchronous_or_streamed`

### Tariffe

Le tariffe non aggiungono opzioni alla richiesta. I parametri supportati sono elencati nel metodo selezionato.

Modalità rapida

Tariffa standard Quando è selezionata la modalità rapida

Modalità flex

Tariffa standard Quando è selezionata la modalità flex

Sforzo massimo di ragionamento

Tariffa standard Quando lo sforzo massimo di ragionamento usa l'adeguamento predefinito (default)

Sforzo di ragionamento · elevato

Tariffa standard Quando lo sforzo di ragionamento è elevato

Sforzo di ragionamento · basso

Tariffa standard Quando lo sforzo di ragionamento è basso

Sforzo di ragionamento · medio

Tariffa standard Quando lo sforzo di ragionamento è medio

Sforzo di ragionamento · xhigh

Tariffa standard Quando lo sforzo di ragionamento è xhigh

#### Tariffe Ailoot

#### Prezzi per configurazione

Associa ogni costo alle condizioni indicate. Usa una sola tariffa per ogni insieme di configurazioni alternative.

| Configurazione | Listino delle tariffe | Token di contesto, più di | Token di contesto, fino al limite incluso | Costo |
| --- | --- | --- | --- | --- |
| ConfigurazioneTariffe di base dei token | Listino delle tariffeTariffa base | Token di contesto, più di— | Token di contesto, fino al limite inclusoNessun limite superiore | Costo Input · Token in input **$0.004** / 1K token Output · Token in output **$0.012** / 1K token Input · Lettura dalla cache **$0.001** / 1K token Input · Scrittura nella cache **—** / 1K token Input · Scrittura nella cache, 1 ora **—** / 1K token |
| ConfigurazioneFascia 1 di lunghezza della richiesta | Listino delle tariffe— | Token di contesto, più di0 | Token di contesto, fino al limite incluso200.000 | Costo Input · Token in input **$0.004** / 1K token Output · Token in output **$0.012** / 1K token Input · Lettura dalla cache **$0.001** / 1K token Input · Scrittura nella cache **—** / 1K token Input · Scrittura nella cache, 1 ora **—** / 1K token |
| ConfigurazioneFascia 2 di lunghezza della richiesta | Listino delle tariffe— | Token di contesto, più di200.000 | Token di contesto, fino al limite inclusoNessun limite superiore | Costo Input · Token in input **$0.008** / 1K token Output · Token in output **$0.024** / 1K token Input · Lettura dalla cache **$0.002** / 1K token Input · Scrittura nella cache **—** / 1K token Input · Scrittura nella cache, 1 ora **—** / 1K token |

Ailoot prenota un importo stimato prima di una richiesta. Dopo il risultato, addebita il costo finale in base all’utilizzo misurato. Per lo streaming, l’addebito usa il record finale di utilizzo. [Come funzionano la prenotazione e l’addebito finale →](https://ailoot.ai/docs/it/billing/reserve/)

### Esempi di richieste

#### Ailoot Ultra · Anthropic Messages

Corpo JSON minimo completocurl · usa il tuo documento UTF-8Python · salva il risultato completo

```json
{
  "model": "x-ai/grok-4.6",
  "max_tokens": 128,
  "messages": [
    {
      "role": "user",
      "content": "Summarize the incident report."
    }
  ],
  "stream": false
}
```

```bash
set -eu
: "${AILOOT_API_KEY:?Set your Ailoot API key}"
: "${AILOOT_TEXT_FILE:?Set your actual UTF-8 document}"
export AILOOT_TEXT_FILE
python3 - <<'PY_REQUEST'
import json, os
from pathlib import Path

source_file = Path(os.environ['AILOOT_TEXT_FILE'])
if not source_file.is_file():
    raise SystemExit('Set AILOOT_TEXT_FILE to your actual UTF-8 document')
text = source_file.read_text(encoding='utf-8')
if not text.strip():
    raise SystemExit('Choose a document containing text')
payload = {'model': 'x-ai/grok-4.6', 'max_tokens': 128, 'messages': [{'role': 'user', 'content': 'Summarize the incident report.'}]}
payload['messages'][0]['content'] = 'Summarize this material and quote supporting source passages.\n\n' + text
Path('request.json').write_text(json.dumps(payload, ensure_ascii=False), encoding='utf-8')
PY_REQUEST
curl --fail-with-body --silent --show-error https://api.ailoot.ai/v1/messages \
  -H "x-api-key: $AILOOT_API_KEY" -H 'anthropic-version: 2023-06-01' -H 'Content-Type: application/json' \
  --data-binary @request.json -D response-headers.txt -o result.json
python3 - <<'PY_RESULT'
import json
from pathlib import Path

result = json.loads(Path('result.json').read_text(encoding='utf-8'))
print(json.dumps(result, ensure_ascii=False, indent=2))
PY_RESULT
```

```python
import json, os
from pathlib import Path

source_file = Path(os.environ['AILOOT_TEXT_FILE'])
if not source_file.is_file():
    raise SystemExit('Set AILOOT_TEXT_FILE to your actual UTF-8 document')
text = source_file.read_text(encoding='utf-8')
if not text.strip():
    raise SystemExit('Choose a document containing text')
payload = {'model': 'x-ai/grok-4.6', 'max_tokens': 128, 'messages': [{'role': 'user', 'content': 'Summarize the incident report.'}]}
payload['messages'][0]['content'] = 'Summarize this material and quote supporting source passages.\n\n' + text
from urllib.request import Request, urlopen
from urllib.error import HTTPError

api_key = os.environ['AILOOT_API_KEY']
if not api_key.strip():
    raise SystemExit('Set AILOOT_API_KEY before making a request')
headers = {'x-api-key': 'PLACEHOLDER_KEY', 'anthropic-version': '2023-06-01', 'Content-Type': 'application/json'}
headers['x-api-key'] = api_key
request = Request('https://api.ailoot.ai/v1/messages', data=json.dumps(payload, ensure_ascii=False).encode('utf-8'), headers=headers, method='POST')
try:
    with urlopen(request, timeout=120) as response:
        raw = response.read()
        Path('response-headers.txt').write_text(str(response.headers), encoding='utf-8')
except HTTPError as error:
    Path('result.json').write_bytes(error.read())
    Path('response-headers.txt').write_text(str(error.headers), encoding='utf-8')
    raise
Path('result.json').write_bytes(raw)
import json
from pathlib import Path

result = json.loads(Path('result.json').read_text(encoding='utf-8'))
print(json.dumps(result, ensure_ascii=False, indent=2))
```

### Ricevi e salva i risultati

#### Ailoot Ultra · Anthropic Messages

JSON o SSE

##### Conserva tutti i risultati completati

Conserva ogni risposta, file e parte di contenuto restituiti per intero.

Conserva tutti i blocchi di contenuto, le firme di ragionamento e gli ID effettivi di utilizzo degli strumenti. Assembla tutti i delta dei blocchi SSE; il primo blocco di testo non è l’uscita completa.

##### Se occorre verificare la risposta originale

Conserva gli ID e le intestazioni di richiesta/risposta. Non viene fornito alcun URL generico per recuperare un’attività testuale.

Campi della risposta

| Campo | Tipo |
| --- | --- |
| Campo`id` | Tipostring |
| Campo`model` | Tipostring |
| Campo`content[]` | Tipotext\|thinking\|tool\_use\|other content block |
| Campo`stop_reason` | Tipostring\|null |
| Campo`usage` | Tipoobject |

Errori e passaggi successivi

| Risposta | Condizione | Passaggio successivo |
| --- | --- | --- |
| Risposta400 · `invalid_request_error` | CondizioneCampi obbligatori, rappresentazione del materiale o valore del parametro non validi | Passaggio successivoCorreggi i campi indicati prima di una nuova richiesta di creazione. |

### Alias

#### Alias del modello

<strong>Ailoot</strong> [`grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Core&caller=grok-4.6&fmt=messages), [`grok-4.6-latest`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Core&caller=grok-4.6-latest&fmt=messages)
**Ailoot Ultra** [`grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Ultra&caller=grok-4.6&fmt=messages), [`x-ai/grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Ultra&caller=x-ai%2Fgrok-4.6&fmt=messages)

#### Alias dei percorsi dei metodi

`/chat/completions`

#### ID di chiamata correlati

[`x-ai/grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Ultra&caller=x-ai%2Fgrok-4.6&fmt=messages), [`grok-4.6-latest`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Core&caller=grok-4.6-latest&fmt=messages), [`grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Core&caller=grok-4.6&fmt=messages), [`grok-4.6`](https://ailoot.ai/models/it/#m=x-ai%2Fgrok-4.6&route=Ultra&caller=grok-4.6&fmt=messages)

FAQ · SpaceXAI: Grok 4.6

Quali input e risultati sono disponibili?

`POST /v1/messages` · `grok-4.6`: `text`, `image` → `text` `POST /v1/responses` · `grok-4.6`: `text`, `image` → `text` `POST /v1/chat/completions` · `grok-4.6`: `text`, `image` → `text` `POST /v1/chat/completions` · `grok-4.6`: `text` → `text` `POST /v1/messages` · `grok-4.6`: `text` → `json`, `sse` `POST /v1/messages` · `grok-4.6-latest`: `text`, `image` → `text` `POST /v1/responses` · `grok-4.6-latest`: `text`, `image` → `text` `POST /v1/chat/completions` · `grok-4.6-latest`: `text`, `image` → `text` `POST /v1/chat/completions` · `x-ai/grok-4.6`: `text` → `text` `POST /v1/messages` · `x-ai/grok-4.6`: `text` → `json`, `sse`

Quali campi usa la richiesta?

`POST /v1/messages` · `grok-4.6`: `model`, `messages`, `system`, `max_tokens`, `stream`, `metadata` `POST /v1/responses` · `grok-4.6`: `model`, `input`, `instructions`, `stream` `POST /v1/chat/completions` · `grok-4.6`: `model`, `messages`, `stream` `POST /v1/chat/completions` · `grok-4.6`: `model`, `messages`, `stream` `POST /v1/messages` · `grok-4.6`: `model`, `messages`, `max_tokens`, `stream` `POST /v1/messages` · `grok-4.6-latest`: `model`, `messages`, `system`, `max_tokens`, `stream`, `metadata` `POST /v1/responses` · `grok-4.6-latest`: `model`, `input`, `instructions`, `stream` `POST /v1/chat/completions` · `grok-4.6-latest`: `model`, `messages`, `stream` `POST /v1/chat/completions` · `x-ai/grok-4.6`: `model`, `messages`, `stream`, `modalities`, `provider` `POST /v1/messages` · `x-ai/grok-4.6`: `model`, `messages`, `max_tokens`, `stream`

Quali limiti si applicano?

`POST /v1/messages` · `grok-4.6`: `ctx`: `500000`; `max_out`: `500000`; `messages.min_items`: `1`; `max_tokens.minimum`: `1` `POST /v1/responses` · `grok-4.6`: `ctx`: `500000`; `max_out`: `500000` `POST /v1/chat/completions` · `grok-4.6`: `ctx`: `500000`; `max_out`: `500000`; `messages.min_items`: `1` `POST /v1/chat/completions` · `grok-4.6`: `messages.min_items`: `1` `POST /v1/messages` · `grok-4.6-latest`: `ctx`: `500000`; `max_out`: `500000`; `messages.min_items`: `1`; `max_tokens.minimum`: `1` `POST /v1/responses` · `grok-4.6-latest`: `ctx`: `500000`; `max_out`: `500000` `POST /v1/chat/completions` · `grok-4.6-latest`: `ctx`: `500000`; `max_out`: `500000`; `messages.min_items`: `1` `POST /v1/chat/completions` · `x-ai/grok-4.6`: `messages.min_items`: `1`

Collega Ailoot a Claude Code, OpenCode, Hermes o alla tua applicazione.

## L’azienda e il suo portafoglio di progetti

L’azienda e il suo portafoglio di progetti: milioni di clienti; vendite nell’ordine dei miliardi ogni mese.

## Acquista token con uno sconto.

Sconto con abbonamento per lavoro regolare. Codici fino al 50% sull’acquisto di token.

Abbonamento

Scegli un piano scontato per richieste regolari.

Codice fino al 50%

Inserisci il codice all’acquisto. Il prezzo si aggiorna secondo la promozione.

Spese nella cronologia

Modello, token e importo sono salvati per ogni richiesta.

[Scegli abbonamento](https://ailoot.ai/docs/it/billing/subscriptions/) · [Consulta prezzi dei modelli](https://ailoot.ai/models/it/)

## Collega l’API al prodotto che vendi.

SaaS, app e bot secondo offerta e accordo di licenza Ailoot. Per rivendere, richiedi una licenza reseller.

Applicazione commerciale

Integra generazione di testo, immagini, video e suono nelle funzioni a pagamento.

Licenza reseller

Invia descrizione del progetto e schema di accesso. Richiedi condizioni scritte per uso e rivendita.

Documenti sul sito

Offerta, accordo di licenza e politica sui dati sono disponibili prima della connessione.

[Richiedi licenza reseller](mailto:support@ailoot.ai) · [Offerta e accordo di licenza](https://ailoot.ai/legal/offer?lang=it)

## Ailoot · L’azienda e il suo portafoglio di progetti





Ailoot si basa su un’esperienza operativa consolidata, un’ampia base di clienti, un servizio stabile e un controllo costante dei KPI.





L’azienda e il suo portafoglio di progetti: milioni di clienti; vendite nell’ordine dei miliardi ogni mese.





Ailoot mette questa esperienza operativa al servizio dell’accesso API alle funzioni AI nei prodotti dei clienti, negli agenti, nelle applicazioni e nelle automazioni.
