Peke ki ngā ihirangi
Ngā whakaahua me ngā kōnae

Ngā whakaahua me ngā kōnae

Tukuna ngā whakaahua me tētahi karere: ko ēhea model e whakaae ana, ngā hōputu whakaaetia me ō rātou tepe.

POST https://api.shannon-ai.com/v1/chat/completions

Ka haere tētahi whakaahua i roto i tētahi karere kaiwhakamahi, hei wāhanga kotahi o tōna content. Ka pānui te tauira i tētahi kōnae ā-rohe, ā, ka tuku hei data URL.

import base64
from openai import OpenAI

client = OpenAI(api_key="YOUR_API_KEY", base_url="https://api.shannon-ai.com/v1")

with open("photo.jpg", "rb") as f:
    image = base64.b64encode(f.read()).decode()

response = client.chat.completions.create(
    model="shannon-3",
    messages=[{
        "role": "user",
        "content": [
            {"type": "text", "text": "What is in this picture?"},
            {"type": "image_url", "image_url": {"url": "data:image/jpeg;base64," + image}},
        ],
    }],
)

print(response.choices[0].message.content)
200 JSON
{
  "id": "chatcmpl-8d1f3a5c7e9b4d2f6a8c0e2b4d6f8a1c",
  "object": "chat.completion",
  "created": 1791590400,
  "model": "shannon-3",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "A grey cat asleep on a windowsill, with a potted fern beside it.",
        "reasoning_content": null
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 286,
    "completion_tokens": 19,
    "total_tokens": 305
  }
}

Ko ēhea model e whakaae ana ki ngā whakaahua

Ngā model Ka pānui
shannon-3, shannon-3-pro, shannon-3.1, shannon-3.1-pro Ngā whakaahua, me ngā tuhinga: PDF, Word, PowerPoint, Excel me ngā kōnae kuputuhi noa.
shannon-1.6-lite, shannon-1.6-pro Ngā whakaahua.
shannon-2-lite, shannon-2-pro Ngā whakaahua, i ngā tono e tuku ana hoki i te tools i te response_format rānei.
Kimi-K3-3BIT-REAP, MiniMax-M3-3BIT-REAP, Kimi-K2.6-W4A16-AUTOROUND-REAP, inkling-W4A16-AUTOROUND-REAP, MiMo-V2.5-W8A16 Ngā whakaahua.
DeepSeek-V4-Pro-0813-3BIT-REAP, GLM-5.2-3BIT-REAP, Nemotron3Ultra-3BIT-REAP, DeepSeek-V4-Flash-0731-W4A16-AUTOROUND-REAP, Laguna-S-2.1-W4A16-AUTOROUND-REAP, MiMo-V2.5-Pro-W8A16, Hy3-W8A16 Kuputuhi. Ka whakautua tētahi tono me tētahi whakaahua ki te tūnga 400.
shannon-coder-1 Kuputuhi.

Ka pūrongo te GET /v1/models i te input whakaahua mō ia id hei capabilities.vision. Ngā model me ngā utu

  • Ka pānui ngā model Shannon i ngā kōnae o te karere kaiwhakamahi whakamutunga. Whakanōhia te whakaahua ki te karere e pātai ana mō ia.
  • Ka pupuri hoki te whānau Shannon 3 i ētahi whakaahua me ētahi tuhinga o ngā karere kaiwhakamahi o mua ina i tukuna i roto i te rārangi, ā, ka pānui i tētahi tino maha kua tautuhia o ngā whakaahua mō ia tono, e tatauria ana mai i te tuatahi.
  • Ka pānui ngā model open-weight hosted i ngā whakaahua o ia karere o te kōrero.

Ngā hōputu whakaaetia

Ka tukuna tētahi kōnae mā tētahi o ngā ara e rua: i roto i te tono hei base64, hei wāhitau rānei ka tikina e te API. Ka haere ia kōnae me te tono; kāore he endpoint tuku ake i te API.

Endpoint I roto i te tono (base64) Mā te wāhitau
/v1/chat/completions {"type": "image_url", "image_url": {"url": "data:image/jpeg;base64,…"}} {"type": "image_url", "image_url": {"url": "https://…"}}
/v1/responses {"type": "input_image", "image_url": "data:image/jpeg;base64,…"} {"type": "input_image", "image_url": "https://…"}
/v1/messages {"type": "image", "source": {"type": "base64", "media_type": "image/jpeg", "data": "…"}} {"type": "image", "source": {"type": "url", "url": "https://…"}}

Te karere kaiwhakamahi ōrite i ia hōputu:

{
  "role": "user",
  "content": [
    {"type": "text", "text": "What is in this picture?"},
    {
      "type": "image_url",
      "image_url": {
        "url": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD…"
      }
    }
  ]
}
  • Ko te āhua o tētahi data URL ko data:<media type>;base64,<data>. E hiahiatia ana te wāhanga ;base64.
  • I runga i te /v1/chat/completions me te /v1/responses, ka taea te image_url te aho ake, he ahanoa {"url": "…"} rānei.
  • Ka puta te momo kōnae i te data URL, i te media_type rānei. Ki te kore, ka pānuitia tētahi whakaahua hei image/png.
  • Ka tatau ngā kōnae i roto ki te rahi o te tinana tono, ka taea te tae ki te 32 MiB.
  • E whakaaetia ana mō te hototahi: image_url.detail.

Ngā tepe mō ngā kōnae tawhiti

Ina tukua e koe tētahi wāhitau, ka tikina e te API te kōnae i mua i te rere o te model, i roto i ēnei tepe:

Tepe Ture
Rahi Tae atu ki te 8 MiB mō ia kōnae.
Wā 20 hēkona hei whakautu.
Ngā redirect Tae atu ki te 5 anake.
Wāhitau http:// https:// rānei, kāore he ingoa kaiwhakamahi, kupuhipa rānei i te wāhitau, i runga i tētahi host me tētahi wāhitau tūmatanui.
Whakautu a te host He tūnga i te whānuitanga 200, me tētahi tinana kāore i te kau. Ka pānuitia te momo kōnae mai i te Content-Type.
Ka tonoa hei User-Agent: ShannonBot/1.0 (+https://shannon-ai.com)

Te tatau o ngā whakaahua ki ngā token

I runga i ngā model open-weight hosted ka tatau tētahi whakaahua hei token kotahi mō ia kōpaki pika 28 × 28: te whānui whakawehea ki te 28, whakaarotia ki runga, whakarea ki te teitei whakawehea ki te 28, whakaarotia ki runga. He wāhanga te hua o te usage.prompt_tokens, ā, ka whakaritea hei input.

1024 × 1024
1,369 tokens
1920 × 1080
2,691 tokens
512 × 512
361 tokens
  • Ka tikina i te tuatahi tētahi whakaahua tawhiti, nō reira ka tatauria tōna rahi tūturu.
  • Ka tatau tētahi whakaahua kāore e taea te pānui tōna rahi hei 1,024 token.
  • Ka whakamahi ngā endpoint tatau i te ture ōrite mō ngā data URL. Kāore rātou e tiki i tētahi wāhitau tawhiti, ā, ka tatau hei 1,024 token. Te tatau token
  • Mō tētahi model Shannon, pānuitia te utu o tētahi tono me ngā whakaahua mai i te usage i te whakautu.

Ngā tuhinga me ētahi atu kōnae

Ka pānui hoki te whānau Shannon 3 (shannon-3, shannon-3-pro, shannon-3.1, shannon-3.1-pro) i ngā tuhinga. Ka tangohia te kuputuhi o te tuhinga, ā, ka hoatu ki te model me tō karere.

Tuhinga Momo pāpāho
PDF application/pdf
Word application/vnd.openxmlformats-officedocument.wordprocessingml.document
PowerPoint application/vnd.openxmlformats-officedocument.presentationml.presentation
Excel application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

He wāhanga o te karere kaiwhakamahi te tuhinga, pērā i tētahi whakaahua:

Endpoint I roto i te tono (base64) Mā te wāhitau
/v1/chat/completions, /v1/messages {"type": "document", "source": {"type": "base64", "media_type": "application/pdf", "data": "…"}} {"type": "document", "source": {"type": "url", "url": "https://…"}}
/v1/responses {"type": "input_file", "file_data": "data:application/pdf;base64,…"} {"type": "input_file", "file_url": "https://…"}
{
  "model": "shannon-3",
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "document",
          "source": {
            "type": "base64",
            "media_type": "application/pdf",
            "data": "JVBERi0xLjcKJeLjz9MK…"
          }
        },
        {"type": "text", "text": "Summarise this report in five points."}
      ]
    }
  ]
}
  • Hoatu te momo pāpāho tūturu o te kōnae. Ki te kore, ka pānuitia tētahi tuhinga hei application/pdf.
  • Ka pānuitia tētahi kōnae kuputuhi noa, pēnei i te CSV, hei kuputuhi, ā, ka tāpirihia i te ara ōrite.
  • Ina kāore e taea te pānui tētahi tuhinga, he momo kē rānei te kōnae, ka kīia ki te model, ā, ka taea e ia te kī i tana whakautu. Ko 200 tonu te tūnga.
  • I runga i ia model kē atu, ka waihohia tētahi wāhanga tuhinga i te mea e pānuitia ana e te model, ā, ka whakautua te tono mai i te toenga.
  • Ka tikina tētahi tuhinga i tukuna mā te wāhitau i raro i ngā tepe mō ngā kōnae tawhiti i runga ake nei.

Ngā hapa

Tūnga Momo Karere Āhea
400 invalid_request_error <id> does not accept image input I tukuna tētahi whakaahua ki tētahi model open-weight hosted e whakaae ana ki te kuputuhi anake. Kāore he mea e tangohia i tō toenga.
400 invalid_request_error audio and video input are not supported by any hosted model I tukuna tētahi wāhanga oro, ataata rānei ki tētahi model open-weight hosted.
413 invalid_request_error Failed to buffer the request body: … Nui ake te tinana tono, me ōna kōnae i roto, i te 32 MiB. Ka kawe te hapa i te code: "request_too_large".

Ka whakautu tētahi model Shannon me te tūnga 200 ahakoa ngā kōnae e kawea ana e te tono: ka waihohia tētahi wāhanga kāore ia e pānui. Whakahaere hapa