Dealbhan agus faidhlichean
Cuir dealbhan le teachdaireachd: dè na modailean a ghabhas riutha, na cruthan a tha air an aontachadh agus na crìochan aca.
POST https://api.shannon-ai.com/v1/chat/completions
Siubhlaidh dealbh am broinn teachdaireachd neach-cleachdaidh, mar aon phàirt dhen content aige. Leughaidh an sampall faidhle ionadail agus cuiridh e e mar 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
}
} Dè na modailean a ghabhas dealbhan
| Modailean | A’ leughadh |
|---|---|
shannon-3, shannon-3-pro, shannon-3.1, shannon-3.1-pro | Dealbhan, agus sgrìobhainnean: PDF, Word, PowerPoint, Excel agus faidhlichean teacsa lom. |
shannon-1.6-lite, shannon-1.6-pro | Dealbhan. |
shannon-2-lite, shannon-2-pro | Dealbhan, ann an iarrtasan a chuireas tools no response_format cuideachd. |
Kimi-K3-3BIT-REAP, MiniMax-M3-3BIT-REAP, Kimi-K2.6-W4A16-AUTOROUND-REAP, inkling-W4A16-AUTOROUND-REAP, MiMo-V2.5-W8A16 | Dealbhan. |
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 | Teacsa. Thèid iarrtas le dealbh a fhreagairt le staid 400. |
shannon-coder-1 | Teacsa. |
Bheir GET /v1/models cunntas air input dealbh gach id mar capabilities.vision. Modailean & prìsean
- Leughaidh na modailean Shannon faidhlichean na teachdaireachd neach-cleachdaidh mu dheireadh. Cuir an dealbh anns an teachdaireachd a dh’fhaighneachdas mu dheidhinn.
- Bidh teaghlach Shannon 3 cuideachd a’ cumail beagan dhealbhan is sgrìobhainnean de theachdaireachdan neach-cleachdaidh na bu thràithe ann an sealladh nuair a chaidh an cur inline, agus a’ leughadh uas-àireamh stèidhichte de dhealbhan gach iarrtas, air an cunntadh o chiad fhear.
- Leughaidh na modailean open-weight hosted dealbhan gach teachdaireachd dhen chòmhradh.
Cruthan a tha air an aontachadh
Thèid faidhle a chur ann an aon de dhà dhòigh: am broinn an iarrtais mar base64, no mar sheòladh a gheibh an API. Bidh gach faidhle a’ siubhal leis an iarrtas; chan eil endpoint luchdaidh suas aig an API.
| Endpoint | San iarrtas (base64) | Le seòladh |
|---|---|---|
/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://…"}} |
An aon teachdaireachd neach-cleachdaidh anns gach cruth:
{
"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…"
}
}
]
} - Tha an cruth
data:<media type>;base64,<data>aig data URL. Tha am pàirt;base64riatanach. - Air
/v1/chat/completionsagus/v1/responses, faodaidhimage_urla bhith na shreang fhèin no na nì{"url": "…"}. - Thig seòrsa an fhaidhle on data URL no o
media_type. Às aonais, thèid dealbh a leughadh marimage/png. - Cunntaidh faidhlichean inline a dh’ionnsaigh meud bodhaig an iarrtais, a dh’fhaodas a bhith suas gu 32 MiB.
- Air aontachadh airson co-chòrdalachd:
image_url.detail.
Crìochan airson faidhlichean cèin
Nuair a chuireas tu seòladh, gheibh an API am faidhle mus ruith am modail, taobh a-staigh nan crìochan seo:
| Crìoch | Riaghailt |
|---|---|
| Meud | Suas gu 8 MiB gach faidhle. |
| Ùine | 20 diog airson freagairt. |
| Ath-stiùiridhean | 5 aig a’ char as motha. |
| Seòladh | http:// no https://, gun ainm-cleachdaidh no facal-faire anns an t-seòladh, air host le seòladh poblach. |
| Freagairt an host | Staid anns an raon 200 agus bodhaig nach eil falamh. Thèid seòrsa an fhaidhle a leughadh o Content-Type. |
| Iarraidh mar | User-Agent: ShannonBot/1.0 (+https://shannon-ai.com) |
Mar a chunntar dealbhan ann an tokens
Air na modailean open-weight hosted cunntaidh dealbh aon token airson gach pìos 28 × 28 piogsail: an leud air a roinn le 28, air a chruinneachadh suas, uair an àirde air a roinn le 28, air a chruinneachadh suas. Tha an toradh na phàirt de usage.prompt_tokens agus thèid a bhilleadh mar input.
- 1024 × 1024
- 1,369 tokens
- 1920 × 1080
- 2,691 tokens
- 512 × 512
- 361 tokens
- Thèid dealbh cèin fhaighinn an toiseach, agus mar sin thèid a fhìor mheud a chunntadh.
- Cunntaidh dealbh nach gabh a mheud a leughadh 1,024 tokens.
- Cleachdaidh na h-endpoints cunntais an aon riaghailt airson data URLs. Chan fhaigh iad seòladh cèin agus cunntaidh iad e mar 1,024 tokens. Cunntadh tokens
- Airson modail Shannon, leugh dè a chosg iarrtas le dealbhan o
usagesan fhreagairt.
Sgrìobhainnean agus faidhlichean eile
Leughaidh teaghlach Shannon 3 (shannon-3, shannon-3-pro, shannon-3.1, shannon-3.1-pro) sgrìobhainnean cuideachd. Thèid teacsa na sgrìobhainn a thoirt a-mach agus a thoirt dhan mhodail còmhla ris an teachdaireachd agad.
| Sgrìobhainn | Seòrsa meadhain |
|---|---|
application/pdf | |
| Word | application/vnd.openxmlformats-officedocument.wordprocessingml.document |
| PowerPoint | application/vnd.openxmlformats-officedocument.presentationml.presentation |
| Excel | application/vnd.openxmlformats-officedocument.spreadsheetml.sheet |
Tha sgrìobhainn na pàirt dhen teachdaireachd neach-cleachdaidh, mar dhealbh:
| Endpoint | San iarrtas (base64) | Le seòladh |
|---|---|---|
/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."}
]
}
]
} - Thoir seòrsa meadhain fìor an fhaidhle. Às aonais, thèid sgrìobhainn a leughadh mar
application/pdf. - Thèid faidhle teacsa lom, leithid CSV, a leughadh mar theacsa agus a cheangal san aon dòigh.
- Nuair nach gabh sgrìobhainn a leughadh, no nuair as ann de sheòrsa eile a tha am faidhle, thèid innse dhan mhodail agus faodaidh e sin a ràdh na fhreagairt. Tha an staid fhathast
200. - Air gach modail eile thèid pàirt sgrìobhainn fhàgail a-mach às na leughas am modail, agus thèid an t-iarrtas a fhreagairt on chòrr.
- Thèid sgrìobhainn a chuirear le seòladh fhaighinn fo na crìochan airson faidhlichean cèin gu h-àrd.
Mearachdan
| Staid | Seòrsa | Teachdaireachd | Cuin |
|---|---|---|---|
400 | invalid_request_error | <id> does not accept image input | Chaidh dealbh a chur gu modail open-weight hosted nach gabh ach teacsa. Chan eil dad air a tharraing às do bhalance. |
400 | invalid_request_error | audio and video input are not supported by any hosted model | Chaidh pàirt claisneachd no bhidio a chur gu modail open-weight hosted. |
413 | invalid_request_error | Failed to buffer the request body: … | Tha bodhaig an iarrtais, le na faidhlichean inline aige, nas motha na 32 MiB. Tha code: "request_too_large" sa mhearachd. |
Freagraidh modail Shannon le staid 200 ge bith dè na faidhlichean a tha san iarrtas: thèid pàirt nach leugh e fhàgail a-mach. Làimhseachadh mearachd