Source: https://ailoot.ai/models/sv/k3-256k/
Canonical: https://ailoot.ai/models/sv/k3-256k/
Language: sv

# MoonshotAI: Kimi K3 (256K)

[Markdown](https://ailoot.ai/models/sv/k3-256k/index.md) · [JSON](https://ailoot.ai/models/sv/k3-256k/facts.json)

## [k3-256k](https://ailoot.ai/models/sv/k3-256k/)

Kimi K3-variant med en kontext på 262 144 token för utveckling och analys av text och bilder.

- [**Ailoot · Anthropic Messages** `POST /v1/messages` `k3-256k`](https://ailoot.ai/models/sv/k3-256k/#method-0)
- [**Ailoot · OpenAI Responses** `POST /v1/responses` `k3-256k`](https://ailoot.ai/models/sv/k3-256k/#method-1)
- [**Ailoot · OpenAI Chat** `POST /v1/chat/completions` `k3-256k`](https://ailoot.ai/models/sv/k3-256k/#method-2)
- [**Ailoot · Anthropic Messages** `POST /v1/messages` `kimi-256k`](https://ailoot.ai/models/sv/k3-256k/#method-3)
- [**Ailoot · OpenAI Responses** `POST /v1/responses` `kimi-256k`](https://ailoot.ai/models/sv/k3-256k/#method-4)
- [**Ailoot · OpenAI Chat** `POST /v1/chat/completions` `kimi-256k`](https://ailoot.ai/models/sv/k3-256k/#method-5)
- [**Ailoot · Anthropic Messages** `POST /v1/messages` `kimi-256k-latest`](https://ailoot.ai/models/sv/k3-256k/#method-6)
- [**Ailoot · OpenAI Responses** `POST /v1/responses` `kimi-256k-latest`](https://ailoot.ai/models/sv/k3-256k/#method-7)
- [**Ailoot · OpenAI Chat** `POST /v1/chat/completions` `kimi-256k-latest`](https://ailoot.ai/models/sv/k3-256k/#method-8)

Om modellen

Den här beskrivningen omfattar modellens förmågor. Tillgängliga indata, utdata och alternativ i Ailoot anges nedan för den valda metoden.

#### K3 med fast fönsterstorlek

`k3-256k` är en Kimi K3-variant med en kontext på **262 144 token**. Den behåller K3:s inriktning: långa utvecklingsuppgifter, kod- och verktygsarbete och analys av visuellt material. Fönsterstorleken är fast för varianten, så krav, projektmaterial och arbetshistorik behöver rymmas i ett gemensamt utrymme.

#### Kod och visuell återkoppling

Modellen är avsedd för stegvis utveckling med läsning av kodarkiv, ändringar och användning av körningsresultat. Tillverkaren beskriver K3 i uppgifter med optimering av beräkningskod, skapande av kompilatorer och arbete med stora projekt. Visuellt material kan hjälpa till att koppla implementeringen till det som syns på skärmen.

Bildindata är bekräftade för `k3-256k`. Detta modellkort tar emot text och bilder och modellen returnerar text. Applikationen måste ansluta terminalverktyg, filläsning eller programkörning. Deras resultat kan användas för att fortsätta dialogen.

#### Forskningsarbete

K3 kopplar litteratur- och dataanalys till programmering. Genom verktyg kan den delta i implementering av beräkningar, kontroll av formler och framställning av interaktivt analysmaterial. Inriktningen är användbar när en slutsats behöver kopplas till en beräkning och dess framtagande visas.

#### Resonemang och uppbyggnad

`low`, `high` och `max` stöds. Tillverkarens aktuella konfiguration anger `high` som standardvärde för `k3-256k`. Vid verktygsarbete använder modellen historiken med tidigare svar och resonemang.

K3:s arkitektur har totalt **2,8 biljoner parametrar** och omkring **104 miljarder aktiva**. Kimi Delta Attention och Attention Residuals används för lång kontext, MoonViT-V2 för visuell indata. Modellkortet presenterar just varianten med ett fönster på 262 144 token.

#### Den långa sessionens gränser

K3 är känslig för resonemangshistorikens fullständighet. Tillverkaren varnar för att ofullständig överföring av historiken eller byte till K3 mitt i arbete med en annan modell kan göra svaren instabila. I svåra uppgifter kan den även vara alltför initiativrik: med ett mångtydigt mål kan den själv välja en åtgärd. För verktygsarbete behöver därför tillåtna åtgärder och stoppvillkor anges uttryckligen.

Praktisk uppgift

### Praktisk uppgift

Tekniskt exempel på engelska

```
Preserve evaluation order in a compiler rewrite

A compiler optimizer replaces f() * 0 with 0. In this language, function calls may log messages or raise errors, and left-to-right evaluation is observable. Explain why the rewrite is unsafe, give the condition under which it would be valid and propose two regression tests. Return a focused optimization rule rather than a whole compiler design.
```

#### Förväntat resultat

```
A concise diagnosis, a guarded rewrite rule and two tests covering observable effects.
```

#### Kontrollera resultatet

```
The rule does not discard a call unless its lack of observable effects is established.
```

**Ailoot · Anthropic Messages** `POST /v1/messages` `k3-256k`

[`k3-256k`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=k3-256k&fmt=messages)

Moonshot /`k3-256k`

Modell-ID

- `k3-256k`
- `kimi-256k`
- `kimi-256k-latest`

### Start

Kimi K3-variant med en kontext på 262 144 token för utveckling och analys av text och bilder.

Godkända indata

Text · Bilder

Resultat

Text

### Tillgängligt i Ailoot · indata & metoder

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

Indatatyper

`text`, `image`

Utdatatyper

`text`

Kontext

262 144 tokens

Maximala utdata

65 536 tokens

Utdataformat

json eller SSE

| Fält | Typ | Krav | Värden & gränser | Standard |
| --- | --- | --- | --- | --- |
| Fält`model` | Typ`string` | KravObligatoriskt | Värden & gränser k3-256k | Standard— |
| Fält`messages` | Typ`message[]` | KravObligatoriskt | Värden & gränser Minsta antal objekt: 1 | Standard— |
| Fält`messages[].role` | Typ`string` | KravObligatoriskt | Värden & gränser user, assistant | Standard— |
| Fält`messages[].content` | Typ`string\|content_block[]` | KravObligatoriskt | Värden & gränser | Standard— |
| Fält`system` | Typ`string\|content_block[]` | KravValfritt | Värden & gränser | Standard— |
| Fält`max_tokens` | Typ`integer` | KravObligatoriskt | Värden & gränser Minimum: 1 Gränsen gäller för: den exakta gränsen för den valda modellen/det valda kortet | Standard— |
| Fält`stream` | Typ`boolean` | KravValfritt | Värden & gränser | Standardfalse |
| Fält`temperature` | Typ`number` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`top_p` | Typ`number` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`stop_sequences` | Typ`string[]` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`tools` | Typ`tool[]` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`tools[].name` | Typ`string` | KravValfritt | Värden & gränser Gäller när: verktyg har tillhandahållits | Standard— |
| Fält`tools[].description` | Typ`string` | KravValfritt | Värden & gränser | Standard— |
| Fält`tools[].input_schema` | Typ`JSON_schema` | KravValfritt | Värden & gränser | Standard— |
| Fält`tool_choice` | Typ`object` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`thinking.type` | Typ`string` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`thinking.budget_tokens` | Typ`integer` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`output_config.effort` | Typ`string` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`metadata` | Typ`object` | KravValfritt | Värden & gränser | Standard— |
| Fält`cache_control` | Typ`object` | KravValfritt | Värden & gränser Beror på modellen | Standard— |

Kombinationer av indatamaterial

**Text** · UTF8-text

`messages[].content eller ett type=text-block`

**Text + bild**

`{type:image,source:{type:base64,media_type,data}} eller källa type=url`

Metodparametrar och livscykel

| Parameter | Avtal |
| --- | --- |
| Parameter`material_types` | Avtaltext, image |
| Parameter`required` | Avtalmodel, messages, max\_tokens |
| Parameter`optional_controls` | Avtalnull |
| Parameter`content_type` | Avtalapplication/json |
| Parameter`text_file_material` | Avtalfaktiskt UTF-8-innehåll infogat som text; fil-ID:n/URLs kräver separat, exakt definierat stöd |

Livscykel: `exact retained published method`

Metodernas strukturer och ID:n är exakta; leverantörens funktioner är åtskilda från att begäran tillåts.

### Priser

#### Priser för Ailoot-metoder

Indata

0,003 US$ */ 1K*

Utdata

0,015 US$ */ 1K*

Cacheläsning

0,0003 US$ */ 1K*

Skrivning till cache

0,003 US$ */ 1K*

Skrivning till cache, 5 min

0,003 US$ */ 1K tokens*

Ailoot reserverar ett uppskattat belopp före en begäran. Efter resultatet slutregleras avgiften utifrån uppmätt förbrukning. Slutreglering för strömning använder den slutliga förbrukningsposten. [Så fungerar reservation och slutreglering →](https://ailoot.ai/docs/sv/billing/reserve/)

### Exempelbegäranden

#### Ailoot · Anthropic Messages

TextexempelIndata, bildPython SDKNode.js SDKPython-strömning

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

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

```python
import anthropic
import os

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

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

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

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

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

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

saveResult(msg);
```

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

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

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

with client.messages.stream(model='k3-256k',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")
```

### Ta emot och spara resultat

#### Ailoot · Anthropic Messages

json eller SSE

##### Behåll alla färdiga resultat

Behåll varje fullständigt returnerat svar, fil och innehållsdel.

Behåll alla innehållsblock, resonemangssignaturer och faktiska ID:n för verktygsanvändning. Sätt samman alla SSE-deltauppdateringar för blocken; ett första textblock är inte hela utdata.

##### Om det ursprungliga svaret behöver kontrolleras

Behåll begärans/svarets ID:n och huvuden. Ingen generell URL för hämtning av textjobb tillhandahålls.

Svarsfält

| Fält | Typ |
| --- | --- |
| Fält`id` | Typstring |
| Fält`model` | Typstring |
| Fält`content[]` | Typtext\|thinking\|tool\_use\|other content block |
| Fält`stop_reason` | Typstring\|null |
| Fält`usage` | Typobject |

Fel och nästa steg

| Svar | Villkor | Nästa steg |
| --- | --- | --- |
| Svar400 · `invalid_request_error` | VillkorOgiltiga obligatoriska fält, ogiltig representation av underlaget eller ogiltigt parametervärde | Nästa stegKorrigera de angivna fälten före en ny begäran om att skapa. |

### Alias

#### Modellalias

**Ailoot** [`k3-256k`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=k3-256k&fmt=messages), [`kimi-256k`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=kimi-256k&fmt=messages), [`kimi-256k-latest`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=kimi-256k-latest&fmt=messages)

#### Alias för metodsökvägar

Använd metodsökvägarna som visas ovan.

#### Relaterade anropar-ID:n

[`k3-256k`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=k3-256k&fmt=messages), [`kimi-256k`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=kimi-256k&fmt=messages), [`kimi-256k-latest`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=kimi-256k-latest&fmt=messages)

**Ailoot · OpenAI Responses** `POST /v1/responses` `k3-256k`

[`k3-256k`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=k3-256k&fmt=responses)

Moonshot /`k3-256k`

Modell-ID

- `k3-256k`
- `kimi-256k`
- `kimi-256k-latest`

### Start

Kimi K3-variant med en kontext på 262 144 token för utveckling och analys av text och bilder.

Godkända indata

Text · Bilder

Resultat

Text

### Tillgängligt i Ailoot · indata & metoder

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

Indatatyper

`text`, `image`

Utdatatyper

`text`

Kontext

262 144 tokens

Maximala utdata

65 536 tokens

Utdataformat

json eller SSE

| Fält | Typ | Krav | Värden & gränser | Standard |
| --- | --- | --- | --- | --- |
| Fält`model` | Typ`string` | KravObligatoriskt | Värden & gränser k3-256k | Standard— |
| Fält`input` | Typ`string\|input_item[]` | KravObligatoriskt | Värden & gränser | Standard— |
| Fält`instructions` | Typ`string` | KravValfritt | Värden & gränser | Standard— |
| Fält`input[].type` | Typ`string` | KravValfritt | Värden & gränser message, reasoning, function\_call, function\_call\_output | Standard— |
| Fält`input[].content` | Typ`string\|content_part[]` | KravValfritt | Värden & gränser | Standard— |
| Fält`input[].call_id` | Typ`string` | KravValfritt | Värden & gränser Gäller när: function\_call\_output; behåll det faktiska returnerade call\_id | Standard— |
| Fält`input[].output` | Typ`string\|content_part[]` | KravValfritt | Värden & gränser Gäller när: function\_call\_output | Standard— |
| Fält`max_output_tokens` | Typ`integer` | KravValfritt | Värden & gränser Minimum: 1 Beror på modellen | Standard— |
| Fält`stream` | Typ`boolean` | KravValfritt | Värden & gränser | Standardfalse |
| Fält`temperature` | Typ`number` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`top_p` | Typ`number` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`tools` | Typ`tool[]` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`tool_choice` | Typ`string\|object` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`parallel_tool_calls` | Typ`boolean` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`reasoning.effort` | Typ`string` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`reasoning.summary` | Typ`string` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`text.format` | Typ`object` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`text.verbosity` | Typ`string` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`include` | Typ`string[]` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`store` | Typ`boolean` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`previous_response_id` | Typ`string` | KravValfritt | Värden & gränser ID-krav: Endast ett faktiskt svars-ID från en fortsättning som stöds Beror på modellen | Standard— |
| Fält`service_tier` | Typ`string` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`prompt_cache_key` | Typ`string` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`prompt_cache_options` | Typ`object` | KravValfritt | Värden & gränser Beror på modellen | Standard— |

Kombinationer av indatamaterial

**Text** · UTF8-text

`indatatext eller en input_text-del`

**Text + bild**

`{type:input_image,image_url}`

Metodparametrar och livscykel

| Parameter | Avtal |
| --- | --- |
| Parameter`material_types` | Avtaltext, image |
| Parameter`required` | Avtalmodel, input |
| Parameter`optional_controls` | Avtalnull |
| Parameter`content_type` | Avtalapplication/json |
| Parameter`text_file_material` | Avtalfaktiskt UTF-8-innehåll infogat som text; fil-ID:n/URLs kräver separat, exakt definierat stöd |

Livscykel: `exact retained published method`

Metodernas strukturer och ID:n är exakta; leverantörens funktioner är åtskilda från att begäran tillåts.

### Priser

#### Priser för Ailoot-metoder

Indata

0,003 US$ */ 1K*

Utdata

0,015 US$ */ 1K*

Cacheläsning

0,0003 US$ */ 1K*

Skrivning till cache

0,003 US$ */ 1K*

Skrivning till cache, 5 min

0,003 US$ */ 1K tokens*

Ailoot reserverar ett uppskattat belopp före en begäran. Efter resultatet slutregleras avgiften utifrån uppmätt förbrukning. Slutreglering för strömning använder den slutliga förbrukningsposten. [Så fungerar reservation och slutreglering →](https://ailoot.ai/docs/sv/billing/reserve/)

### Exempelbegäranden

#### Ailoot · OpenAI Responses

TextexempelIndata, bildPython SDKNode.js SDKPython-strömning

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

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

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

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

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

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

```python
from openai import OpenAI
import os

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

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

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

```js
import OpenAI from "openai";

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

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

saveResult(resp);
```

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

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

if not os.environ.get("AILOOT_API_KEY", "").strip(): raise SystemExit("Set AILOOT_API_KEY before making a request")
client=OpenAI(base_url="https://api.ailoot.ai/v1",api_key=os.environ["AILOOT_API_KEY"],max_retries=0)
with client.responses.stream(model="k3-256k", 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")
```

### Ta emot och spara resultat

#### Ailoot · OpenAI Responses

json eller SSE

##### Behåll alla färdiga resultat

Behåll varje fullständigt returnerat svar, fil och innehållsdel.

Behåll varje utdatapost och innehållsdel, det faktiska call\_id för funktionen, krypterat resonemang och användningsuppgifter. Bevara vid strömning den fullständiga identiteten för händelsen/posten.

##### Om det ursprungliga svaret behöver kontrolleras

Behåll begärans/svarets ID:n och huvuden. Ingen generell URL för hämtning av textjobb tillhandahålls.

Svarsfält

| Fält | Typ |
| --- | --- |
| Fält`id` | Typstring |
| Fält`status` | Typstring |
| Fält`output[]` | Typmessage\|reasoning\|function\_call\|other item |
| Fält`output[].content[]` | Typcontent part |
| Fält`usage` | Typobject |

Fel och nästa steg

| Svar | Villkor | Nästa steg |
| --- | --- | --- |
| Svar400 · `invalid_request_error` | VillkorOgiltiga obligatoriska fält, ogiltig representation av underlaget eller ogiltigt parametervärde | Nästa stegKorrigera de angivna fälten före en ny begäran om att skapa. |

### Alias

#### Modellalias

**Ailoot** [`k3-256k`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=k3-256k&fmt=responses), [`kimi-256k`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=kimi-256k&fmt=responses), [`kimi-256k-latest`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=kimi-256k-latest&fmt=responses)

#### Alias för metodsökvägar

Använd metodsökvägarna som visas ovan.

#### Relaterade anropar-ID:n

[`k3-256k`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=k3-256k&fmt=responses), [`kimi-256k`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=kimi-256k&fmt=responses), [`kimi-256k-latest`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=kimi-256k-latest&fmt=responses)

**Ailoot · OpenAI Chat** `POST /v1/chat/completions` `k3-256k`

[`k3-256k`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=k3-256k&fmt=chat)

Moonshot /`k3-256k`

Modell-ID

- `k3-256k`
- `kimi-256k`
- `kimi-256k-latest`

### Start

Kimi K3-variant med en kontext på 262 144 token för utveckling och analys av text och bilder.

Godkända indata

Text · Bilder

Resultat

Text

### Tillgängligt i Ailoot · indata & metoder

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

Indatatyper

`text`, `image`

Utdatatyper

`text`

Kontext

262 144 tokens

Maximala utdata

65 536 tokens

Utdataformat

json eller SSE

| Fält | Typ | Krav | Värden & gränser | Standard |
| --- | --- | --- | --- | --- |
| Fält`model` | Typ`string` | KravObligatoriskt | Värden & gränser k3-256k | Standard— |
| Fält`messages` | Typ`message[]` | KravObligatoriskt | Värden & gränser Minsta antal objekt: 1 | Standard— |
| Fält`messages[].role` | Typ`string` | KravObligatoriskt | Värden & gränser Exempel: system, user, assistant, tool, function Villkor: Dessa roller representeras uttryckligen av källkodens kompatibilitetstyper; den exakta rolluppsättningen är fortfarande modellspecifik. Beror på modellen | Standard— |
| Fält`messages[].content` | Typ`string\|content_part[]\|null` | KravValfritt | Värden & gränser | Standard— |
| Fält`messages[].tool_calls` | Typ`tool_call[]` | KravValfritt | Värden & gränser | Standard— |
| Fält`messages[].tool_call_id` | Typ`string` | KravValfritt | Värden & gränser Gäller när: role=tool; använd det faktiska returnerade ID:t | Standard— |
| Fält`messages[].name` | Typ`string` | KravValfritt | Värden & gränser | Standard— |
| Fält`messages[].reasoning_content` | Typ`string` | KravValfritt | Värden & gränser Gäller när: Skicka tillbaka det faktiska returnerade resonemanget när modellen använder det | Standard— |
| Fält`messages[].reasoning_details` | Typ`object\|array` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`max_tokens` | Typ`integer` | KravValfritt | Värden & gränser Minimum: 1 Beror på modellen | Standard— |
| Fält`max_completion_tokens` | Typ`integer` | KravValfritt | Värden & gränser Minimum: 1 Beror på modellen | Standard— |
| Fält`stream` | Typ`boolean` | KravValfritt | Värden & gränser | Standardfalse |
| Fält`stream_options.include_usage` | Typ`boolean` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`temperature` | Typ`number` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`top_p` | Typ`number` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`stop` | Typ`string\|string[]` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`tools` | Typ`function_tool[]` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`tools[].type` | Typ`string` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`tools[].function.name` | Typ`string` | KravObligatoriskt | Värden & gränser Gäller när: verktyg av typen funktion har tillhandahållits | Standard— |
| Fält`tools[].function.description` | Typ`string` | KravValfritt | Värden & gränser | Standard— |
| Fält`tools[].function.parameters` | Typ`JSON_schema` | KravValfritt | Värden & gränser | Standard— |
| Fält`tool_choice` | Typ`string\|object` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`parallel_tool_calls` | Typ`boolean` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`response_format` | Typ`object` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`reasoning_effort` | Typ`string` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`reasoning` | Typ`object` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`service_tier` | Typ`string` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`instructions` | Typ`string` | KravValfritt | Värden & gränser Kompatibilitetsfält | Standard— |
| Fält`functions` | Typ`function[]` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`function_call` | Typ`string\|object` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`prompt_cache_options` | Typ`object` | KravValfritt | Värden & gränser Beror på modellen | Standard— |

Kombinationer av indatamaterial

**Text** · UTF8-text

`messages[].content`

**Text + bild**

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

Metodparametrar och livscykel

| Parameter | Avtal |
| --- | --- |
| Parameter`material_types` | Avtaltext, image |
| Parameter`required` | Avtalmodel, messages |
| Parameter`optional_controls` | Avtalnull |
| Parameter`content_type` | Avtalapplication/json |
| Parameter`text_file_material` | Avtalfaktiskt UTF-8-innehåll infogat som text; fil-ID:n/URLs kräver separat, exakt definierat stöd |

Livscykel: `exact retained published method`

Metodernas strukturer och ID:n är exakta; leverantörens funktioner är åtskilda från att begäran tillåts.

### Priser

#### Priser för Ailoot-metoder

Indata

0,003 US$ */ 1K*

Utdata

0,015 US$ */ 1K*

Cacheläsning

0,0003 US$ */ 1K*

Skrivning till cache

0,003 US$ */ 1K*

Skrivning till cache, 5 min

0,003 US$ */ 1K tokens*

Ailoot reserverar ett uppskattat belopp före en begäran. Efter resultatet slutregleras avgiften utifrån uppmätt förbrukning. Slutreglering för strömning använder den slutliga förbrukningsposten. [Så fungerar reservation och slutreglering →](https://ailoot.ai/docs/sv/billing/reserve/)

### Exempelbegäranden

#### Ailoot · OpenAI Chat

TextexempelIndata, bildPython SDKNode.js SDKPython-strömning

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

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

```python
from openai import OpenAI
import os

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

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

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

```js
import OpenAI from "openai";

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

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

saveResult(resp);
```

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

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

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

with client.chat.completions.stream(model='k3-256k',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")
```

### Ta emot och spara resultat

#### Ailoot · OpenAI Chat

json eller SSE

##### Behåll alla färdiga resultat

Behåll varje fullständigt returnerat svar, fil och innehållsdel.

Behåll varje svarsalternativ och dess innehåll/verktygsanrop/resonemang. Sätt i SSE samman deltauppdateringar efter svarsalternativets/verktygets index och behåll den slutliga avslutsorsaken och användningsuppgifterna.

##### Om det ursprungliga svaret behöver kontrolleras

Behåll begärans/svarets ID:n och huvuden. Ingen generell URL för hämtning av textjobb tillhandahålls.

Svarsfält

| Fält | Typ |
| --- | --- |
| Fält`choices[].index` | Typinteger |
| Fält`choices[].message.content` | Typstring\|null |
| Fält`choices[].message.tool_calls` | Typtool\_call\[\] |
| Fält`choices[].message.reasoning_content` | Typstring |
| Fält`choices[].message.reasoning_details` | Typobject\|array |
| Fält`choices[].finish_reason` | Typstring\|null |
| Fält`usage` | Typobject |

Fel och nästa steg

| Svar | Villkor | Nästa steg |
| --- | --- | --- |
| Svar400 · `invalid_request_error` | VillkorOgiltiga obligatoriska fält, ogiltig representation av underlaget eller ogiltigt parametervärde | Nästa stegKorrigera de angivna fälten före en ny begäran om att skapa. |

### Alias

#### Modellalias

**Ailoot** [`k3-256k`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=k3-256k&fmt=chat), [`kimi-256k`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=kimi-256k&fmt=chat), [`kimi-256k-latest`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=kimi-256k-latest&fmt=chat)

#### Alias för metodsökvägar

Använd metodsökvägarna som visas ovan.

#### Relaterade anropar-ID:n

[`k3-256k`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=k3-256k&fmt=chat), [`kimi-256k`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=kimi-256k&fmt=chat), [`kimi-256k-latest`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=kimi-256k-latest&fmt=chat)

**Ailoot · Anthropic Messages** `POST /v1/messages` `kimi-256k`

[`kimi-256k`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=kimi-256k&fmt=messages)

Moonshot /`kimi-256k`

Modell-ID

- `k3-256k`
- `kimi-256k`
- `kimi-256k-latest`

### Start

Kimi K3-variant med en kontext på 262 144 token för utveckling och analys av text och bilder.

Godkända indata

Text · Bilder

Resultat

Text

### Tillgängligt i Ailoot · indata & metoder

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

Indatatyper

`text`, `image`

Utdatatyper

`text`

Kontext

262 144 tokens

Maximala utdata

65 536 tokens

Utdataformat

json eller SSE

| Fält | Typ | Krav | Värden & gränser | Standard |
| --- | --- | --- | --- | --- |
| Fält`model` | Typ`string` | KravObligatoriskt | Värden & gränser kimi-256k | Standard— |
| Fält`messages` | Typ`message[]` | KravObligatoriskt | Värden & gränser Minsta antal objekt: 1 | Standard— |
| Fält`messages[].role` | Typ`string` | KravObligatoriskt | Värden & gränser user, assistant | Standard— |
| Fält`messages[].content` | Typ`string\|content_block[]` | KravObligatoriskt | Värden & gränser | Standard— |
| Fält`system` | Typ`string\|content_block[]` | KravValfritt | Värden & gränser | Standard— |
| Fält`max_tokens` | Typ`integer` | KravObligatoriskt | Värden & gränser Minimum: 1 Gränsen gäller för: den exakta gränsen för den valda modellen/det valda kortet | Standard— |
| Fält`stream` | Typ`boolean` | KravValfritt | Värden & gränser | Standardfalse |
| Fält`temperature` | Typ`number` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`top_p` | Typ`number` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`stop_sequences` | Typ`string[]` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`tools` | Typ`tool[]` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`tools[].name` | Typ`string` | KravValfritt | Värden & gränser Gäller när: verktyg har tillhandahållits | Standard— |
| Fält`tools[].description` | Typ`string` | KravValfritt | Värden & gränser | Standard— |
| Fält`tools[].input_schema` | Typ`JSON_schema` | KravValfritt | Värden & gränser | Standard— |
| Fält`tool_choice` | Typ`object` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`thinking.type` | Typ`string` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`thinking.budget_tokens` | Typ`integer` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`output_config.effort` | Typ`string` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`metadata` | Typ`object` | KravValfritt | Värden & gränser | Standard— |
| Fält`cache_control` | Typ`object` | KravValfritt | Värden & gränser Beror på modellen | Standard— |

Kombinationer av indatamaterial

**Text** · UTF8-text

`messages[].content eller ett type=text-block`

**Text + bild**

`{type:image,source:{type:base64,media_type,data}} eller källa type=url`

Metodparametrar och livscykel

| Parameter | Avtal |
| --- | --- |
| Parameter`material_types` | Avtaltext, image |
| Parameter`required` | Avtalmodel, messages, max\_tokens |
| Parameter`optional_controls` | Avtalnull |
| Parameter`content_type` | Avtalapplication/json |
| Parameter`text_file_material` | Avtalfaktiskt UTF-8-innehåll infogat som text; fil-ID:n/URLs kräver separat, exakt definierat stöd |

Livscykel: `exact retained published method`

Metodernas strukturer och ID:n är exakta; leverantörens funktioner är åtskilda från att begäran tillåts.

### Priser

#### Priser för Ailoot-metoder

Indata

0,003 US$ */ 1K*

Utdata

0,015 US$ */ 1K*

Cacheläsning

0,0003 US$ */ 1K*

Skrivning till cache

0,003 US$ */ 1K*

Skrivning till cache, 5 min

0,003 US$ */ 1K tokens*

Ailoot reserverar ett uppskattat belopp före en begäran. Efter resultatet slutregleras avgiften utifrån uppmätt förbrukning. Slutreglering för strömning använder den slutliga förbrukningsposten. [Så fungerar reservation och slutreglering →](https://ailoot.ai/docs/sv/billing/reserve/)

### Exempelbegäranden

#### Ailoot · Anthropic Messages

TextexempelIndata, bildPython SDKNode.js SDKPython-strömning

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

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

```python
import anthropic
import os

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

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

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

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

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

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

saveResult(msg);
```

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

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

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

with client.messages.stream(model='kimi-256k',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")
```

### Ta emot och spara resultat

#### Ailoot · Anthropic Messages

json eller SSE

##### Behåll alla färdiga resultat

Behåll varje fullständigt returnerat svar, fil och innehållsdel.

Behåll alla innehållsblock, resonemangssignaturer och faktiska ID:n för verktygsanvändning. Sätt samman alla SSE-deltauppdateringar för blocken; ett första textblock är inte hela utdata.

##### Om det ursprungliga svaret behöver kontrolleras

Behåll begärans/svarets ID:n och huvuden. Ingen generell URL för hämtning av textjobb tillhandahålls.

Svarsfält

| Fält | Typ |
| --- | --- |
| Fält`id` | Typstring |
| Fält`model` | Typstring |
| Fält`content[]` | Typtext\|thinking\|tool\_use\|other content block |
| Fält`stop_reason` | Typstring\|null |
| Fält`usage` | Typobject |

Fel och nästa steg

| Svar | Villkor | Nästa steg |
| --- | --- | --- |
| Svar400 · `invalid_request_error` | VillkorOgiltiga obligatoriska fält, ogiltig representation av underlaget eller ogiltigt parametervärde | Nästa stegKorrigera de angivna fälten före en ny begäran om att skapa. |

### Alias

#### Modellalias

**Ailoot** [`k3-256k`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=k3-256k&fmt=messages), [`kimi-256k`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=kimi-256k&fmt=messages), [`kimi-256k-latest`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=kimi-256k-latest&fmt=messages)

#### Alias för metodsökvägar

Använd metodsökvägarna som visas ovan.

#### Relaterade anropar-ID:n

[`k3-256k`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=k3-256k&fmt=messages), [`kimi-256k`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=kimi-256k&fmt=messages), [`kimi-256k-latest`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=kimi-256k-latest&fmt=messages)

**Ailoot · OpenAI Responses** `POST /v1/responses` `kimi-256k`

[`kimi-256k`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=kimi-256k&fmt=responses)

Moonshot /`kimi-256k`

Modell-ID

- `k3-256k`
- `kimi-256k`
- `kimi-256k-latest`

### Start

Kimi K3-variant med en kontext på 262 144 token för utveckling och analys av text och bilder.

Godkända indata

Text · Bilder

Resultat

Text

### Tillgängligt i Ailoot · indata & metoder

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

Indatatyper

`text`, `image`

Utdatatyper

`text`

Kontext

262 144 tokens

Maximala utdata

65 536 tokens

Utdataformat

json eller SSE

| Fält | Typ | Krav | Värden & gränser | Standard |
| --- | --- | --- | --- | --- |
| Fält`model` | Typ`string` | KravObligatoriskt | Värden & gränser kimi-256k | Standard— |
| Fält`input` | Typ`string\|input_item[]` | KravObligatoriskt | Värden & gränser | Standard— |
| Fält`instructions` | Typ`string` | KravValfritt | Värden & gränser | Standard— |
| Fält`input[].type` | Typ`string` | KravValfritt | Värden & gränser message, reasoning, function\_call, function\_call\_output | Standard— |
| Fält`input[].content` | Typ`string\|content_part[]` | KravValfritt | Värden & gränser | Standard— |
| Fält`input[].call_id` | Typ`string` | KravValfritt | Värden & gränser Gäller när: function\_call\_output; behåll det faktiska returnerade call\_id | Standard— |
| Fält`input[].output` | Typ`string\|content_part[]` | KravValfritt | Värden & gränser Gäller när: function\_call\_output | Standard— |
| Fält`max_output_tokens` | Typ`integer` | KravValfritt | Värden & gränser Minimum: 1 Beror på modellen | Standard— |
| Fält`stream` | Typ`boolean` | KravValfritt | Värden & gränser | Standardfalse |
| Fält`temperature` | Typ`number` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`top_p` | Typ`number` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`tools` | Typ`tool[]` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`tool_choice` | Typ`string\|object` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`parallel_tool_calls` | Typ`boolean` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`reasoning.effort` | Typ`string` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`reasoning.summary` | Typ`string` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`text.format` | Typ`object` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`text.verbosity` | Typ`string` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`include` | Typ`string[]` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`store` | Typ`boolean` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`previous_response_id` | Typ`string` | KravValfritt | Värden & gränser ID-krav: Endast ett faktiskt svars-ID från en fortsättning som stöds Beror på modellen | Standard— |
| Fält`service_tier` | Typ`string` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`prompt_cache_key` | Typ`string` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`prompt_cache_options` | Typ`object` | KravValfritt | Värden & gränser Beror på modellen | Standard— |

Kombinationer av indatamaterial

**Text** · UTF8-text

`indatatext eller en input_text-del`

**Text + bild**

`{type:input_image,image_url}`

Metodparametrar och livscykel

| Parameter | Avtal |
| --- | --- |
| Parameter`material_types` | Avtaltext, image |
| Parameter`required` | Avtalmodel, input |
| Parameter`optional_controls` | Avtalnull |
| Parameter`content_type` | Avtalapplication/json |
| Parameter`text_file_material` | Avtalfaktiskt UTF-8-innehåll infogat som text; fil-ID:n/URLs kräver separat, exakt definierat stöd |

Livscykel: `exact retained published method`

Metodernas strukturer och ID:n är exakta; leverantörens funktioner är åtskilda från att begäran tillåts.

### Priser

#### Priser för Ailoot-metoder

Indata

0,003 US$ */ 1K*

Utdata

0,015 US$ */ 1K*

Cacheläsning

0,0003 US$ */ 1K*

Skrivning till cache

0,003 US$ */ 1K*

Skrivning till cache, 5 min

0,003 US$ */ 1K tokens*

Ailoot reserverar ett uppskattat belopp före en begäran. Efter resultatet slutregleras avgiften utifrån uppmätt förbrukning. Slutreglering för strömning använder den slutliga förbrukningsposten. [Så fungerar reservation och slutreglering →](https://ailoot.ai/docs/sv/billing/reserve/)

### Exempelbegäranden

#### Ailoot · OpenAI Responses

TextexempelIndata, bildPython SDKNode.js SDKPython-strömning

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

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

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

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

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

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

```python
from openai import OpenAI
import os

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

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

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

```js
import OpenAI from "openai";

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

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

saveResult(resp);
```

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

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

if not os.environ.get("AILOOT_API_KEY", "").strip(): raise SystemExit("Set AILOOT_API_KEY before making a request")
client=OpenAI(base_url="https://api.ailoot.ai/v1",api_key=os.environ["AILOOT_API_KEY"],max_retries=0)
with client.responses.stream(model="kimi-256k", 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")
```

### Ta emot och spara resultat

#### Ailoot · OpenAI Responses

json eller SSE

##### Behåll alla färdiga resultat

Behåll varje fullständigt returnerat svar, fil och innehållsdel.

Behåll varje utdatapost och innehållsdel, det faktiska call\_id för funktionen, krypterat resonemang och användningsuppgifter. Bevara vid strömning den fullständiga identiteten för händelsen/posten.

##### Om det ursprungliga svaret behöver kontrolleras

Behåll begärans/svarets ID:n och huvuden. Ingen generell URL för hämtning av textjobb tillhandahålls.

Svarsfält

| Fält | Typ |
| --- | --- |
| Fält`id` | Typstring |
| Fält`status` | Typstring |
| Fält`output[]` | Typmessage\|reasoning\|function\_call\|other item |
| Fält`output[].content[]` | Typcontent part |
| Fält`usage` | Typobject |

Fel och nästa steg

| Svar | Villkor | Nästa steg |
| --- | --- | --- |
| Svar400 · `invalid_request_error` | VillkorOgiltiga obligatoriska fält, ogiltig representation av underlaget eller ogiltigt parametervärde | Nästa stegKorrigera de angivna fälten före en ny begäran om att skapa. |

### Alias

#### Modellalias

**Ailoot** [`k3-256k`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=k3-256k&fmt=responses), [`kimi-256k`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=kimi-256k&fmt=responses), [`kimi-256k-latest`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=kimi-256k-latest&fmt=responses)

#### Alias för metodsökvägar

Använd metodsökvägarna som visas ovan.

#### Relaterade anropar-ID:n

[`k3-256k`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=k3-256k&fmt=responses), [`kimi-256k`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=kimi-256k&fmt=responses), [`kimi-256k-latest`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=kimi-256k-latest&fmt=responses)

**Ailoot · OpenAI Chat** `POST /v1/chat/completions` `kimi-256k`

[`kimi-256k`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=kimi-256k&fmt=chat)

Moonshot /`kimi-256k`

Modell-ID

- `k3-256k`
- `kimi-256k`
- `kimi-256k-latest`

### Start

Kimi K3-variant med en kontext på 262 144 token för utveckling och analys av text och bilder.

Godkända indata

Text · Bilder

Resultat

Text

### Tillgängligt i Ailoot · indata & metoder

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

Indatatyper

`text`, `image`

Utdatatyper

`text`

Kontext

262 144 tokens

Maximala utdata

65 536 tokens

Utdataformat

json eller SSE

| Fält | Typ | Krav | Värden & gränser | Standard |
| --- | --- | --- | --- | --- |
| Fält`model` | Typ`string` | KravObligatoriskt | Värden & gränser kimi-256k | Standard— |
| Fält`messages` | Typ`message[]` | KravObligatoriskt | Värden & gränser Minsta antal objekt: 1 | Standard— |
| Fält`messages[].role` | Typ`string` | KravObligatoriskt | Värden & gränser Exempel: system, user, assistant, tool, function Villkor: Dessa roller representeras uttryckligen av källkodens kompatibilitetstyper; den exakta rolluppsättningen är fortfarande modellspecifik. Beror på modellen | Standard— |
| Fält`messages[].content` | Typ`string\|content_part[]\|null` | KravValfritt | Värden & gränser | Standard— |
| Fält`messages[].tool_calls` | Typ`tool_call[]` | KravValfritt | Värden & gränser | Standard— |
| Fält`messages[].tool_call_id` | Typ`string` | KravValfritt | Värden & gränser Gäller när: role=tool; använd det faktiska returnerade ID:t | Standard— |
| Fält`messages[].name` | Typ`string` | KravValfritt | Värden & gränser | Standard— |
| Fält`messages[].reasoning_content` | Typ`string` | KravValfritt | Värden & gränser Gäller när: Skicka tillbaka det faktiska returnerade resonemanget när modellen använder det | Standard— |
| Fält`messages[].reasoning_details` | Typ`object\|array` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`max_tokens` | Typ`integer` | KravValfritt | Värden & gränser Minimum: 1 Beror på modellen | Standard— |
| Fält`max_completion_tokens` | Typ`integer` | KravValfritt | Värden & gränser Minimum: 1 Beror på modellen | Standard— |
| Fält`stream` | Typ`boolean` | KravValfritt | Värden & gränser | Standardfalse |
| Fält`stream_options.include_usage` | Typ`boolean` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`temperature` | Typ`number` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`top_p` | Typ`number` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`stop` | Typ`string\|string[]` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`tools` | Typ`function_tool[]` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`tools[].type` | Typ`string` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`tools[].function.name` | Typ`string` | KravObligatoriskt | Värden & gränser Gäller när: verktyg av typen funktion har tillhandahållits | Standard— |
| Fält`tools[].function.description` | Typ`string` | KravValfritt | Värden & gränser | Standard— |
| Fält`tools[].function.parameters` | Typ`JSON_schema` | KravValfritt | Värden & gränser | Standard— |
| Fält`tool_choice` | Typ`string\|object` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`parallel_tool_calls` | Typ`boolean` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`response_format` | Typ`object` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`reasoning_effort` | Typ`string` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`reasoning` | Typ`object` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`service_tier` | Typ`string` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`instructions` | Typ`string` | KravValfritt | Värden & gränser Kompatibilitetsfält | Standard— |
| Fält`functions` | Typ`function[]` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`function_call` | Typ`string\|object` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`prompt_cache_options` | Typ`object` | KravValfritt | Värden & gränser Beror på modellen | Standard— |

Kombinationer av indatamaterial

**Text** · UTF8-text

`messages[].content`

**Text + bild**

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

Metodparametrar och livscykel

| Parameter | Avtal |
| --- | --- |
| Parameter`material_types` | Avtaltext, image |
| Parameter`required` | Avtalmodel, messages |
| Parameter`optional_controls` | Avtalnull |
| Parameter`content_type` | Avtalapplication/json |
| Parameter`text_file_material` | Avtalfaktiskt UTF-8-innehåll infogat som text; fil-ID:n/URLs kräver separat, exakt definierat stöd |

Livscykel: `exact retained published method`

Metodernas strukturer och ID:n är exakta; leverantörens funktioner är åtskilda från att begäran tillåts.

### Priser

#### Priser för Ailoot-metoder

Indata

0,003 US$ */ 1K*

Utdata

0,015 US$ */ 1K*

Cacheläsning

0,0003 US$ */ 1K*

Skrivning till cache

0,003 US$ */ 1K*

Skrivning till cache, 5 min

0,003 US$ */ 1K tokens*

Ailoot reserverar ett uppskattat belopp före en begäran. Efter resultatet slutregleras avgiften utifrån uppmätt förbrukning. Slutreglering för strömning använder den slutliga förbrukningsposten. [Så fungerar reservation och slutreglering →](https://ailoot.ai/docs/sv/billing/reserve/)

### Exempelbegäranden

#### Ailoot · OpenAI Chat

TextexempelIndata, bildPython SDKNode.js SDKPython-strömning

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

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

```python
from openai import OpenAI
import os

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

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

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

```js
import OpenAI from "openai";

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

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

saveResult(resp);
```

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

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

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

with client.chat.completions.stream(model='kimi-256k',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")
```

### Ta emot och spara resultat

#### Ailoot · OpenAI Chat

json eller SSE

##### Behåll alla färdiga resultat

Behåll varje fullständigt returnerat svar, fil och innehållsdel.

Behåll varje svarsalternativ och dess innehåll/verktygsanrop/resonemang. Sätt i SSE samman deltauppdateringar efter svarsalternativets/verktygets index och behåll den slutliga avslutsorsaken och användningsuppgifterna.

##### Om det ursprungliga svaret behöver kontrolleras

Behåll begärans/svarets ID:n och huvuden. Ingen generell URL för hämtning av textjobb tillhandahålls.

Svarsfält

| Fält | Typ |
| --- | --- |
| Fält`choices[].index` | Typinteger |
| Fält`choices[].message.content` | Typstring\|null |
| Fält`choices[].message.tool_calls` | Typtool\_call\[\] |
| Fält`choices[].message.reasoning_content` | Typstring |
| Fält`choices[].message.reasoning_details` | Typobject\|array |
| Fält`choices[].finish_reason` | Typstring\|null |
| Fält`usage` | Typobject |

Fel och nästa steg

| Svar | Villkor | Nästa steg |
| --- | --- | --- |
| Svar400 · `invalid_request_error` | VillkorOgiltiga obligatoriska fält, ogiltig representation av underlaget eller ogiltigt parametervärde | Nästa stegKorrigera de angivna fälten före en ny begäran om att skapa. |

### Alias

#### Modellalias

**Ailoot** [`k3-256k`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=k3-256k&fmt=chat), [`kimi-256k`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=kimi-256k&fmt=chat), [`kimi-256k-latest`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=kimi-256k-latest&fmt=chat)

#### Alias för metodsökvägar

Använd metodsökvägarna som visas ovan.

#### Relaterade anropar-ID:n

[`k3-256k`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=k3-256k&fmt=chat), [`kimi-256k`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=kimi-256k&fmt=chat), [`kimi-256k-latest`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=kimi-256k-latest&fmt=chat)

**Ailoot · Anthropic Messages** `POST /v1/messages` `kimi-256k-latest`

[`kimi-256k-latest`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=kimi-256k-latest&fmt=messages)

Moonshot /`kimi-256k-latest`

Modell-ID

- `k3-256k`
- `kimi-256k`
- `kimi-256k-latest`

### Start

Kimi K3-variant med en kontext på 262 144 token för utveckling och analys av text och bilder.

Godkända indata

Text · Bilder

Resultat

Text

### Tillgängligt i Ailoot · indata & metoder

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

Indatatyper

`text`, `image`

Utdatatyper

`text`

Kontext

262 144 tokens

Maximala utdata

65 536 tokens

Utdataformat

json eller SSE

| Fält | Typ | Krav | Värden & gränser | Standard |
| --- | --- | --- | --- | --- |
| Fält`model` | Typ`string` | KravObligatoriskt | Värden & gränser kimi-256k-latest | Standard— |
| Fält`messages` | Typ`message[]` | KravObligatoriskt | Värden & gränser Minsta antal objekt: 1 | Standard— |
| Fält`messages[].role` | Typ`string` | KravObligatoriskt | Värden & gränser user, assistant | Standard— |
| Fält`messages[].content` | Typ`string\|content_block[]` | KravObligatoriskt | Värden & gränser | Standard— |
| Fält`system` | Typ`string\|content_block[]` | KravValfritt | Värden & gränser | Standard— |
| Fält`max_tokens` | Typ`integer` | KravObligatoriskt | Värden & gränser Minimum: 1 Gränsen gäller för: den exakta gränsen för den valda modellen/det valda kortet | Standard— |
| Fält`stream` | Typ`boolean` | KravValfritt | Värden & gränser | Standardfalse |
| Fält`temperature` | Typ`number` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`top_p` | Typ`number` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`stop_sequences` | Typ`string[]` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`tools` | Typ`tool[]` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`tools[].name` | Typ`string` | KravValfritt | Värden & gränser Gäller när: verktyg har tillhandahållits | Standard— |
| Fält`tools[].description` | Typ`string` | KravValfritt | Värden & gränser | Standard— |
| Fält`tools[].input_schema` | Typ`JSON_schema` | KravValfritt | Värden & gränser | Standard— |
| Fält`tool_choice` | Typ`object` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`thinking.type` | Typ`string` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`thinking.budget_tokens` | Typ`integer` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`output_config.effort` | Typ`string` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`metadata` | Typ`object` | KravValfritt | Värden & gränser | Standard— |
| Fält`cache_control` | Typ`object` | KravValfritt | Värden & gränser Beror på modellen | Standard— |

Kombinationer av indatamaterial

**Text** · UTF8-text

`messages[].content eller ett type=text-block`

**Text + bild**

`{type:image,source:{type:base64,media_type,data}} eller källa type=url`

Metodparametrar och livscykel

| Parameter | Avtal |
| --- | --- |
| Parameter`material_types` | Avtaltext, image |
| Parameter`required` | Avtalmodel, messages, max\_tokens |
| Parameter`optional_controls` | Avtalnull |
| Parameter`content_type` | Avtalapplication/json |
| Parameter`text_file_material` | Avtalfaktiskt UTF-8-innehåll infogat som text; fil-ID:n/URLs kräver separat, exakt definierat stöd |

Livscykel: `exact retained published method`

Metodernas strukturer och ID:n är exakta; leverantörens funktioner är åtskilda från att begäran tillåts.

### Priser

#### Priser för Ailoot-metoder

Indata

0,003 US$ */ 1K*

Utdata

0,015 US$ */ 1K*

Cacheläsning

0,0003 US$ */ 1K*

Skrivning till cache

0,003 US$ */ 1K*

Skrivning till cache, 5 min

0,003 US$ */ 1K tokens*

Ailoot reserverar ett uppskattat belopp före en begäran. Efter resultatet slutregleras avgiften utifrån uppmätt förbrukning. Slutreglering för strömning använder den slutliga förbrukningsposten. [Så fungerar reservation och slutreglering →](https://ailoot.ai/docs/sv/billing/reserve/)

### Exempelbegäranden

#### Ailoot · Anthropic Messages

TextexempelIndata, bildPython SDKNode.js SDKPython-strömning

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

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

```python
import anthropic
import os

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

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

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

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

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

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

saveResult(msg);
```

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

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

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

with client.messages.stream(model='kimi-256k-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")
```

### Ta emot och spara resultat

#### Ailoot · Anthropic Messages

json eller SSE

##### Behåll alla färdiga resultat

Behåll varje fullständigt returnerat svar, fil och innehållsdel.

Behåll alla innehållsblock, resonemangssignaturer och faktiska ID:n för verktygsanvändning. Sätt samman alla SSE-deltauppdateringar för blocken; ett första textblock är inte hela utdata.

##### Om det ursprungliga svaret behöver kontrolleras

Behåll begärans/svarets ID:n och huvuden. Ingen generell URL för hämtning av textjobb tillhandahålls.

Svarsfält

| Fält | Typ |
| --- | --- |
| Fält`id` | Typstring |
| Fält`model` | Typstring |
| Fält`content[]` | Typtext\|thinking\|tool\_use\|other content block |
| Fält`stop_reason` | Typstring\|null |
| Fält`usage` | Typobject |

Fel och nästa steg

| Svar | Villkor | Nästa steg |
| --- | --- | --- |
| Svar400 · `invalid_request_error` | VillkorOgiltiga obligatoriska fält, ogiltig representation av underlaget eller ogiltigt parametervärde | Nästa stegKorrigera de angivna fälten före en ny begäran om att skapa. |

### Alias

#### Modellalias

**Ailoot** [`k3-256k`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=k3-256k&fmt=messages), [`kimi-256k`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=kimi-256k&fmt=messages), [`kimi-256k-latest`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=kimi-256k-latest&fmt=messages)

#### Alias för metodsökvägar

Använd metodsökvägarna som visas ovan.

#### Relaterade anropar-ID:n

[`k3-256k`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=k3-256k&fmt=messages), [`kimi-256k`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=kimi-256k&fmt=messages), [`kimi-256k-latest`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=kimi-256k-latest&fmt=messages)

**Ailoot · OpenAI Responses** `POST /v1/responses` `kimi-256k-latest`

[`kimi-256k-latest`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=kimi-256k-latest&fmt=responses)

Moonshot /`kimi-256k-latest`

Modell-ID

- `k3-256k`
- `kimi-256k`
- `kimi-256k-latest`

### Start

Kimi K3-variant med en kontext på 262 144 token för utveckling och analys av text och bilder.

Godkända indata

Text · Bilder

Resultat

Text

### Tillgängligt i Ailoot · indata & metoder

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

Indatatyper

`text`, `image`

Utdatatyper

`text`

Kontext

262 144 tokens

Maximala utdata

65 536 tokens

Utdataformat

json eller SSE

| Fält | Typ | Krav | Värden & gränser | Standard |
| --- | --- | --- | --- | --- |
| Fält`model` | Typ`string` | KravObligatoriskt | Värden & gränser kimi-256k-latest | Standard— |
| Fält`input` | Typ`string\|input_item[]` | KravObligatoriskt | Värden & gränser | Standard— |
| Fält`instructions` | Typ`string` | KravValfritt | Värden & gränser | Standard— |
| Fält`input[].type` | Typ`string` | KravValfritt | Värden & gränser message, reasoning, function\_call, function\_call\_output | Standard— |
| Fält`input[].content` | Typ`string\|content_part[]` | KravValfritt | Värden & gränser | Standard— |
| Fält`input[].call_id` | Typ`string` | KravValfritt | Värden & gränser Gäller när: function\_call\_output; behåll det faktiska returnerade call\_id | Standard— |
| Fält`input[].output` | Typ`string\|content_part[]` | KravValfritt | Värden & gränser Gäller när: function\_call\_output | Standard— |
| Fält`max_output_tokens` | Typ`integer` | KravValfritt | Värden & gränser Minimum: 1 Beror på modellen | Standard— |
| Fält`stream` | Typ`boolean` | KravValfritt | Värden & gränser | Standardfalse |
| Fält`temperature` | Typ`number` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`top_p` | Typ`number` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`tools` | Typ`tool[]` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`tool_choice` | Typ`string\|object` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`parallel_tool_calls` | Typ`boolean` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`reasoning.effort` | Typ`string` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`reasoning.summary` | Typ`string` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`text.format` | Typ`object` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`text.verbosity` | Typ`string` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`include` | Typ`string[]` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`store` | Typ`boolean` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`previous_response_id` | Typ`string` | KravValfritt | Värden & gränser ID-krav: Endast ett faktiskt svars-ID från en fortsättning som stöds Beror på modellen | Standard— |
| Fält`service_tier` | Typ`string` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`prompt_cache_key` | Typ`string` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`prompt_cache_options` | Typ`object` | KravValfritt | Värden & gränser Beror på modellen | Standard— |

Kombinationer av indatamaterial

**Text** · UTF8-text

`indatatext eller en input_text-del`

**Text + bild**

`{type:input_image,image_url}`

Metodparametrar och livscykel

| Parameter | Avtal |
| --- | --- |
| Parameter`material_types` | Avtaltext, image |
| Parameter`required` | Avtalmodel, input |
| Parameter`optional_controls` | Avtalnull |
| Parameter`content_type` | Avtalapplication/json |
| Parameter`text_file_material` | Avtalfaktiskt UTF-8-innehåll infogat som text; fil-ID:n/URLs kräver separat, exakt definierat stöd |

Livscykel: `exact retained published method`

Metodernas strukturer och ID:n är exakta; leverantörens funktioner är åtskilda från att begäran tillåts.

### Priser

#### Priser för Ailoot-metoder

Indata

0,003 US$ */ 1K*

Utdata

0,015 US$ */ 1K*

Cacheläsning

0,0003 US$ */ 1K*

Skrivning till cache

0,003 US$ */ 1K*

Skrivning till cache, 5 min

0,003 US$ */ 1K tokens*

Ailoot reserverar ett uppskattat belopp före en begäran. Efter resultatet slutregleras avgiften utifrån uppmätt förbrukning. Slutreglering för strömning använder den slutliga förbrukningsposten. [Så fungerar reservation och slutreglering →](https://ailoot.ai/docs/sv/billing/reserve/)

### Exempelbegäranden

#### Ailoot · OpenAI Responses

TextexempelIndata, bildPython SDKNode.js SDKPython-strömning

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

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

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

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

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

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

```python
from openai import OpenAI
import os

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

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

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

```js
import OpenAI from "openai";

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

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

saveResult(resp);
```

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

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

if not os.environ.get("AILOOT_API_KEY", "").strip(): raise SystemExit("Set AILOOT_API_KEY before making a request")
client=OpenAI(base_url="https://api.ailoot.ai/v1",api_key=os.environ["AILOOT_API_KEY"],max_retries=0)
with client.responses.stream(model="kimi-256k-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")
```

### Ta emot och spara resultat

#### Ailoot · OpenAI Responses

json eller SSE

##### Behåll alla färdiga resultat

Behåll varje fullständigt returnerat svar, fil och innehållsdel.

Behåll varje utdatapost och innehållsdel, det faktiska call\_id för funktionen, krypterat resonemang och användningsuppgifter. Bevara vid strömning den fullständiga identiteten för händelsen/posten.

##### Om det ursprungliga svaret behöver kontrolleras

Behåll begärans/svarets ID:n och huvuden. Ingen generell URL för hämtning av textjobb tillhandahålls.

Svarsfält

| Fält | Typ |
| --- | --- |
| Fält`id` | Typstring |
| Fält`status` | Typstring |
| Fält`output[]` | Typmessage\|reasoning\|function\_call\|other item |
| Fält`output[].content[]` | Typcontent part |
| Fält`usage` | Typobject |

Fel och nästa steg

| Svar | Villkor | Nästa steg |
| --- | --- | --- |
| Svar400 · `invalid_request_error` | VillkorOgiltiga obligatoriska fält, ogiltig representation av underlaget eller ogiltigt parametervärde | Nästa stegKorrigera de angivna fälten före en ny begäran om att skapa. |

### Alias

#### Modellalias

**Ailoot** [`k3-256k`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=k3-256k&fmt=responses), [`kimi-256k`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=kimi-256k&fmt=responses), [`kimi-256k-latest`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=kimi-256k-latest&fmt=responses)

#### Alias för metodsökvägar

Använd metodsökvägarna som visas ovan.

#### Relaterade anropar-ID:n

[`k3-256k`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=k3-256k&fmt=responses), [`kimi-256k`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=kimi-256k&fmt=responses), [`kimi-256k-latest`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=kimi-256k-latest&fmt=responses)

**Ailoot · OpenAI Chat** `POST /v1/chat/completions` `kimi-256k-latest`

[`kimi-256k-latest`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=kimi-256k-latest&fmt=chat)

Moonshot /`kimi-256k-latest`

Modell-ID

- `k3-256k`
- `kimi-256k`
- `kimi-256k-latest`

### Start

Kimi K3-variant med en kontext på 262 144 token för utveckling och analys av text och bilder.

Godkända indata

Text · Bilder

Resultat

Text

### Tillgängligt i Ailoot · indata & metoder

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

Indatatyper

`text`, `image`

Utdatatyper

`text`

Kontext

262 144 tokens

Maximala utdata

65 536 tokens

Utdataformat

json eller SSE

| Fält | Typ | Krav | Värden & gränser | Standard |
| --- | --- | --- | --- | --- |
| Fält`model` | Typ`string` | KravObligatoriskt | Värden & gränser kimi-256k-latest | Standard— |
| Fält`messages` | Typ`message[]` | KravObligatoriskt | Värden & gränser Minsta antal objekt: 1 | Standard— |
| Fält`messages[].role` | Typ`string` | KravObligatoriskt | Värden & gränser Exempel: system, user, assistant, tool, function Villkor: Dessa roller representeras uttryckligen av källkodens kompatibilitetstyper; den exakta rolluppsättningen är fortfarande modellspecifik. Beror på modellen | Standard— |
| Fält`messages[].content` | Typ`string\|content_part[]\|null` | KravValfritt | Värden & gränser | Standard— |
| Fält`messages[].tool_calls` | Typ`tool_call[]` | KravValfritt | Värden & gränser | Standard— |
| Fält`messages[].tool_call_id` | Typ`string` | KravValfritt | Värden & gränser Gäller när: role=tool; använd det faktiska returnerade ID:t | Standard— |
| Fält`messages[].name` | Typ`string` | KravValfritt | Värden & gränser | Standard— |
| Fält`messages[].reasoning_content` | Typ`string` | KravValfritt | Värden & gränser Gäller när: Skicka tillbaka det faktiska returnerade resonemanget när modellen använder det | Standard— |
| Fält`messages[].reasoning_details` | Typ`object\|array` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`max_tokens` | Typ`integer` | KravValfritt | Värden & gränser Minimum: 1 Beror på modellen | Standard— |
| Fält`max_completion_tokens` | Typ`integer` | KravValfritt | Värden & gränser Minimum: 1 Beror på modellen | Standard— |
| Fält`stream` | Typ`boolean` | KravValfritt | Värden & gränser | Standardfalse |
| Fält`stream_options.include_usage` | Typ`boolean` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`temperature` | Typ`number` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`top_p` | Typ`number` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`stop` | Typ`string\|string[]` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`tools` | Typ`function_tool[]` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`tools[].type` | Typ`string` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`tools[].function.name` | Typ`string` | KravObligatoriskt | Värden & gränser Gäller när: verktyg av typen funktion har tillhandahållits | Standard— |
| Fält`tools[].function.description` | Typ`string` | KravValfritt | Värden & gränser | Standard— |
| Fält`tools[].function.parameters` | Typ`JSON_schema` | KravValfritt | Värden & gränser | Standard— |
| Fält`tool_choice` | Typ`string\|object` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`parallel_tool_calls` | Typ`boolean` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`response_format` | Typ`object` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`reasoning_effort` | Typ`string` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`reasoning` | Typ`object` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`service_tier` | Typ`string` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`instructions` | Typ`string` | KravValfritt | Värden & gränser Kompatibilitetsfält | Standard— |
| Fält`functions` | Typ`function[]` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`function_call` | Typ`string\|object` | KravValfritt | Värden & gränser Beror på modellen | Standard— |
| Fält`prompt_cache_options` | Typ`object` | KravValfritt | Värden & gränser Beror på modellen | Standard— |

Kombinationer av indatamaterial

**Text** · UTF8-text

`messages[].content`

**Text + bild**

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

Metodparametrar och livscykel

| Parameter | Avtal |
| --- | --- |
| Parameter`material_types` | Avtaltext, image |
| Parameter`required` | Avtalmodel, messages |
| Parameter`optional_controls` | Avtalnull |
| Parameter`content_type` | Avtalapplication/json |
| Parameter`text_file_material` | Avtalfaktiskt UTF-8-innehåll infogat som text; fil-ID:n/URLs kräver separat, exakt definierat stöd |

Livscykel: `exact retained published method`

Metodernas strukturer och ID:n är exakta; leverantörens funktioner är åtskilda från att begäran tillåts.

### Priser

#### Priser för Ailoot-metoder

Indata

0,003 US$ */ 1K*

Utdata

0,015 US$ */ 1K*

Cacheläsning

0,0003 US$ */ 1K*

Skrivning till cache

0,003 US$ */ 1K*

Skrivning till cache, 5 min

0,003 US$ */ 1K tokens*

Ailoot reserverar ett uppskattat belopp före en begäran. Efter resultatet slutregleras avgiften utifrån uppmätt förbrukning. Slutreglering för strömning använder den slutliga förbrukningsposten. [Så fungerar reservation och slutreglering →](https://ailoot.ai/docs/sv/billing/reserve/)

### Exempelbegäranden

#### Ailoot · OpenAI Chat

TextexempelIndata, bildPython SDKNode.js SDKPython-strömning

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

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

```python
from openai import OpenAI
import os

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

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

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

```js
import OpenAI from "openai";

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

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

saveResult(resp);
```

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

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

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

with client.chat.completions.stream(model='kimi-256k-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")
```

### Ta emot och spara resultat

#### Ailoot · OpenAI Chat

json eller SSE

##### Behåll alla färdiga resultat

Behåll varje fullständigt returnerat svar, fil och innehållsdel.

Behåll varje svarsalternativ och dess innehåll/verktygsanrop/resonemang. Sätt i SSE samman deltauppdateringar efter svarsalternativets/verktygets index och behåll den slutliga avslutsorsaken och användningsuppgifterna.

##### Om det ursprungliga svaret behöver kontrolleras

Behåll begärans/svarets ID:n och huvuden. Ingen generell URL för hämtning av textjobb tillhandahålls.

Svarsfält

| Fält | Typ |
| --- | --- |
| Fält`choices[].index` | Typinteger |
| Fält`choices[].message.content` | Typstring\|null |
| Fält`choices[].message.tool_calls` | Typtool\_call\[\] |
| Fält`choices[].message.reasoning_content` | Typstring |
| Fält`choices[].message.reasoning_details` | Typobject\|array |
| Fält`choices[].finish_reason` | Typstring\|null |
| Fält`usage` | Typobject |

Fel och nästa steg

| Svar | Villkor | Nästa steg |
| --- | --- | --- |
| Svar400 · `invalid_request_error` | VillkorOgiltiga obligatoriska fält, ogiltig representation av underlaget eller ogiltigt parametervärde | Nästa stegKorrigera de angivna fälten före en ny begäran om att skapa. |

### Alias

#### Modellalias

**Ailoot** [`k3-256k`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=k3-256k&fmt=chat), [`kimi-256k`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=kimi-256k&fmt=chat), [`kimi-256k-latest`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=kimi-256k-latest&fmt=chat)

#### Alias för metodsökvägar

Använd metodsökvägarna som visas ovan.

#### Relaterade anropar-ID:n

[`k3-256k`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=k3-256k&fmt=chat), [`kimi-256k`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=kimi-256k&fmt=chat), [`kimi-256k-latest`](https://ailoot.ai/models/sv/#m=k3-256k&route=Core&caller=kimi-256k-latest&fmt=chat)

FAQ · MoonshotAI: Kimi K3 (256K)

Vilka indata och resultat finns?

`POST /v1/messages` · `k3-256k`: `text`, `image` → `text` `POST /v1/responses` · `k3-256k`: `text`, `image` → `text` `POST /v1/chat/completions` · `k3-256k`: `text`, `image` → `text` `POST /v1/messages` · `kimi-256k`: `text`, `image` → `text` `POST /v1/responses` · `kimi-256k`: `text`, `image` → `text` `POST /v1/chat/completions` · `kimi-256k`: `text`, `image` → `text` `POST /v1/messages` · `kimi-256k-latest`: `text`, `image` → `text` `POST /v1/responses` · `kimi-256k-latest`: `text`, `image` → `text` `POST /v1/chat/completions` · `kimi-256k-latest`: `text`, `image` → `text`

Vilka fält använder begäran?

`POST /v1/messages` · `k3-256k`: `model`, `messages`, `system`, `max_tokens`, `stream`, `metadata` `POST /v1/responses` · `k3-256k`: `model`, `input`, `instructions`, `stream` `POST /v1/chat/completions` · `k3-256k`: `model`, `messages`, `stream` `POST /v1/messages` · `kimi-256k`: `model`, `messages`, `system`, `max_tokens`, `stream`, `metadata` `POST /v1/responses` · `kimi-256k`: `model`, `input`, `instructions`, `stream` `POST /v1/chat/completions` · `kimi-256k`: `model`, `messages`, `stream` `POST /v1/messages` · `kimi-256k-latest`: `model`, `messages`, `system`, `max_tokens`, `stream`, `metadata` `POST /v1/responses` · `kimi-256k-latest`: `model`, `input`, `instructions`, `stream` `POST /v1/chat/completions` · `kimi-256k-latest`: `model`, `messages`, `stream`

Vilka gränser gäller?

`POST /v1/messages` · `k3-256k`: `ctx`: `262144`; `max_out`: `65536`; `messages.min_items`: `1`; `max_tokens.minimum`: `1` `POST /v1/responses` · `k3-256k`: `ctx`: `262144`; `max_out`: `65536` `POST /v1/chat/completions` · `k3-256k`: `ctx`: `262144`; `max_out`: `65536`; `messages.min_items`: `1` `POST /v1/messages` · `kimi-256k`: `ctx`: `262144`; `max_out`: `65536`; `messages.min_items`: `1`; `max_tokens.minimum`: `1` `POST /v1/responses` · `kimi-256k`: `ctx`: `262144`; `max_out`: `65536` `POST /v1/chat/completions` · `kimi-256k`: `ctx`: `262144`; `max_out`: `65536`; `messages.min_items`: `1` `POST /v1/messages` · `kimi-256k-latest`: `ctx`: `262144`; `max_out`: `65536`; `messages.min_items`: `1`; `max_tokens.minimum`: `1` `POST /v1/responses` · `kimi-256k-latest`: `ctx`: `262144`; `max_out`: `65536` `POST /v1/chat/completions` · `kimi-256k-latest`: `ctx`: `262144`; `max_out`: `65536`; `messages.min_items`: `1`

Anslut Ailoot till Claude Code, OpenCode, Hermes eller din app.

## Företaget och dess projektportfölj

Företaget och dess projektportfölj: miljontals kunder; månatlig försäljning för miljarder.

## Köp token med rabatt.

Prenumerationsrabatt för återkommande arbete. Kampanjkoder ger upp till 50% vid tokenköp.

Prenumeration

Välj en rabatterad plan för återkommande anrop.

Kampanjkod upp till 50%

Ange koden vid köpet. Priset räknas om enligt kampanjen.

Kostnader i historiken

Modell, token och belopp sparas för varje anrop.

[Välj prenumeration](https://ailoot.ai/docs/sv/billing/subscriptions/) · [Se modellpriser](https://ailoot.ai/models/sv/)

## Anslut API till produkten som du säljer.

SaaS, appar och botar enligt Ailoots officiella villkor och licensavtal. Begär återförsäljarlicens för vidareförsäljning.

Kommersiell applikation

Bygg text-, bild-, video- och ljudgenerering i tjänstens betalda funktioner.

Återförsäljarlicens

Skicka projektbeskrivning och åtkomstupplägg. Begär skriftliga villkor för användning och vidareförsäljning.

Dokument på webbplatsen

Officiella villkor, licensavtal och databehandlingspolicy finns tillgängliga före anslutning.

[Begär återförsäljarlicens](mailto:support@ailoot.ai) · [Officiella villkor och licensavtal](https://ailoot.ai/legal/offer?lang=sv)

## Ailoot · Företaget och dess projektportfölj





Ailoot bygger på etablerad driftserfarenhet, en stor kundbas, stabil service och löpande KPI-kontroll.





Företaget och dess projektportfölj: miljontals kunder; månatlig försäljning för miljarder.





Ailoot använder denna driftserfarenhet för API-åtkomst till AI-funktioner i kundernas produkter, agenter, applikationer och automatiseringar.
