SpaceXAI: Grok 4.5
Grok 4.5 è il modello di SpaceXAI per programmazione, lavoro intellettuale e attività STEM. Accetta testo, immagini e file per risposte testuali, con controlli di ragionamento, strumenti e output strutturati nel profilo pubblicato e una finestra di contesto di 500.000 token.
- Ailoot · Anthropic Messages
POST /v1/messagesgrok-4.5 - Ailoot · OpenAI Responses
POST /v1/responsesgrok-4.5 - Ailoot · OpenAI Chat
POST /v1/chat/completionsgrok-4.5 - Ailoot Ultra · OpenAI Chat
POST /v1/chat/completionsgrok-4.5 - Ailoot Ultra · Anthropic Messages
POST /v1/messagesgrok-4.5 - Ailoot · Anthropic Messages
POST /v1/messagesgrok-4.5-latest - Ailoot · OpenAI Responses
POST /v1/responsesgrok-4.5-latest - Ailoot · OpenAI Chat
POST /v1/chat/completionsgrok-4.5-latest - Ailoot · Anthropic Messages
POST /v1/messagesgrok-build-latest - Ailoot · OpenAI Responses
POST /v1/responsesgrok-build-latest - Ailoot · OpenAI Chat
POST /v1/chat/completionsgrok-build-latest - Ailoot Ultra · OpenAI Chat
POST /v1/chat/completionsx-ai/grok-4.5 - Ailoot Ultra · Anthropic Messages
POST /v1/messagesx-ai/grok-4.5
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.
Grok 4.5 è il modello di SpaceXAI per programmazione, lavoro intellettuale e STEM. Il profilo pubblicato accetta testo, immagini e file e restituisce testo. La finestra di contesto è di 500.000 token, permettendo di mantenere insieme il materiale di partenza correlato e il compito attuale in un unico brief di lavoro.
Programmazione e domande tecniche
Per un'attività di programmazione, fornisci l'implementazione pertinente, l'errore o il comportamento osservato e la correzione necessaria. Chiedi una modifica mirata e un modo per verificarla. Per una spiegazione STEM, indica esplicitamente quantità, ipotesi e domanda, comprese le unità usate nella fonte. Mantieni identificabili gli input di un calcolo, così che il ragionamento e il risultato possano essere verificati insieme.
Lavora da documenti ed evidenze visive
Etichetta i file, i passaggi e le immagini forniti. Un brief di lavoro intellettuale può richiedere un confronto tra documenti denominati, il riepilogo di una sezione specifica o un elenco di risultati collegati alle fonti. Una domanda visiva deve identificare l'area o l'oggetto da esaminare e il dettaglio necessario nella risposta. Conserva le informazioni mancanti o in conflitto, invece di lasciare che un riepilogo le cancelli.
Ragionamento e risultati strutturati
Il profilo di hosting pubblicato elenca controlli di ragionamento, strumenti funzione e output strutturati. Definisci i campi richiesti quando la risposta entrerà in un altro sistema, poi convalida sia la struttura sia i valori sostanziali. In un compito con strumenti, conserva l'osservazione restituita dallo strumento invece di trattare la chiamata proposta come lavoro completato.
Organizza il materiale lungo in sezioni denominate e riserva spazio alla risposta richiesta. Un artefatto finale utile collega la conclusione o la proposta di codice alle evidenze che la sostengono, mantenendo etichette delle fonti, ipotesi e passaggi di convalida pertinenti per la fase successiva.
Caso pratico
Caso pratico
Esempio tecnico in inglese
Check a power-budget decision
A portable instrument draws 12 watts for 3 hours and then 4 watts for 5 hours. Its battery stores 70 watt-hours, of which only 85 percent is usable. Calculate the required energy, compare it with usable capacity and state the minimum extra usable energy needed. Keep power and energy units distinct.Risultato atteso
A labelled energy calculation, a capacity comparison and the remaining energy shortfall or surplus.Verificare il risultato
Check that watts are multiplied by hours and that the usability factor is applied to battery capacity.Ailoot · Anthropic Messages POST /v1/messages grok-4.5
grok-4.5grok-4.5grok-4.5-latestgrok-build-latest
Introduzione
Grok 4.5 è il modello di SpaceXAI per programmazione, lavoro intellettuale e attività STEM. Accetta testo, immagini e file per risposte testuali, con controlli di ragionamento, strumenti e output strutturati nel profilo pubblicato e una finestra di contesto di 500.000 token.
- 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 |
|---|---|---|---|---|
Campomodel | Tipostring | RequisitoObbligatorio | Valori e limiti grok-4.5 | Predefinito— |
Campomessages | Tipomessage[] | RequisitoObbligatorio | Valori e limiti Numero minimo di elementi: 1 | Predefinito— |
Campomessages[].role | Tipostring | RequisitoObbligatorio | Valori e limiti user, assistant | Predefinito— |
Campomessages[].content | Tipostring|content_block[] | RequisitoObbligatorio | Valori e limiti | Predefinito— |
Camposystem | Tipostring|content_block[] | RequisitoFacoltativo | Valori e limiti | Predefinito— |
Campomax_tokens | Tipointeger | RequisitoObbligatorio | Valori e limiti Minimo: 1 Il limite si applica a: Limite esatto del modello o della scheda selezionati | Predefinito— |
Campostream | Tipoboolean | RequisitoFacoltativo | Valori e limiti | Predefinitofalse |
Campotemperature | Tiponumber | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campotop_p | Tiponumber | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campostop_sequences | Tipostring[] | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campotools | Tipotool[] | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campotools[].name | Tipostring | RequisitoFacoltativo | Valori e limiti Si applica quando: Strumento fornito | Predefinito— |
Campotools[].description | Tipostring | RequisitoFacoltativo | Valori e limiti | Predefinito— |
Campotools[].input_schema | TipoJSON_schema | RequisitoFacoltativo | Valori e limiti | Predefinito— |
Campotool_choice | Tipoobject | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campothinking.type | Tipostring | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campothinking.budget_tokens | Tipointeger | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campooutput_config.effort | Tipostring | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campometadata | Tipoobject | RequisitoFacoltativo | Valori e limiti | Predefinito— |
Campocache_control | Tipoobject | 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 |
|---|---|
Parametromaterial_types | Contrattotext, image |
Parametrorequired | Contrattomodel, messages, max_tokens |
Parametrooptional_controls | Contrattonull |
Parametrocontent_type | Contrattoapplication/json |
Parametrotext_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
POST /v1/messages- Input
- 0,002 USD / 1K
- Output
- 0,006 USD / 1K
- Lettura dalla cache
- 0,0003 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,0003 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,0006 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 →
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.0006 / 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.0006 / 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.0012 / 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.0006 / 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.0006 / 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.0012 / 1K token Input · Scrittura nella cache — / 1K token Input · Scrittura nella cache, 1 ora — / 1K token |
Esempi di richieste
Ailoot · Anthropic Messages
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.5", "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
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.5", "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
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.5",
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"))
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.5",
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);
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.5',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 |
|---|---|
Campoid | Tipostring |
Campomodel | Tipostring |
Campocontent[] | Tipotext|thinking|tool_use|other content block |
Campostop_reason | Tipostring|null |
Campousage | 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
Ailoot grok-4.5, grok-4.5-latest, grok-build-latest
Ailoot Ultra grok-4.5, x-ai/grok-4.5
Alias dei percorsi dei metodi
/chat/completions
ID di chiamata correlati
x-ai/grok-4.5, grok-4.5-latest, grok-build-latest, grok-4.5, grok-4.5
Ailoot · OpenAI Responses POST /v1/responses grok-4.5
grok-4.5grok-4.5grok-4.5-latestgrok-build-latest
Introduzione
Grok 4.5 è il modello di SpaceXAI per programmazione, lavoro intellettuale e attività STEM. Accetta testo, immagini e file per risposte testuali, con controlli di ragionamento, strumenti e output strutturati nel profilo pubblicato e una finestra di contesto di 500.000 token.
- 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 |
|---|---|---|---|---|
Campomodel | Tipostring | RequisitoObbligatorio | Valori e limiti grok-4.5 | Predefinito— |
Campoinput | Tipostring|input_item[] | RequisitoObbligatorio | Valori e limiti | Predefinito— |
Campoinstructions | Tipostring | RequisitoFacoltativo | Valori e limiti | Predefinito— |
Campoinput[].type | Tipostring | RequisitoFacoltativo | Valori e limiti message, reasoning, function_call, function_call_output | Predefinito— |
Campoinput[].content | Tipostring|content_part[] | RequisitoFacoltativo | Valori e limiti | Predefinito— |
Campoinput[].call_id | Tipostring | RequisitoFacoltativo | Valori e limiti Si applica quando: function_call_output; conserva il call_id effettivamente restituito | Predefinito— |
Campoinput[].output | Tipostring|content_part[] | RequisitoFacoltativo | Valori e limiti Si applica quando: function_call_output | Predefinito— |
Campomax_output_tokens | Tipointeger | RequisitoFacoltativo | Valori e limiti Minimo: 1 Dipende dal modello | Predefinito— |
Campostream | Tipoboolean | RequisitoFacoltativo | Valori e limiti | Predefinitofalse |
Campotemperature | Tiponumber | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campotop_p | Tiponumber | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campotools | Tipotool[] | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campotool_choice | Tipostring|object | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campoparallel_tool_calls | Tipoboolean | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Camporeasoning.effort | Tipostring | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Camporeasoning.summary | Tipostring | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campotext.format | Tipoobject | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campotext.verbosity | Tipostring | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campoinclude | Tipostring[] | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campostore | Tipoboolean | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campoprevious_response_id | Tipostring | RequisitoFacoltativo | Valori e limiti Requisito dell’ID: Solo un ID di risposta effettivo proveniente da una continuazione supportata Dipende dal modello | Predefinito— |
Camposervice_tier | Tipostring | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campoprompt_cache_key | Tipostring | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campoprompt_cache_options | Tipoobject | 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 |
|---|---|
Parametromaterial_types | Contrattotext, image |
Parametrorequired | Contrattomodel, input |
Parametrooptional_controls | Contrattonull |
Parametrocontent_type | Contrattoapplication/json |
Parametrotext_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
POST /v1/responses- Input
- 0,002 USD / 1K
- Output
- 0,006 USD / 1K
- Lettura dalla cache
- 0,0003 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,0003 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,0006 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 →
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.0006 / 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.0006 / 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.0012 / 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.0006 / 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.0006 / 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.0012 / 1K token Input · Scrittura nella cache — / 1K token Input · Scrittura nella cache, 1 ora — / 1K token |
Esempi di richieste
Ailoot · OpenAI Responses
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.5", "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
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.5", "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
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.5", 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"))
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.5", 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);
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.5", 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 |
|---|---|
Campoid | Tipostring |
Campostatus | Tipostring |
Campooutput[] | Tipomessage|reasoning|function_call|other item |
Campooutput[].content[] | Tipocontent part |
Campousage | 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
Ailoot grok-4.5, grok-4.5-latest, grok-build-latest
Ailoot Ultra grok-4.5, x-ai/grok-4.5
Alias dei percorsi dei metodi
/chat/completions
ID di chiamata correlati
x-ai/grok-4.5, grok-4.5-latest, grok-build-latest, grok-4.5, grok-4.5
Ailoot · OpenAI Chat POST /v1/chat/completions grok-4.5
grok-4.5grok-4.5grok-4.5-latestgrok-build-latest
Introduzione
Grok 4.5 è il modello di SpaceXAI per programmazione, lavoro intellettuale e attività STEM. Accetta testo, immagini e file per risposte testuali, con controlli di ragionamento, strumenti e output strutturati nel profilo pubblicato e una finestra di contesto di 500.000 token.
- 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 |
|---|---|---|---|---|
Campomodel | Tipostring | RequisitoObbligatorio | Valori e limiti grok-4.5 | Predefinito— |
Campomessages | Tipomessage[] | RequisitoObbligatorio | Valori e limiti Numero minimo di elementi: 1 | Predefinito— |
Campomessages[].role | Tipostring | 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— |
Campomessages[].content | Tipostring|content_part[]|null | RequisitoFacoltativo | Valori e limiti | Predefinito— |
Campomessages[].tool_calls | Tipotool_call[] | RequisitoFacoltativo | Valori e limiti | Predefinito— |
Campomessages[].tool_call_id | Tipostring | RequisitoFacoltativo | Valori e limiti Si applica quando: role=tool; usa l’ID effettivamente restituito | Predefinito— |
Campomessages[].name | Tipostring | RequisitoFacoltativo | Valori e limiti | Predefinito— |
Campomessages[].reasoning_content | Tipostring | RequisitoFacoltativo | Valori e limiti Si applica quando: Reinserisci il ragionamento effettivamente restituito quando il modello lo utilizza | Predefinito— |
Campomessages[].reasoning_details | Tipoobject|array | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campomax_tokens | Tipointeger | RequisitoFacoltativo | Valori e limiti Minimo: 1 Dipende dal modello | Predefinito— |
Campomax_completion_tokens | Tipointeger | RequisitoFacoltativo | Valori e limiti Minimo: 1 Dipende dal modello | Predefinito— |
Campostream | Tipoboolean | RequisitoFacoltativo | Valori e limiti | Predefinitofalse |
Campostream_options.include_usage | Tipoboolean | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campotemperature | Tiponumber | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campotop_p | Tiponumber | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campostop | Tipostring|string[] | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campotools | Tipofunction_tool[] | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campotools[].type | Tipostring | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campotools[].function.name | Tipostring | RequisitoObbligatorio | Valori e limiti Si applica quando: Funzione fornita come strumento | Predefinito— |
Campotools[].function.description | Tipostring | RequisitoFacoltativo | Valori e limiti | Predefinito— |
Campotools[].function.parameters | TipoJSON_schema | RequisitoFacoltativo | Valori e limiti | Predefinito— |
Campotool_choice | Tipostring|object | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campoparallel_tool_calls | Tipoboolean | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Camporesponse_format | Tipoobject | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Camporeasoning_effort | Tipostring | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Camporeasoning | Tipoobject | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Camposervice_tier | Tipostring | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campoinstructions | Tipostring | RequisitoFacoltativo | Valori e limiti Campo di compatibilità | Predefinito— |
Campofunctions | Tipofunction[] | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campofunction_call | Tipostring|object | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campoprompt_cache_options | Tipoobject | 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 |
|---|---|
Parametromaterial_types | Contrattotext, image |
Parametrorequired | Contrattomodel, messages |
Parametrooptional_controls | Contrattonull |
Parametrocontent_type | Contrattoapplication/json |
Parametrotext_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
POST /v1/chat/completions- Input
- 0,002 USD / 1K
- Output
- 0,006 USD / 1K
- Lettura dalla cache
- 0,0003 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,0003 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,0006 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 →
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.0006 / 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.0006 / 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.0012 / 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.0006 / 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.0006 / 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.0012 / 1K token Input · Scrittura nella cache — / 1K token Input · Scrittura nella cache, 1 ora — / 1K token |
Esempi di richieste
Ailoot · OpenAI Chat
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.5", "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
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.5", "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
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.5",
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"))
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.5",
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);
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.5',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 |
|---|---|
Campochoices[].index | Tipointeger |
Campochoices[].message.content | Tipostring|null |
Campochoices[].message.tool_calls | Tipotool_call[] |
Campochoices[].message.reasoning_content | Tipostring |
Campochoices[].message.reasoning_details | Tipoobject|array |
Campochoices[].finish_reason | Tipostring|null |
Campousage | 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
Ailoot grok-4.5, grok-4.5-latest, grok-build-latest
Ailoot Ultra grok-4.5, x-ai/grok-4.5
Alias dei percorsi dei metodi
/chat/completions
ID di chiamata correlati
x-ai/grok-4.5, grok-4.5-latest, grok-build-latest, grok-4.5, grok-4.5
Ailoot Ultra · OpenAI Chat POST /v1/chat/completions grok-4.5
grok-4.5grok-4.5x-ai/grok-4.5
Introduzione
Grok 4.5 è il modello di SpaceXAI per programmazione, lavoro intellettuale e attività STEM. Accetta testo, immagini e file per risposte testuali, con controlli di ragionamento, strumenti e output strutturati nel profilo pubblicato e una finestra di contesto di 500.000 token.
- 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 |
|---|---|---|---|---|
Campomodel | Tipostring | RequisitoObbligatorio | Valori e limiti grok-4.5 | Predefinito— |
Campomessages | Tipomessage[] | RequisitoObbligatorio | Valori e limiti Numero minimo di elementi: 1 | Predefinito— |
Campomessages[].role | Tipostring | RequisitoObbligatorio | Valori e limiti Dipende dal modello | Predefinito— |
Campomessages[].content | Tipostring | RequisitoFacoltativo | Valori e limiti Si applica quando: Conversazione testuale | Predefinito— |
Campostream | Tipoboolean | RequisitoFacoltativo | Valori e limiti | Predefinitofalse |
Combinazioni di materiali in input
Testo · Testo UTF8
messages[].content
Parametri e ciclo di vita del metodo
| Parametro | Contratto |
|---|---|
Parametrocontent_type | Contrattoapplication/json |
Parametrorequired | Contrattomodel, messages |
Parametromaterial_types | Contrattotext |
Parametromessages | ContrattoArray di messaggi con struttura role/content |
Parametrofile_material | ContrattoDocumento UTF-8 effettivo inserito come testo letterale; nessun ID di file dedotto |
Parametrooptional_controls | Contrattostream |
Parametrocontrol_scope | ContrattoConversazione testuale; stream è un booleano e per impostazione predefinita vale false. |
Parametrooutput_modalities | Contrattotext |
Parametrohosted_operations | Contrattofalse |
Parametromultimodal_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
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.0006 / 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.0006 / 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.0012 / 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 →
Esempi di richieste
Ailoot Ultra · OpenAI Chat
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.5","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
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.5", 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 |
|---|---|
Campochoices[].index | Tipointeger |
Campochoices[].message.content | Tipostring|null |
Campochoices[].message.tool_calls | Tipotool_call[] |
Campochoices[].message.reasoning_content | Tipostring |
Campochoices[].message.reasoning_details | Tipoobject|array |
Campochoices[].finish_reason | Tipostring|null |
Campousage | 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
Ailoot grok-4.5, grok-4.5-latest, grok-build-latest
Ailoot Ultra grok-4.5, x-ai/grok-4.5
Alias dei percorsi dei metodi
/chat/completions
ID di chiamata correlati
x-ai/grok-4.5, grok-4.5-latest, grok-build-latest, grok-4.5, grok-4.5
Ailoot Ultra · Anthropic Messages POST /v1/messages grok-4.5
grok-4.5grok-4.5x-ai/grok-4.5
Introduzione
Grok 4.5 è il modello di SpaceXAI per programmazione, lavoro intellettuale e attività STEM. Accetta testo, immagini e file per risposte testuali, con controlli di ragionamento, strumenti e output strutturati nel profilo pubblicato e una finestra di contesto di 500.000 token.
- 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 |
|---|---|---|---|---|
Campomodel | Tipostring | RequisitoObbligatorio | Valori e limiti grok-4.5 | Predefinito— |
Campomessages | Tipomessage[] | RequisitoObbligatorio | Valori e limiti | Predefinito— |
Campomessages[].role | Tipostring | RequisitoObbligatorio | Valori e limiti user, assistant | Predefinito— |
Campomessages[].content | Tipostring | RequisitoObbligatorio | Valori e limiti | Predefinito— |
Campomax_tokens | Tipointeger | RequisitoObbligatorio | Valori e limiti | Predefinito— |
Campostream | Tipoboolean | 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 |
|---|---|
Parametrocontent_type | Contrattoapplication/json |
Parametrorequired | Contrattomodel, messages, max_tokens |
Parametrooptional_controls | Contrattostream |
Parametromaterial_types | Contrattotext |
Parametrotext_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
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.0006 / 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.0006 / 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.0012 / 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 →
Esempi di richieste
Ailoot Ultra · Anthropic Messages
{
"model": "grok-4.5",
"max_tokens": 128,
"messages": [
{
"role": "user",
"content": "Summarize the incident report."
}
],
"stream": false
}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.5', '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
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.5', '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 |
|---|---|
Campoid | Tipostring |
Campomodel | Tipostring |
Campocontent[] | Tipotext|thinking|tool_use|other content block |
Campostop_reason | Tipostring|null |
Campousage | 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
Ailoot grok-4.5, grok-4.5-latest, grok-build-latest
Ailoot Ultra grok-4.5, x-ai/grok-4.5
Alias dei percorsi dei metodi
/chat/completions
ID di chiamata correlati
x-ai/grok-4.5, grok-4.5-latest, grok-build-latest, grok-4.5, grok-4.5
Ailoot · Anthropic Messages POST /v1/messages grok-4.5-latest
grok-4.5-latestgrok-4.5grok-4.5-latestgrok-build-latest
Introduzione
Grok 4.5 è il modello di SpaceXAI per programmazione, lavoro intellettuale e attività STEM. Accetta testo, immagini e file per risposte testuali, con controlli di ragionamento, strumenti e output strutturati nel profilo pubblicato e una finestra di contesto di 500.000 token.
- 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 |
|---|---|---|---|---|
Campomodel | Tipostring | RequisitoObbligatorio | Valori e limiti grok-4.5-latest | Predefinito— |
Campomessages | Tipomessage[] | RequisitoObbligatorio | Valori e limiti Numero minimo di elementi: 1 | Predefinito— |
Campomessages[].role | Tipostring | RequisitoObbligatorio | Valori e limiti user, assistant | Predefinito— |
Campomessages[].content | Tipostring|content_block[] | RequisitoObbligatorio | Valori e limiti | Predefinito— |
Camposystem | Tipostring|content_block[] | RequisitoFacoltativo | Valori e limiti | Predefinito— |
Campomax_tokens | Tipointeger | RequisitoObbligatorio | Valori e limiti Minimo: 1 Il limite si applica a: Limite esatto del modello o della scheda selezionati | Predefinito— |
Campostream | Tipoboolean | RequisitoFacoltativo | Valori e limiti | Predefinitofalse |
Campotemperature | Tiponumber | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campotop_p | Tiponumber | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campostop_sequences | Tipostring[] | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campotools | Tipotool[] | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campotools[].name | Tipostring | RequisitoFacoltativo | Valori e limiti Si applica quando: Strumento fornito | Predefinito— |
Campotools[].description | Tipostring | RequisitoFacoltativo | Valori e limiti | Predefinito— |
Campotools[].input_schema | TipoJSON_schema | RequisitoFacoltativo | Valori e limiti | Predefinito— |
Campotool_choice | Tipoobject | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campothinking.type | Tipostring | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campothinking.budget_tokens | Tipointeger | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campooutput_config.effort | Tipostring | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campometadata | Tipoobject | RequisitoFacoltativo | Valori e limiti | Predefinito— |
Campocache_control | Tipoobject | 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 |
|---|---|
Parametromaterial_types | Contrattotext, image |
Parametrorequired | Contrattomodel, messages, max_tokens |
Parametrooptional_controls | Contrattonull |
Parametrocontent_type | Contrattoapplication/json |
Parametrotext_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
POST /v1/messages- Input
- 0,002 USD / 1K
- Output
- 0,006 USD / 1K
- Lettura dalla cache
- 0,0003 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,0003 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,0006 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 →
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.0006 / 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.0006 / 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.0012 / 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.0006 / 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.0006 / 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.0012 / 1K token Input · Scrittura nella cache — / 1K token Input · Scrittura nella cache, 1 ora — / 1K token |
Esempi di richieste
Ailoot · Anthropic Messages
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.5-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
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.5-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
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.5-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"))
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.5-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);
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.5-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 |
|---|---|
Campoid | Tipostring |
Campomodel | Tipostring |
Campocontent[] | Tipotext|thinking|tool_use|other content block |
Campostop_reason | Tipostring|null |
Campousage | 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
Ailoot grok-4.5, grok-4.5-latest, grok-build-latest
Ailoot Ultra grok-4.5, x-ai/grok-4.5
Alias dei percorsi dei metodi
/chat/completions
ID di chiamata correlati
x-ai/grok-4.5, grok-4.5-latest, grok-build-latest, grok-4.5, grok-4.5
Ailoot · OpenAI Responses POST /v1/responses grok-4.5-latest
grok-4.5-latestgrok-4.5grok-4.5-latestgrok-build-latest
Introduzione
Grok 4.5 è il modello di SpaceXAI per programmazione, lavoro intellettuale e attività STEM. Accetta testo, immagini e file per risposte testuali, con controlli di ragionamento, strumenti e output strutturati nel profilo pubblicato e una finestra di contesto di 500.000 token.
- 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 |
|---|---|---|---|---|
Campomodel | Tipostring | RequisitoObbligatorio | Valori e limiti grok-4.5-latest | Predefinito— |
Campoinput | Tipostring|input_item[] | RequisitoObbligatorio | Valori e limiti | Predefinito— |
Campoinstructions | Tipostring | RequisitoFacoltativo | Valori e limiti | Predefinito— |
Campoinput[].type | Tipostring | RequisitoFacoltativo | Valori e limiti message, reasoning, function_call, function_call_output | Predefinito— |
Campoinput[].content | Tipostring|content_part[] | RequisitoFacoltativo | Valori e limiti | Predefinito— |
Campoinput[].call_id | Tipostring | RequisitoFacoltativo | Valori e limiti Si applica quando: function_call_output; conserva il call_id effettivamente restituito | Predefinito— |
Campoinput[].output | Tipostring|content_part[] | RequisitoFacoltativo | Valori e limiti Si applica quando: function_call_output | Predefinito— |
Campomax_output_tokens | Tipointeger | RequisitoFacoltativo | Valori e limiti Minimo: 1 Dipende dal modello | Predefinito— |
Campostream | Tipoboolean | RequisitoFacoltativo | Valori e limiti | Predefinitofalse |
Campotemperature | Tiponumber | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campotop_p | Tiponumber | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campotools | Tipotool[] | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campotool_choice | Tipostring|object | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campoparallel_tool_calls | Tipoboolean | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Camporeasoning.effort | Tipostring | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Camporeasoning.summary | Tipostring | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campotext.format | Tipoobject | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campotext.verbosity | Tipostring | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campoinclude | Tipostring[] | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campostore | Tipoboolean | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campoprevious_response_id | Tipostring | RequisitoFacoltativo | Valori e limiti Requisito dell’ID: Solo un ID di risposta effettivo proveniente da una continuazione supportata Dipende dal modello | Predefinito— |
Camposervice_tier | Tipostring | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campoprompt_cache_key | Tipostring | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campoprompt_cache_options | Tipoobject | 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 |
|---|---|
Parametromaterial_types | Contrattotext, image |
Parametrorequired | Contrattomodel, input |
Parametrooptional_controls | Contrattonull |
Parametrocontent_type | Contrattoapplication/json |
Parametrotext_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
POST /v1/responses- Input
- 0,002 USD / 1K
- Output
- 0,006 USD / 1K
- Lettura dalla cache
- 0,0003 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,0003 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,0006 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 →
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.0006 / 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.0006 / 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.0012 / 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.0006 / 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.0006 / 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.0012 / 1K token Input · Scrittura nella cache — / 1K token Input · Scrittura nella cache, 1 ora — / 1K token |
Esempi di richieste
Ailoot · OpenAI Responses
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.5-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
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.5-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
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.5-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"))
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.5-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);
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.5-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 |
|---|---|
Campoid | Tipostring |
Campostatus | Tipostring |
Campooutput[] | Tipomessage|reasoning|function_call|other item |
Campooutput[].content[] | Tipocontent part |
Campousage | 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
Ailoot grok-4.5, grok-4.5-latest, grok-build-latest
Ailoot Ultra grok-4.5, x-ai/grok-4.5
Alias dei percorsi dei metodi
/chat/completions
ID di chiamata correlati
x-ai/grok-4.5, grok-4.5-latest, grok-build-latest, grok-4.5, grok-4.5
Ailoot · OpenAI Chat POST /v1/chat/completions grok-4.5-latest
grok-4.5-latestgrok-4.5grok-4.5-latestgrok-build-latest
Introduzione
Grok 4.5 è il modello di SpaceXAI per programmazione, lavoro intellettuale e attività STEM. Accetta testo, immagini e file per risposte testuali, con controlli di ragionamento, strumenti e output strutturati nel profilo pubblicato e una finestra di contesto di 500.000 token.
- 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 |
|---|---|---|---|---|
Campomodel | Tipostring | RequisitoObbligatorio | Valori e limiti grok-4.5-latest | Predefinito— |
Campomessages | Tipomessage[] | RequisitoObbligatorio | Valori e limiti Numero minimo di elementi: 1 | Predefinito— |
Campomessages[].role | Tipostring | 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— |
Campomessages[].content | Tipostring|content_part[]|null | RequisitoFacoltativo | Valori e limiti | Predefinito— |
Campomessages[].tool_calls | Tipotool_call[] | RequisitoFacoltativo | Valori e limiti | Predefinito— |
Campomessages[].tool_call_id | Tipostring | RequisitoFacoltativo | Valori e limiti Si applica quando: role=tool; usa l’ID effettivamente restituito | Predefinito— |
Campomessages[].name | Tipostring | RequisitoFacoltativo | Valori e limiti | Predefinito— |
Campomessages[].reasoning_content | Tipostring | RequisitoFacoltativo | Valori e limiti Si applica quando: Reinserisci il ragionamento effettivamente restituito quando il modello lo utilizza | Predefinito— |
Campomessages[].reasoning_details | Tipoobject|array | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campomax_tokens | Tipointeger | RequisitoFacoltativo | Valori e limiti Minimo: 1 Dipende dal modello | Predefinito— |
Campomax_completion_tokens | Tipointeger | RequisitoFacoltativo | Valori e limiti Minimo: 1 Dipende dal modello | Predefinito— |
Campostream | Tipoboolean | RequisitoFacoltativo | Valori e limiti | Predefinitofalse |
Campostream_options.include_usage | Tipoboolean | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campotemperature | Tiponumber | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campotop_p | Tiponumber | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campostop | Tipostring|string[] | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campotools | Tipofunction_tool[] | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campotools[].type | Tipostring | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campotools[].function.name | Tipostring | RequisitoObbligatorio | Valori e limiti Si applica quando: Funzione fornita come strumento | Predefinito— |
Campotools[].function.description | Tipostring | RequisitoFacoltativo | Valori e limiti | Predefinito— |
Campotools[].function.parameters | TipoJSON_schema | RequisitoFacoltativo | Valori e limiti | Predefinito— |
Campotool_choice | Tipostring|object | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campoparallel_tool_calls | Tipoboolean | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Camporesponse_format | Tipoobject | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Camporeasoning_effort | Tipostring | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Camporeasoning | Tipoobject | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Camposervice_tier | Tipostring | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campoinstructions | Tipostring | RequisitoFacoltativo | Valori e limiti Campo di compatibilità | Predefinito— |
Campofunctions | Tipofunction[] | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campofunction_call | Tipostring|object | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campoprompt_cache_options | Tipoobject | 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 |
|---|---|
Parametromaterial_types | Contrattotext, image |
Parametrorequired | Contrattomodel, messages |
Parametrooptional_controls | Contrattonull |
Parametrocontent_type | Contrattoapplication/json |
Parametrotext_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
POST /v1/chat/completions- Input
- 0,002 USD / 1K
- Output
- 0,006 USD / 1K
- Lettura dalla cache
- 0,0003 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,0003 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,0006 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 →
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.0006 / 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.0006 / 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.0012 / 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.0006 / 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.0006 / 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.0012 / 1K token Input · Scrittura nella cache — / 1K token Input · Scrittura nella cache, 1 ora — / 1K token |
Esempi di richieste
Ailoot · OpenAI Chat
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.5-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
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.5-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
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.5-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"))
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.5-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);
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.5-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 |
|---|---|
Campochoices[].index | Tipointeger |
Campochoices[].message.content | Tipostring|null |
Campochoices[].message.tool_calls | Tipotool_call[] |
Campochoices[].message.reasoning_content | Tipostring |
Campochoices[].message.reasoning_details | Tipoobject|array |
Campochoices[].finish_reason | Tipostring|null |
Campousage | 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
Ailoot grok-4.5, grok-4.5-latest, grok-build-latest
Ailoot Ultra grok-4.5, x-ai/grok-4.5
Alias dei percorsi dei metodi
/chat/completions
ID di chiamata correlati
x-ai/grok-4.5, grok-4.5-latest, grok-build-latest, grok-4.5, grok-4.5
Ailoot · Anthropic Messages POST /v1/messages grok-build-latest
grok-build-latestgrok-4.5grok-4.5-latestgrok-build-latest
Introduzione
Grok 4.5 è il modello di SpaceXAI per programmazione, lavoro intellettuale e attività STEM. Accetta testo, immagini e file per risposte testuali, con controlli di ragionamento, strumenti e output strutturati nel profilo pubblicato e una finestra di contesto di 500.000 token.
- 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 |
|---|---|---|---|---|
Campomodel | Tipostring | RequisitoObbligatorio | Valori e limiti grok-build-latest | Predefinito— |
Campomessages | Tipomessage[] | RequisitoObbligatorio | Valori e limiti Numero minimo di elementi: 1 | Predefinito— |
Campomessages[].role | Tipostring | RequisitoObbligatorio | Valori e limiti user, assistant | Predefinito— |
Campomessages[].content | Tipostring|content_block[] | RequisitoObbligatorio | Valori e limiti | Predefinito— |
Camposystem | Tipostring|content_block[] | RequisitoFacoltativo | Valori e limiti | Predefinito— |
Campomax_tokens | Tipointeger | RequisitoObbligatorio | Valori e limiti Minimo: 1 Il limite si applica a: Limite esatto del modello o della scheda selezionati | Predefinito— |
Campostream | Tipoboolean | RequisitoFacoltativo | Valori e limiti | Predefinitofalse |
Campotemperature | Tiponumber | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campotop_p | Tiponumber | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campostop_sequences | Tipostring[] | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campotools | Tipotool[] | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campotools[].name | Tipostring | RequisitoFacoltativo | Valori e limiti Si applica quando: Strumento fornito | Predefinito— |
Campotools[].description | Tipostring | RequisitoFacoltativo | Valori e limiti | Predefinito— |
Campotools[].input_schema | TipoJSON_schema | RequisitoFacoltativo | Valori e limiti | Predefinito— |
Campotool_choice | Tipoobject | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campothinking.type | Tipostring | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campothinking.budget_tokens | Tipointeger | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campooutput_config.effort | Tipostring | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campometadata | Tipoobject | RequisitoFacoltativo | Valori e limiti | Predefinito— |
Campocache_control | Tipoobject | 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 |
|---|---|
Parametromaterial_types | Contrattotext, image |
Parametrorequired | Contrattomodel, messages, max_tokens |
Parametrooptional_controls | Contrattonull |
Parametrocontent_type | Contrattoapplication/json |
Parametrotext_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
POST /v1/messages- Input
- 0,002 USD / 1K
- Output
- 0,006 USD / 1K
- Lettura dalla cache
- 0,0003 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,0003 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,0006 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 →
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.0006 / 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.0006 / 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.0012 / 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.0006 / 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.0006 / 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.0012 / 1K token Input · Scrittura nella cache — / 1K token Input · Scrittura nella cache, 1 ora — / 1K token |
Esempi di richieste
Ailoot · Anthropic Messages
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-build-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
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-build-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
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-build-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"))
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-build-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);
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-build-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 |
|---|---|
Campoid | Tipostring |
Campomodel | Tipostring |
Campocontent[] | Tipotext|thinking|tool_use|other content block |
Campostop_reason | Tipostring|null |
Campousage | 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
Ailoot grok-4.5, grok-4.5-latest, grok-build-latest
Ailoot Ultra grok-4.5, x-ai/grok-4.5
Alias dei percorsi dei metodi
/chat/completions
ID di chiamata correlati
x-ai/grok-4.5, grok-4.5-latest, grok-build-latest, grok-4.5, grok-4.5
Ailoot · OpenAI Responses POST /v1/responses grok-build-latest
grok-build-latestgrok-4.5grok-4.5-latestgrok-build-latest
Introduzione
Grok 4.5 è il modello di SpaceXAI per programmazione, lavoro intellettuale e attività STEM. Accetta testo, immagini e file per risposte testuali, con controlli di ragionamento, strumenti e output strutturati nel profilo pubblicato e una finestra di contesto di 500.000 token.
- 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 |
|---|---|---|---|---|
Campomodel | Tipostring | RequisitoObbligatorio | Valori e limiti grok-build-latest | Predefinito— |
Campoinput | Tipostring|input_item[] | RequisitoObbligatorio | Valori e limiti | Predefinito— |
Campoinstructions | Tipostring | RequisitoFacoltativo | Valori e limiti | Predefinito— |
Campoinput[].type | Tipostring | RequisitoFacoltativo | Valori e limiti message, reasoning, function_call, function_call_output | Predefinito— |
Campoinput[].content | Tipostring|content_part[] | RequisitoFacoltativo | Valori e limiti | Predefinito— |
Campoinput[].call_id | Tipostring | RequisitoFacoltativo | Valori e limiti Si applica quando: function_call_output; conserva il call_id effettivamente restituito | Predefinito— |
Campoinput[].output | Tipostring|content_part[] | RequisitoFacoltativo | Valori e limiti Si applica quando: function_call_output | Predefinito— |
Campomax_output_tokens | Tipointeger | RequisitoFacoltativo | Valori e limiti Minimo: 1 Dipende dal modello | Predefinito— |
Campostream | Tipoboolean | RequisitoFacoltativo | Valori e limiti | Predefinitofalse |
Campotemperature | Tiponumber | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campotop_p | Tiponumber | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campotools | Tipotool[] | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campotool_choice | Tipostring|object | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campoparallel_tool_calls | Tipoboolean | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Camporeasoning.effort | Tipostring | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Camporeasoning.summary | Tipostring | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campotext.format | Tipoobject | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campotext.verbosity | Tipostring | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campoinclude | Tipostring[] | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campostore | Tipoboolean | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campoprevious_response_id | Tipostring | RequisitoFacoltativo | Valori e limiti Requisito dell’ID: Solo un ID di risposta effettivo proveniente da una continuazione supportata Dipende dal modello | Predefinito— |
Camposervice_tier | Tipostring | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campoprompt_cache_key | Tipostring | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campoprompt_cache_options | Tipoobject | 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 |
|---|---|
Parametromaterial_types | Contrattotext, image |
Parametrorequired | Contrattomodel, input |
Parametrooptional_controls | Contrattonull |
Parametrocontent_type | Contrattoapplication/json |
Parametrotext_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
POST /v1/responses- Input
- 0,002 USD / 1K
- Output
- 0,006 USD / 1K
- Lettura dalla cache
- 0,0003 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,0003 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,0006 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 →
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.0006 / 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.0006 / 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.0012 / 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.0006 / 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.0006 / 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.0012 / 1K token Input · Scrittura nella cache — / 1K token Input · Scrittura nella cache, 1 ora — / 1K token |
Esempi di richieste
Ailoot · OpenAI Responses
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-build-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
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-build-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
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-build-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"))
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-build-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);
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-build-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 |
|---|---|
Campoid | Tipostring |
Campostatus | Tipostring |
Campooutput[] | Tipomessage|reasoning|function_call|other item |
Campooutput[].content[] | Tipocontent part |
Campousage | 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
Ailoot grok-4.5, grok-4.5-latest, grok-build-latest
Ailoot Ultra grok-4.5, x-ai/grok-4.5
Alias dei percorsi dei metodi
/chat/completions
ID di chiamata correlati
x-ai/grok-4.5, grok-4.5-latest, grok-build-latest, grok-4.5, grok-4.5
Ailoot · OpenAI Chat POST /v1/chat/completions grok-build-latest
grok-build-latestgrok-4.5grok-4.5-latestgrok-build-latest
Introduzione
Grok 4.5 è il modello di SpaceXAI per programmazione, lavoro intellettuale e attività STEM. Accetta testo, immagini e file per risposte testuali, con controlli di ragionamento, strumenti e output strutturati nel profilo pubblicato e una finestra di contesto di 500.000 token.
- 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 |
|---|---|---|---|---|
Campomodel | Tipostring | RequisitoObbligatorio | Valori e limiti grok-build-latest | Predefinito— |
Campomessages | Tipomessage[] | RequisitoObbligatorio | Valori e limiti Numero minimo di elementi: 1 | Predefinito— |
Campomessages[].role | Tipostring | 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— |
Campomessages[].content | Tipostring|content_part[]|null | RequisitoFacoltativo | Valori e limiti | Predefinito— |
Campomessages[].tool_calls | Tipotool_call[] | RequisitoFacoltativo | Valori e limiti | Predefinito— |
Campomessages[].tool_call_id | Tipostring | RequisitoFacoltativo | Valori e limiti Si applica quando: role=tool; usa l’ID effettivamente restituito | Predefinito— |
Campomessages[].name | Tipostring | RequisitoFacoltativo | Valori e limiti | Predefinito— |
Campomessages[].reasoning_content | Tipostring | RequisitoFacoltativo | Valori e limiti Si applica quando: Reinserisci il ragionamento effettivamente restituito quando il modello lo utilizza | Predefinito— |
Campomessages[].reasoning_details | Tipoobject|array | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campomax_tokens | Tipointeger | RequisitoFacoltativo | Valori e limiti Minimo: 1 Dipende dal modello | Predefinito— |
Campomax_completion_tokens | Tipointeger | RequisitoFacoltativo | Valori e limiti Minimo: 1 Dipende dal modello | Predefinito— |
Campostream | Tipoboolean | RequisitoFacoltativo | Valori e limiti | Predefinitofalse |
Campostream_options.include_usage | Tipoboolean | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campotemperature | Tiponumber | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campotop_p | Tiponumber | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campostop | Tipostring|string[] | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campotools | Tipofunction_tool[] | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campotools[].type | Tipostring | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campotools[].function.name | Tipostring | RequisitoObbligatorio | Valori e limiti Si applica quando: Funzione fornita come strumento | Predefinito— |
Campotools[].function.description | Tipostring | RequisitoFacoltativo | Valori e limiti | Predefinito— |
Campotools[].function.parameters | TipoJSON_schema | RequisitoFacoltativo | Valori e limiti | Predefinito— |
Campotool_choice | Tipostring|object | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campoparallel_tool_calls | Tipoboolean | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Camporesponse_format | Tipoobject | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Camporeasoning_effort | Tipostring | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Camporeasoning | Tipoobject | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Camposervice_tier | Tipostring | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campoinstructions | Tipostring | RequisitoFacoltativo | Valori e limiti Campo di compatibilità | Predefinito— |
Campofunctions | Tipofunction[] | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campofunction_call | Tipostring|object | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campoprompt_cache_options | Tipoobject | 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 |
|---|---|
Parametromaterial_types | Contrattotext, image |
Parametrorequired | Contrattomodel, messages |
Parametrooptional_controls | Contrattonull |
Parametrocontent_type | Contrattoapplication/json |
Parametrotext_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
POST /v1/chat/completions- Input
- 0,002 USD / 1K
- Output
- 0,006 USD / 1K
- Lettura dalla cache
- 0,0003 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,0003 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,0006 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 →
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.0006 / 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.0006 / 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.0012 / 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.0006 / 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.0006 / 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.0012 / 1K token Input · Scrittura nella cache — / 1K token Input · Scrittura nella cache, 1 ora — / 1K token |
Esempi di richieste
Ailoot · OpenAI Chat
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-build-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
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-build-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
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-build-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"))
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-build-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);
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-build-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 |
|---|---|
Campochoices[].index | Tipointeger |
Campochoices[].message.content | Tipostring|null |
Campochoices[].message.tool_calls | Tipotool_call[] |
Campochoices[].message.reasoning_content | Tipostring |
Campochoices[].message.reasoning_details | Tipoobject|array |
Campochoices[].finish_reason | Tipostring|null |
Campousage | 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
Ailoot grok-4.5, grok-4.5-latest, grok-build-latest
Ailoot Ultra grok-4.5, x-ai/grok-4.5
Alias dei percorsi dei metodi
/chat/completions
ID di chiamata correlati
x-ai/grok-4.5, grok-4.5-latest, grok-build-latest, grok-4.5, grok-4.5
Ailoot Ultra · OpenAI Chat POST /v1/chat/completions x-ai/grok-4.5
x-ai/grok-4.5grok-4.5x-ai/grok-4.5
Introduzione
Grok 4.5 è il modello di SpaceXAI per programmazione, lavoro intellettuale e attività STEM. Accetta testo, immagini e file per risposte testuali, con controlli di ragionamento, strumenti e output strutturati nel profilo pubblicato e una finestra di contesto di 500.000 token.
- 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 |
|---|---|---|---|---|
Campomodel | Tipostring | RequisitoObbligatorio | Valori e limiti x-ai/grok-4.5 | Predefinito— |
Campomessages | Tipomessage[] | RequisitoObbligatorio | Valori e limiti Numero minimo di elementi: 1 | Predefinito— |
Campomessages[].role | Tipostring | 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— |
Campomessages[].content | Tipostring|content_part[]|null | RequisitoFacoltativo | Valori e limiti | Predefinito— |
Campomessages[].tool_calls | Tipotool_call[] | RequisitoFacoltativo | Valori e limiti | Predefinito— |
Campomessages[].tool_call_id | Tipostring | RequisitoFacoltativo | Valori e limiti Si applica quando: role=tool; usa l’ID effettivamente restituito | Predefinito— |
Campomessages[].name | Tipostring | RequisitoFacoltativo | Valori e limiti | Predefinito— |
Campomessages[].reasoning_content | Tipostring | RequisitoFacoltativo | Valori e limiti Si applica quando: Reinserisci il ragionamento effettivamente restituito quando il modello lo utilizza | Predefinito— |
Campomessages[].reasoning_details | Tipoobject|array | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campomax_tokens | Tipointeger | RequisitoFacoltativo | Valori e limiti Minimo: 1 Dipende dal modello | Predefinito— |
Campomax_completion_tokens | Tipointeger | RequisitoFacoltativo | Valori e limiti Minimo: 1 Dipende dal modello | Predefinito— |
Campostream | Tipoboolean | RequisitoFacoltativo | Valori e limiti | Predefinitofalse |
Campostream_options.include_usage | Tipoboolean | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campotemperature | Tiponumber | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campotop_p | Tiponumber | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campostop | Tipostring|string[] | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campotools | Tipofunction_tool[] | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campotools[].type | Tipostring | RequisitoFacoltativo | Valori e limiti function Dipende dal modello | Predefinito— |
Campotools[].function.name | Tipostring | RequisitoObbligatorio | Valori e limiti Si applica quando: Funzione fornita come strumento | Predefinito— |
Campotools[].function.description | Tipostring | RequisitoFacoltativo | Valori e limiti | Predefinito— |
Campotools[].function.parameters | TipoJSON_schema | RequisitoFacoltativo | Valori e limiti | Predefinito— |
Campotool_choice | Tipostring|object | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campoparallel_tool_calls | Tipoboolean | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Camporesponse_format | Tipoobject | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Camporeasoning_effort | Tipostring | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Camporeasoning | Tipoobject | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Camposervice_tier | Tipostring | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campoinstructions | Tipostring | RequisitoFacoltativo | Valori e limiti Campo di compatibilità | Predefinito— |
Campofunctions | Tipofunction[] | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campofunction_call | Tipostring|object | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campoprompt_cache_options | Tipoobject | RequisitoFacoltativo | Valori e limiti Dipende dal modello | Predefinito— |
Campomodalities | Tipostring[] | RequisitoFacoltativo | Valori e limiti text | Predefinito— |
Campoprovider | Tipoobject | RequisitoFacoltativo | Valori e limiti Condizioni: provider.options viene rifiutato su questa rotta testuale Ultra | Predefinito— |
Campocache_control.ttl | Tipostring | 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 |
|---|---|
Parametrocontent_type | Contrattoapplication/json |
Parametrorequired | Contrattomodel, messages |
Parametromaterial_types | Contrattotext |
Parametromessages | ContrattoArray di messaggi con struttura role/content |
Parametrofile_material | ContrattoDocumento UTF-8 effettivo inserito come testo letterale; nessun ID di file dedotto |
Parametrooptional_controls | Contrattostream, temperature, top_p, stop, max_tokens, max_completion_tokens, reasoning, response_format, tools, tool_choice |
Parametrocontrol_scope | ContrattoSpecifico del modello; gli strumenti di funzione dell’utente differiscono dagli strumenti ospitati |
Parametrooutput_modalities | Contrattotext |
Parametrohosted_operations | Contrattofalse |
Parametromultimodal_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
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.0006 / 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.0006 / 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.0012 / 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 →
Esempi di richieste
Ailoot Ultra · OpenAI Chat
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.5", "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
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.5',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"))
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.5',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 |
|---|---|
Campochoices[].index | Tipointeger |
Campochoices[].message.content | Tipostring|null |
Campochoices[].message.tool_calls | Tipotool_call[] |
Campochoices[].message.reasoning_content | Tipostring |
Campochoices[].message.reasoning_details | Tipoobject|array |
Campochoices[].finish_reason | Tipostring|null |
Campousage | 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
Ailoot grok-4.5, grok-4.5-latest, grok-build-latest
Ailoot Ultra grok-4.5, x-ai/grok-4.5
Alias dei percorsi dei metodi
/chat/completions
ID di chiamata correlati
x-ai/grok-4.5, grok-4.5-latest, grok-build-latest, grok-4.5, grok-4.5
Ailoot Ultra · Anthropic Messages POST /v1/messages x-ai/grok-4.5
x-ai/grok-4.5grok-4.5x-ai/grok-4.5
Introduzione
Grok 4.5 è il modello di SpaceXAI per programmazione, lavoro intellettuale e attività STEM. Accetta testo, immagini e file per risposte testuali, con controlli di ragionamento, strumenti e output strutturati nel profilo pubblicato e una finestra di contesto di 500.000 token.
- 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 |
|---|---|---|---|---|
Campomodel | Tipostring | RequisitoObbligatorio | Valori e limiti x-ai/grok-4.5 | Predefinito— |
Campomessages | Tipomessage[] | RequisitoObbligatorio | Valori e limiti | Predefinito— |
Campomessages[].role | Tipostring | RequisitoObbligatorio | Valori e limiti user, assistant | Predefinito— |
Campomessages[].content | Tipostring | RequisitoObbligatorio | Valori e limiti | Predefinito— |
Campomax_tokens | Tipointeger | RequisitoObbligatorio | Valori e limiti | Predefinito— |
Campostream | Tipoboolean | 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 |
|---|---|
Parametrocontent_type | Contrattoapplication/json |
Parametrorequired | Contrattomodel, messages, max_tokens |
Parametrooptional_controls | Contrattostream |
Parametromaterial_types | Contrattotext |
Parametrotext_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
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.0006 / 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.0006 / 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.0012 / 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 →
Esempi di richieste
Ailoot Ultra · Anthropic Messages
{
"model": "x-ai/grok-4.5",
"max_tokens": 128,
"messages": [
{
"role": "user",
"content": "Summarize the incident report."
}
],
"stream": false
}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.5', '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
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.5', '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 |
|---|---|
Campoid | Tipostring |
Campomodel | Tipostring |
Campocontent[] | Tipotext|thinking|tool_use|other content block |
Campostop_reason | Tipostring|null |
Campousage | 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
Ailoot grok-4.5, grok-4.5-latest, grok-build-latest
Ailoot Ultra grok-4.5, x-ai/grok-4.5
Alias dei percorsi dei metodi
/chat/completions
ID di chiamata correlati
x-ai/grok-4.5, grok-4.5-latest, grok-build-latest, grok-4.5, grok-4.5
FAQ · SpaceXAI: Grok 4.5
- Quali input e risultati sono disponibili?
POST /v1/messages·grok-4.5:text,image→textPOST /v1/responses·grok-4.5:text,image→textPOST /v1/chat/completions·grok-4.5:text,image→textPOST /v1/chat/completions·grok-4.5:text→textPOST /v1/messages·grok-4.5:text→json,ssePOST /v1/messages·grok-4.5-latest:text,image→textPOST /v1/responses·grok-4.5-latest:text,image→textPOST /v1/chat/completions·grok-4.5-latest:text,image→textPOST /v1/messages·grok-build-latest:text,image→textPOST /v1/responses·grok-build-latest:text,image→textPOST /v1/chat/completions·grok-build-latest:text,image→textPOST /v1/chat/completions·x-ai/grok-4.5:text→textPOST /v1/messages·x-ai/grok-4.5:text→json,sse- Quali campi usa la richiesta?
POST /v1/messages·grok-4.5:model,messages,system,max_tokens,stream,metadataPOST /v1/responses·grok-4.5:model,input,instructions,streamPOST /v1/chat/completions·grok-4.5:model,messages,streamPOST /v1/chat/completions·grok-4.5:model,messages,streamPOST /v1/messages·grok-4.5:model,messages,max_tokens,streamPOST /v1/messages·grok-4.5-latest:model,messages,system,max_tokens,stream,metadataPOST /v1/responses·grok-4.5-latest:model,input,instructions,streamPOST /v1/chat/completions·grok-4.5-latest:model,messages,streamPOST /v1/messages·grok-build-latest:model,messages,system,max_tokens,stream,metadataPOST /v1/responses·grok-build-latest:model,input,instructions,streamPOST /v1/chat/completions·grok-build-latest:model,messages,streamPOST /v1/chat/completions·x-ai/grok-4.5:model,messages,stream,modalities,providerPOST /v1/messages·x-ai/grok-4.5:model,messages,max_tokens,stream- Quali limiti si applicano?
POST /v1/messages·grok-4.5:ctx:500000;max_out:500000;messages.min_items:1;max_tokens.minimum:1POST /v1/responses·grok-4.5:ctx:500000;max_out:500000POST /v1/chat/completions·grok-4.5:ctx:500000;max_out:500000;messages.min_items:1POST /v1/chat/completions·grok-4.5:messages.min_items:1POST /v1/messages·grok-4.5-latest:ctx:500000;max_out:500000;messages.min_items:1;max_tokens.minimum:1POST /v1/responses·grok-4.5-latest:ctx:500000;max_out:500000POST /v1/chat/completions·grok-4.5-latest:ctx:500000;max_out:500000;messages.min_items:1POST /v1/messages·grok-build-latest:ctx:500000;max_out:500000;messages.min_items:1;max_tokens.minimum:1POST /v1/responses·grok-build-latest:ctx:500000;max_out:500000POST /v1/chat/completions·grok-build-latest:ctx:500000;max_out:500000;messages.min_items:1POST /v1/chat/completions·x-ai/grok-4.5:messages.min_items:1