ပုံများနှင့် ဖိုင်များ
မက်ဆေ့ချ်နှင့်အတူ ပုံများ ပို့ပါ- ဘယ် model များက လက်ခံသည်၊ လက်ခံသော ပုံစံများနှင့် ၎င်းတို့၏ ကန့်သတ်ချက်များ။
POST https://api.shannon-ai.com/v1/chat/completions
ပုံတစ်ပုံသည် user message အတွင်း ၎င်း၏ content ၏ အစိတ်အပိုင်းတစ်ခုအဖြစ် သွားသည်။ နမူနာသည် local ဖိုင်တစ်ခုကို ဖတ်ပြီး 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) import fs from "node:fs";
import OpenAI from "openai";
const client = new OpenAI({ apiKey: "YOUR_API_KEY", baseURL: "https://api.shannon-ai.com/v1" });
const image = fs.readFileSync("photo.jpg").toString("base64");
const response = await 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 } },
],
}],
});
console.log(response.choices[0].message.content); # Linux: base64 -w0 photo.jpg macOS: base64 -i photo.jpg
IMAGE=$(base64 -w0 photo.jpg)
curl https://api.shannon-ai.com/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d @- <<EOF
{
"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}"}}
]
}]
}
EOF {
"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
}
} ဘယ် model များက ပုံကို လက်ခံသည်
| Models | ဖတ်သည် |
|---|---|
shannon-3, shannon-3-pro, shannon-3.1, shannon-3.1-pro | ပုံများနှင့် စာရွက်စာတမ်းများ- PDF၊ Word၊ PowerPoint၊ Excel နှင့် plain-text ဖိုင်များ။ |
shannon-1.6-lite, shannon-1.6-pro | ပုံများ။ |
shannon-2-lite, shannon-2-pro | tools သို့မဟုတ် response_format ကိုလည်း ပို့သော request များတွင် ပုံများ။ |
Kimi-K3-3BIT-REAP, MiniMax-M3-3BIT-REAP, Kimi-K2.6-W4A16-AUTOROUND-REAP, inkling-W4A16-AUTOROUND-REAP, MiMo-V2.5-W8A16 | ပုံများ။ |
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 | စာသား။ ပုံပါသော request ကို status 400 ဖြင့် ဖြေကြားသည်။ |
shannon-coder-1 | စာသား။ |
GET /v1/models သည် ပုံ input ကို id တစ်ခုစီအလိုက် capabilities.vision အဖြစ် ဖော်ပြသည်။ Model များနှင့် ဈေးနှုန်း
- Shannon models များသည် နောက်ဆုံး user message ၏ ဖိုင်များကို ဖတ်သည်။ ပုံနှင့်ပတ်သက်၍ မေးသည့် message ထဲတွင် ပုံကို ထည့်ပါ။
- Shannon 3 မိသားစုသည် ယခင် user message များ၏ ပုံနှင့် စာရွက်စာတမ်း အနည်းငယ်ကို inline ပို့ထားလျှင် ဆက်လက်မှတ်သားထားပြီး request တစ်ခုလျှင် ပထမမှ စ၍ ရေတွက်ကာ သတ်မှတ်ထားသော အများဆုံးအရေအတွက်အထိ ပုံများကို ဖတ်သည်။
- Host လုပ်ထားသော open-weight models များသည် စကားပြောဆိုမှုရှိ message တိုင်း၏ ပုံများကို ဖတ်သည်။
လက်ခံသော ပုံစံများ
ဖိုင်ကို နည်းလမ်းနှစ်မျိုးအနက် တစ်မျိုးဖြင့် ပို့သည်- request အတွင်း base64 အဖြစ်၊ သို့မဟုတ် API က ရယူသော လိပ်စာအဖြစ်။ ဖိုင်တိုင်းသည် request နှင့်အတူ သွားသည်၊ API တွင် upload endpoint မရှိပါ။
| Endpoint | Request အတွင်းတွင် (base64 ဖြင့်) | လိပ်စာဖြင့် |
|---|---|---|
/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://…"}} |
format တစ်ခုစီရှိ တူညီသော user message-
{
"role": "user",
"content": [
{"type": "text", "text": "What is in this picture?"},
{
"type": "image_url",
"image_url": {
"url": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD…"
}
}
]
} {
"role": "user",
"content": [
{"type": "input_text", "text": "What is in this picture?"},
{
"type": "input_image",
"image_url": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD…"
}
]
} {
"role": "user",
"content": [
{"type": "text", "text": "What is in this picture?"},
{
"type": "image",
"source": {
"type": "base64",
"media_type": "image/jpeg",
"data": "/9j/4AAQSkZJRgABAQAAAQABAAD…"
}
}
]
} - data URL ၏ ပုံစံမှာ
data:<media type>;base64,<data>ဖြစ်သည်။;base64အပိုင်းသည် လိုအပ်သည်။ /v1/chat/completionsနှင့်/v1/responsesတွင်image_urlသည် string ကိုယ်တိုင်ဖြစ်နိုင်သလို{"url": "…"}object လည်း ဖြစ်နိုင်သည်။- ဖိုင်အမျိုးအစားသည် data URL မှ သို့မဟုတ်
media_typeမှ လာသည်။ မပါလျှင် ပုံကိုimage/pngအဖြစ် ဖတ်သည်။ - Inline ဖိုင်များကို request body ၏ အရွယ်အစားတွင် ရေတွက်ပြီး ၎င်းသည် 32 MiB အထိ ရှိနိုင်သည်။
- ကိုက်ညီမှုအတွက် လက်ခံသည်-
image_url.detail။
Remote ဖိုင်များအတွက် ကန့်သတ်ချက်များ
လိပ်စာတစ်ခု ပို့လျှင် model မ run မီ API က ဤကန့်သတ်ချက်များအတွင်း ဖိုင်ကို ရယူသည်-
| ကန့်သတ်ချက် | စည်းမျဉ်း |
|---|---|
| အရွယ်အစား | ဖိုင်တစ်ခုလျှင် 8 MiB အထိ။ |
| အချိန် | ဖြေကြားရန် 20 စက္ကန့်။ |
| Redirects | အများဆုံး 5 ကြိမ်။ |
| လိပ်စာ | http:// သို့မဟုတ် https://၊ လိပ်စာတွင် user name သို့မဟုတ် password မပါဘဲ အများသုံးလိပ်စာရှိသော host တစ်ခုတွင်။ |
| host ၏ ပြန်ကြားချက် | 200 အပိုင်းအခြားအတွင်း status နှင့် အလွတ်မဟုတ်သော body။ ဖိုင်အမျိုးအစားကို Content-Type မှ ဖတ်သည်။ |
| တောင်းဆိုပုံ | User-Agent: ShannonBot/1.0 (+https://shannon-ai.com) |
ပုံများကို tokens ဖြင့် မည်သို့ ရေတွက်သည်
Host လုပ်ထားသော open-weight models များတွင် ပုံတစ်ပုံကို 28 × 28 pixel patch တစ်ခုလျှင် token တစ်ခုအဖြစ် ရေတွက်သည်- အကျယ်ကို 28 ဖြင့်စားပြီး ကိန်းပြည့်သို့ တက်ကာ အမြင့်ကို 28 ဖြင့်စားပြီး ကိန်းပြည့်သို့ တက်ထားသည့် တန်ဖိုးနှင့် မြှောက်သည်။ ရလဒ်သည် usage.prompt_tokens ၏ အစိတ်အပိုင်းဖြစ်ပြီး input အဖြစ် ကျသင့်ငွေတောင်းသည်။
- 1024 × 1024
- 1,369 tokens
- 1920 × 1080
- 2,691 tokens
- 512 × 512
- 361 tokens
- remote ပုံကို အရင်ရယူသဖြင့် ၎င်း၏ အစစ်အမှန်အရွယ်အစားကို ရေတွက်သည်။
- အရွယ်အစားကို ဖတ်၍မရသော ပုံကို 1,024 tokens အဖြစ် ရေတွက်သည်။
- ရေတွက်သော endpoint များသည် data URL များအတွက် တူညီသော စည်းမျဉ်းကို သုံးသည်။ remote လိပ်စာကို မရယူဘဲ 1,024 tokens အဖြစ် ရေတွက်သည်။ Token ရေတွက်ခြင်း
- Shannon model အတွက် ပုံပါသော request ၏ ကုန်ကျစရိတ်ကို ပြန်ကြားချက်ရှိ
usageမှ ဖတ်ပါ။
စာရွက်စာတမ်းများနှင့် အခြားဖိုင်များ
Shannon 3 မိသားစု (shannon-3, shannon-3-pro, shannon-3.1, shannon-3.1-pro) သည် စာရွက်စာတမ်းများကိုလည်း ဖတ်သည်။ စာရွက်စာတမ်း၏ စာသားကို ထုတ်ယူပြီး သင့်မက်ဆေ့ချ်နှင့်အတူ model သို့ ပေးသည်။
| စာရွက်စာတမ်း | Media type |
|---|---|
application/pdf | |
| Word | application/vnd.openxmlformats-officedocument.wordprocessingml.document |
| PowerPoint | application/vnd.openxmlformats-officedocument.presentationml.presentation |
| Excel | application/vnd.openxmlformats-officedocument.spreadsheetml.sheet |
စာရွက်စာတမ်းသည် ပုံကဲ့သို့ user message ၏ အစိတ်အပိုင်းတစ်ခု ဖြစ်သည်-
| Endpoint | Request အတွင်းတွင် (base64 ဖြင့်) | လိပ်စာဖြင့် |
|---|---|---|
/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."}
]
}
]
} {
"model": "shannon-3",
"input": [
{
"role": "user",
"content": [
{
"type": "input_file",
"file_data": "data:application/pdf;base64,JVBERi0xLjcKJeLjz9MK…"
},
{
"type": "input_text",
"text": "Summarise this report in five points."
}
]
}
]
} {
"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."}
]
}
]
} - ဖိုင်၏ အစစ်အမှန် media type ကို ပေးပါ။ မပေးလျှင် စာရွက်စာတမ်းကို
application/pdfအဖြစ် ဖတ်သည်။ - CSV ကဲ့သို့ plain-text ဖိုင်ကို စာသားအဖြစ် ဖတ်ပြီး ထိုနည်းတူ တွဲထည့်သည်။
- စာရွက်စာတမ်းကို ဖတ်၍မရလျှင် သို့မဟုတ် ဖိုင်သည် အခြားအမျိုးအစားဖြစ်လျှင် model ကို ပြောပြပြီး ၎င်းသည် အဖြေထဲတွင် ပြောနိုင်သည်။ status မှာ
200ပင်ဖြစ်သည်။ - အခြား model တိုင်းတွင် စာရွက်စာတမ်းအပိုင်းကို model ဖတ်သည့်အရာမှ ချန်လှပ်ထားပြီး request ကို ကျန်သည့်အပိုင်းဖြင့် ဖြေကြားသည်။
- လိပ်စာဖြင့် ပို့သော စာရွက်စာတမ်းကို အထက်ပါ remote ဖိုင်ကန့်သတ်ချက်များအောက်တွင် ရယူသည်။
အမှားများ
| Status | Type | မက်ဆေ့ချ် | ဖြစ်ပေါ်ချိန် |
|---|---|---|---|
400 | invalid_request_error | <id> does not accept image input | စာသားကိုသာ လက်ခံသော host လုပ်ထားသည့် open-weight model သို့ ပုံတစ်ပုံ ပို့ခဲ့သည်။ သင့်လက်ကျန်ငွေမှ ဘာမှ မနုတ်ပါ။ |
400 | invalid_request_error | audio and video input are not supported by any hosted model | အသံ သို့မဟုတ် ဗီဒီယို အစိတ်အပိုင်းကို host လုပ်ထားသော open-weight model သို့ ပို့ခဲ့သည်။ |
413 | invalid_request_error | Failed to buffer the request body: … | inline ဖိုင်များပါသော request body သည် 32 MiB ထက် ပိုကြီးသည်။ အမှားတွင် code: "request_too_large" ပါသည်။ |
Shannon model သည် request တွင် မည်သည့်ဖိုင်ပါပါ status 200 ဖြင့် ဖြေသည်- မဖတ်သော အပိုင်းကို ချန်လှပ်ထားသည်။ အမှားကိုင်တွယ်မှု