Fò lọ sí àkóónú
Anthropic kika

Anthropic kika

POST /v1/messages ń gba ìbéèrè ní format Anthropic Messages, ó sì ń dáhùn ní format kan náà, yálà pẹ̀lú streaming tàbí láìsí. Lò ó pẹ̀lú Anthropic SDK àti pẹ̀lú àwọn irinṣẹ́ tí a kọ́ lé e lórí, bíi Claude Code: ṣètò base URL, lo Shannon API key rẹ, kí o sì dárúkọ id model Shannon kan.

POST https://api.shannon-ai.com/v1/messages

Darí Anthropic SDK sí base URL Shannon. SDK náà máa ń fi /v1/messages kún un, ó sì máa ń fi key rẹ ránṣẹ́ nínú header x-api-key.

import anthropic

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

message = client.messages.create(
    model="shannon-3",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Say hello in one sentence."}],
)

for block in message.content:
    if block.type == "text":
        print(block.text)

Èsì náà jẹ́ ìfiránṣẹ́ tí content rẹ̀ jẹ́ àkójọ àwọn block. Fi type wọn wá àwọn block náà: nígbà tí model bá ronú, block àkọ́kọ́ ni thinking, text sì máa ń tẹ̀lé e.

200 JSON
{
  "id": "msg_5f0c1e7a9b3d4c62a8e1f07d2b46c9a3",
  "type": "message",
  "role": "assistant",
  "model": "shannon-3",
  "content": [
    {
      "type": "thinking",
      "thinking": "The user wants a greeting in one sentence. Keep it short and friendly."
    },
    {
      "type": "text",
      "text": "Hello, it is good to meet you."
    }
  ],
  "stop_reason": "end_turn",
  "usage": {
    "input_tokens": 1184,
    "output_tokens": 46
  }
}

Àwọn header

Header Iye Àpèjúwe
x-api-key YOUR_API_KEY API key rẹ. A tún ń gba Authorization: Bearer YOUR_API_KEY dípò rẹ̀.
content-type application/json Ó pọn dandan.
anthropic-version 2023-06-01 A ń gbà á, kò pọn dandan. Anthropic SDK máa ń fi 2023-06-01 ránṣẹ́; èsì ní format kan náà, iye yòówù kó jẹ́.
anthropic-beta A ń gbà á, kò pọn dandan.
x-request-id Kò pọn dandan. Id tìrẹ fún ìbéèrè náà. Ó máa ń padà wá láìyí padà lórí èsì; láìsí rẹ̀, èsì máa ń gbé id oní àmì hexadecimal 12.

Àwọn field ìbéèrè

messages nìkan ló pọn dandan. Column Ó ń ṣiṣẹ́ lórí ń dárúkọ àwọn model tí field kan ti ń yí èsì padà lórí wọn. Àwọn model open-weight tí a gbàlejò ni àwọn id méjìlá inú àkójọ model; ìdílé Shannon 3 ni shannon-3, shannon-3-pro, shannon-3.1 àti shannon-3.1-pro. Àwọn model àti iye owó

Field Irú Default Àpèjúwe Ó ń ṣiṣẹ́ lórí
model string shannon-1.6-lite Id model Shannon kan láti inú àkójọ model. Fi ránṣẹ́ pẹ̀lú gbogbo ìbéèrè. Ìbáramu kò ka lẹ́tà ńlá àti kékeré sí. Orúkọ mìíràn èyíkéyìí yóò dá 400 unknown model padà, nítorí náà irinṣẹ́ tó ń fi àwọn orúkọ model tirẹ̀ ránṣẹ́ gbọ́dọ̀ jẹ́ èyí tí a ṣètò sí id Shannon kan. Gbogbo model
messages array Ó pọn dandan. Ìjíròrò náà, ìfiránṣẹ́ tó pẹ́ jù lọ ló ṣáájú, pẹ̀lú àwọn role user àti assistant. Wo Àwọn ìfiránṣẹ́ àti content block nísàlẹ̀. Gbogbo model
system string | array Àwọn ìtọ́ni fún model: string, tàbí array àwọn block text. Wo System prompt nísàlẹ̀. Àwọn model open-weight tí a gbàlejò, shannon-1.6-*, shannon-2-*, shannon-coder-1
max_tokens integer 4096 Ààlà òkè èsì, ní token. Kò pọn dandan lórí endpoint yìí; Anthropic SDK máa ń fi ránṣẹ́ nígbà gbogbo. Iye tó bá wà lóde 1 sí 65,536 ni a máa gbé wọ inú ààlà yẹn. Òun náà ni iye tí a máa ń yà sọ́tọ̀ nínú balance rẹ nígbà tí ìbéèrè náà bá ń lọ lọ́wọ́. Àwọn model open-weight tí a gbàlejò, shannon-1.6-lite, shannon-1.6-pro, shannon-coder-1
stream boolean false true ń fi èsì ránṣẹ́ gẹ́gẹ́ bí server-sent events. Wo Streaming nísàlẹ̀. Gbogbo model
temperature number Sampling temperature. Lórí àwọn model open-weight tí a gbàlejò, a máa ń fi àwọn iye sí àárín 0 àti 2. Àwọn model open-weight tí a gbàlejò, shannon-1.6-lite, shannon-1.6-pro, shannon-coder-1
top_p number Nucleus sampling. Àwọn model open-weight tí a gbàlejò
stop_sequences array Títí dé string 4. Ìdáhùn máa ń parí ṣáájú èyí tó bá kọ́kọ́ hàn. stop_reason ṣì máa jẹ́ end_turn. Àwọn model open-weight tí a gbàlejò
tools array Àwọn tool tí model lè pè, ọ̀kọ̀ọ̀kan gẹ́gẹ́ bí {"name", "description", "input_schema"}. Wo Àwọn tool nísàlẹ̀. Gbogbo model
tool_choice object {"type": "auto"} ń jẹ́ kí model pinnu, {"type": "any"} ń mú kí ó pe tool kan, {"type": "tool", "name": "…"} ń mú kí ó pe tool yẹn. Àwọn model open-weight tí a gbàlejò
thinking object Bí model ṣe ń ronú tó kí ó tó dáhùn. Wo Ríronú nísàlẹ̀. Àwọn model open-weight tí a gbàlejò
web_search boolean false Àfikún Shannon sí format náà: true ń jẹ́ kí model wá nǹkan lórí web kí ó tó dáhùn. shannon-1.6-*, shannon-2-*, ìdílé Shannon 3

Láìsí max_tokens, iye náà jẹ́ 4,096, ó sì jẹ́ 65,536 lórí shannon-coder-1.

A ń gba metadata, top_k, service_tier àti àwọn àmì cache_control lórí àwọn block kí code client tó ti wà tẹ́lẹ̀ lè ṣiṣẹ́ láìyí padà. Wọn kì í yí èsì padà; caching prompt lórí àwọn model open-weight tí a gbàlejò ń ṣẹlẹ̀ fúnra rẹ̀.

Ìdáhùn JSON tó bá schema kan mu ni a máa ń béèrè pẹ̀lú response_format lórí Chat Completions àti pẹ̀lú text.format lórí Responses. Awọn igbejade ti a ṣeto

Ìbéèrè pẹ̀lú system prompt àti ríronú

Ìbéèrè yìí ń fi system prompt, budget ríronú, temperature àti stop sequence ránṣẹ́. Ó ń lo model open-weight tí a gbàlejò, èyí tó ń lo gbogbo wọn.

import anthropic

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

message = client.messages.create(
    model="DeepSeek-V4-Flash-0731-W4A16-AUTOROUND-REAP",
    max_tokens=4096,
    system="You are a physics teacher. Answer in two sentences.",
    thinking={"type": "enabled", "budget_tokens": 2048},
    temperature=0.3,
    stop_sequences=["\n\n"],
    messages=[{"role": "user", "content": "Why is the sky blue?"}],
)

for block in message.content:
    if block.type == "thinking":
        print("reasoning:", block.thinking)
    elif block.type == "text":
        print("answer:", block.text)
print(message.usage)

Lórí àwọn model open-weight tí a gbàlejò, usage ń jábọ̀ àwọn token tí a kà láti inú prompt cache lọ́tọ̀ sí àwọn token input yòókù.

200 JSON
{
  "usage": {
    "input_tokens": 31,
    "cache_read_input_tokens": 0,
    "cache_creation_input_tokens": 0,
    "output_tokens": 62
  }
}

System prompt

system jẹ́ string, tàbí array àwọn block text ní ìrísí [{"type": "text", "text": "…"}]. A máa ń fi line break so àwọn text inú àwọn block náà pọ̀.

Àwọn model open-weight tí a gbàlejò, shannon-1.6-lite, shannon-1.6-pro, shannon-2-lite, shannon-2-pro àti shannon-coder-1 ló ń lò ó. Pẹ̀lú id ìdílé Shannon 3, fi àwọn ìtọ́ni tó gbọ́dọ̀ dúró sínú ìfiránṣẹ́ olùmúlò.

Àwọn ìfiránṣẹ́ àti content block

Ìfiránṣẹ́ kan ní role, user tàbí assistant, àti content. content jẹ́ string, tàbí array àwọn block.

Block Àpèjúwe Ó wà lórí
{"type": "text", "text": "…"} Text. Gbogbo model
{"type": "image", "source": {"type": "base64", "media_type": "image/png", "data": "…"}}
{"type": "image", "source": {"type": "url", "url": "…"}}
Àwòrán nínú ìfiránṣẹ́ user, gẹ́gẹ́ bí base64 tàbí nípasẹ̀ URL. Ìdílé Shannon 3, shannon-1.6-lite, shannon-1.6-pro, àti àwọn model open-weight tí a gbàlejò tí wọ́n ní input àwòrán nínú àkójọ wọn
{"type": "document", "source": {"type": "base64", "media_type": "application/pdf", "data": "…"}} Ìwé àkọsílẹ̀ (PDF, Word, PowerPoint tàbí Excel) nínú ìfiránṣẹ́ user, gẹ́gẹ́ bí base64 tàbí nípasẹ̀ URL. Ìdílé Shannon 3
{"type": "tool_use", "id": "toolu_…", "name": "…", "input": {…}} Nínú ìfiránṣẹ́ assistant: ìpè tool tí model ṣe nínú èsì àtẹ̀yìnwá kan. Gbogbo model
{"type": "tool_result", "tool_use_id": "toolu_…", "content": "…"} Nínú ìfiránṣẹ́ user: àbájáde ìpè yẹn. content jẹ́ string, tàbí àkójọ àwọn block text. Gbogbo model

O lè fi content èsì àtẹ̀yìnwá kan ránṣẹ́ padà bó ṣe wà: a máa ń ka àwọn block text àti tool_use, a sì máa ń fo àwọn block thinking.

Lórí àwọn ìpele Shannon, a máa ń ka àwọn àwòrán àti ìwé àkọsílẹ̀ láti inú ìfiránṣẹ́ user tó kẹ́yìn. Àwọn ìwọ̀n àti ààlà ní ojú-ìwé tiwọn. Àwọn àwòrán àti fáìlì

Ríronú

Àwọn model open-weight tí a gbàlejò máa ń yí thinking padà sí ipa ìrònú kan. Láìsí field náà, ipa náà máa ga.

Bó ṣe rí budget_tokens Ohun tó ń ṣe
{"type": "disabled"} Kò sí ìrònú. Èsì náà kò ní block thinking.
{"type": "enabled", "budget_tokens": 2048} ≤ 2,048 Ipa kékeré.
{"type": "enabled", "budget_tokens": 8192} ≤ 8,192 Ipa àárín.
{"type": "enabled", "budget_tokens": 16000} > 8,192 Ipa gíga.

Model tó ń ronú máa ń dá ìrònú rẹ̀ padà gẹ́gẹ́ bí block {"type": "thinking", "thinking": "…"} níwájú text. Àwọn ìpele Shannon tó ń ronú náà máa ń fi ránṣẹ́.

A ṣàpèjúwe àwọn ipa náà lórí ojú-ìwé tiwọn. Ipa ìrònú

Àwọn tool

Tool jẹ́ function tí code rẹ máa ń mú ṣiṣẹ́. Ṣàpèjúwe ọ̀kọ̀ọ̀kan pẹ̀lú name, description àti input_schema. Nígbà tí model bá fẹ́ tool kan, èsì yóò ní block tool_use, stop_reason yóò sì jẹ́ tool_use.

Ìtumọ̀ tool kan nínú tools:

tools
[
  {
    "name": "get_weather",
    "description": "Current weather for a city.",
    "input_schema": {
      "type": "object",
      "properties": {
        "city": {
          "type": "string"
        }
      },
      "required": [
        "city"
      ]
    }
  }
]

content èsì tó pè é:

200 content
[
  {
    "type": "text",
    "text": ""
  },
  {
    "type": "tool_use",
    "id": "toolu_3d9a7c1e5b2f4a60c8e1d7f09b24a6c5",
    "name": "get_weather",
    "input": {
      "city": "Paris"
    }
  }
]

Mú tool náà ṣiṣẹ́, lẹ́yìn náà tún fi ìbéèrè náà ránṣẹ́ pẹ̀lú ìpè náà àti block tool_result tí a fi kún messages:

messages
[
  {
    "role": "user",
    "content": "What is the weather in Paris?"
  },
  {
    "role": "assistant",
    "content": [
      {
        "type": "tool_use",
        "id": "toolu_3d9a7c1e5b2f4a60c8e1d7f09b24a6c5",
        "name": "get_weather",
        "input": {
          "city": "Paris"
        }
      }
    ]
  },
  {
    "role": "user",
    "content": [
      {
        "type": "tool_result",
        "tool_use_id": "toolu_3d9a7c1e5b2f4a60c8e1d7f09b24a6c5",
        "content": "{\"temperature_c\": 18, \"sky\": \"cloudy\"}"
      }
    ]
  }
]

tool_choice

Bó ṣe rí Ohun tó ń ṣe Ó ń ṣiṣẹ́ lórí
{"type": "auto"} Model ló máa pinnu bóyá kí ó pe tool kan. Èyí ni default. Gbogbo model
{"type": "any"} Model gbọ́dọ̀ pe ọ̀kan nínú àwọn tool náà. Àwọn model open-weight tí a gbàlejò
{"type": "tool", "name": "…"} Model gbọ́dọ̀ pe tool tí a dárúkọ. Àwọn model open-weight tí a gbàlejò

Àwọn tool tó ní input_schema nìkan ni a máa ń kà. Wíwá lórí web kì í ṣe tool lórí endpoint yìí: ṣètò field web_search.

A ṣàpèjúwe tool loop ní kíkún lórí ojú-ìwé tirẹ̀. Ipe iṣẹ

Èsì náà

Field Irú Àpèjúwe Ẹni tó rán an
id string msg_ tí àmì hexadecimal 32 tẹ̀lé. Gbogbo model
type string message nígbà gbogbo. Gbogbo model
role string assistant nígbà gbogbo. Gbogbo model
model string Id canonical ti model tó dáhùn. Gbogbo model
content array Àwọn block èsì náà, ní ìtòlẹ́sẹẹsẹ yìí: thinking nígbà tí model bá ronú, text, lẹ́yìn náà tool_use kan fún ìpè tool kọ̀ọ̀kan. Gbogbo model
stop_reason string Ìdí tí èsì fi parí. Wo àwọn iye nísàlẹ̀. Gbogbo model
usage object input_tokens àti output_tokens. Gbogbo model
sources array Lórí ìbéèrè tó ní web_search: true nìkan, tí ìwádìí rẹ̀ rí nǹkan: àwọn abajade tí a fún model, kọ̀ọ̀kan pẹ̀lú index, title àti url. [1] nínú ìdáhùn ni ẹnu-ọ̀nà tí index rẹ̀ jẹ́ 1. Nínú stream, ó wá pẹ̀lú event message_delta. shannon-1.6-*, shannon-2-*, ìdílé Shannon 3
usage.cache_read_input_tokens integer cache_read_input_tokens ni apá prompt tí a kà láti inú cache; input_tokens ni ìyókù. cache_creation_input_tokens máa ń jẹ́ 0 nígbà gbogbo. Àwọn model open-weight tí a gbàlejò

Àwọn block èsì

Block Àpèjúwe
{"type": "thinking", "thinking": "…"} Ìrònú model náà. Kò sí member signature.
{"type": "text", "text": "…"} Text ìdáhùn náà. Ó lè ṣófo nígbà tí èsì bá jẹ́ ìpè tool.
{"type": "tool_use", "id": "toolu_…", "name": "…", "input": {…}} Ìpè tool. input jẹ́ JSON object. Fi àbájáde rẹ̀ ránṣẹ́ padà pẹ̀lú id kan náà.

stop_reason

stop_reason Àpèjúwe Ẹni tó rán an
end_turn Model parí ìdáhùn rẹ̀, tàbí ọ̀kan nínú àwọn stop_sequences rẹ hàn. Gbogbo model
tool_use Èsì náà ní ìpè tool kan tàbí jù bẹ́ẹ̀ lọ. Gbogbo model
max_tokens A gé èsì náà ní ààlà output. Ìdílé Shannon 3, shannon-1.6-lite, shannon-1.6-pro, shannon-coder-1, nínú àwọn stream

Streaming

Ṣètò stream sí true fún server-sent events. Frame kọ̀ọ̀kan ní ìlà event: pẹ̀lú orúkọ event náà àti ìlà data: pẹ̀lú JSON object tó tún orúkọ náà sọ nínú type. Àwọn stream helper ti Anthropic SDK máa ń ka àwọn event wọ̀nyí fún ọ:

import anthropic

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

with client.messages.stream(
    model="shannon-3",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Explain server-sent events in three sentences."}],
) as stream:
    for text in stream.text_stream:
        print(text, end="", flush=True)
    message = stream.get_final_message()

print()
print(message.stop_reason, message.usage)

Àwọn event náà, ní ìtòlẹ́sẹẹsẹ tí wọ́n ń dé:

Event Data Ìgbà
message_start message Òun ló máa ń ṣáájú nígbà gbogbo. message ní id, role, model, content tó ṣófo àti usage tó bẹ̀rẹ̀ láti òdo.
content_block_start index, content_block Block kan ṣí. content_block jẹ́ block text tàbí thinking tó ṣófo, tàbí block tool_use pẹ̀lú id àti name rẹ̀.
content_block_delta index, delta {"type": "thinking_delta", "thinking"} Apá kan ìrònú, fún block thinking.
content_block_delta index, delta {"type": "text_delta", "text"} Apá kan ìdáhùn, fún block text.
content_block_delta index, delta {"type": "input_json_delta", "partial_json"} Àwọn argument ìpè tool kan, tó pé nínú delta kan ṣoṣo, fún block tool_use.
content_block_stop index Block tó ní index yìí ti parí.
message_delta delta {stop_reason, stop_sequence}, usage Ìparí èsì náà: delta.stop_reason, àti usage ìbéèrè náà.
message_stop Òun ló máa ń kẹ́yìn nígbà gbogbo.

A máa ń fi index ka àwọn block ní ìtòlẹ́sẹẹsẹ tí wọ́n ṣí, block kan sì máa ń parí kí èyí tó kàn tó ṣí. Ka block kọ̀ọ̀kan nípa irú rẹ̀, kì í ṣe nípa nọ́ńbà rẹ̀: stream lè kọ́kọ́ ṣí block text tó ṣófo, lẹ́yìn náà block thinking, kí ó sì fi ìdáhùn jíṣẹ́ nínú block text tó tẹ̀lé e.

200 text/event-stream
event: message_start
data: {"type":"message_start","message":{"id":"msg_5f0c…","type":"message","role":"assistant","model":"shannon-3","content":[],"usage":{"input_tokens":0,"output_tokens":0}}}

event: content_block_start
data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""}}

event: content_block_stop
data: {"type":"content_block_stop","index":0}

event: content_block_start
data: {"type":"content_block_start","index":1,"content_block":{"type":"thinking","thinking":""}}

event: content_block_delta
data: {"type":"content_block_delta","index":1,"delta":{"type":"thinking_delta","thinking":"Three sentences: what it is, how it is framed, why it is used."}}

event: ping
data: {"type": "ping"}

event: content_block_stop
data: {"type":"content_block_stop","index":1}

event: content_block_start
data: {"type":"content_block_start","index":2,"content_block":{"type":"text","text":""}}

event: content_block_delta
data: {"type":"content_block_delta","index":2,"delta":{"type":"text_delta","text":"Server-sent events let a server push text over one HTTP reply."}}

event: content_block_stop
data: {"type":"content_block_stop","index":2}

event: message_delta
data: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":1190,"output_tokens":84}}

event: message_stop
data: {"type":"message_stop"}

Keep-alive

Ẹni tó rán an Àpèjúwe
Ìdílé Shannon 3, shannon-1.6-lite, shannon-1.6-pro, shannon-coder-1 Event ping pẹ̀lú data {"type": "ping"}, ní gbogbo ìṣẹ́jú-àáyá 15.
Àwọn model open-weight tí a gbàlejò Ìlà comment : keepalive, ní gbogbo ìṣẹ́jú-àáyá 15 nígbà tí model bá ń ṣiṣẹ́.

Stream tó kùnà

Ìkùnà lẹ́yìn tí stream ti bẹ̀rẹ̀ jẹ́ event error pẹ̀lú body kan náà bíi ti èsì àṣìṣe: {"type": "error", "error": {"type", "message"}}. Àwọn event ìparí, message_delta àti message_stop, ṣì máa ń tẹ̀lé e. Ka èsì náà sí èyí tó kùnà, kí o sì tún fi ìbéèrè náà ránṣẹ́.

Àwọn àṣìṣe

Àwọn àṣìṣe ń lo body àṣìṣe Anthropic: type jẹ́ error, object error sì ní type àti message nínú. Tábìlì yìí to àwọn ohun tí endpoint yìí máa ń dá padà jù lọ. Àkójọ kíkún, pẹ̀lú àwọn tó yẹ kí o tún gbìyànjú, ní ojú-ìwé tirẹ̀. Mimu Aṣiṣe

400 JSON
{
  "type": "error",
  "error": {
    "type": "invalid_request_error",
    "message": "unknown model: no-such-model"
  }
}
Ipò Irú Ìfiránṣẹ́ Ìgbà
401 authentication_error Missing authentication
Invalid API key
A kò fi API key kankan ránṣẹ́, tàbí key náà jẹ́ àìmọ̀ tàbí a ti wọ́gi lé e.
400 invalid_request_error unknown model: <id> model kì í ṣe id model Shannon.
400 invalid_request_error No user message provided Àwọn ìpele Shannon: ìbéèrè náà kò ní text olùmúlò, kò sì ní tools.
400 invalid_request_error <id> does not accept image input A fi àwòrán ránṣẹ́ sí model open-weight tí a gbàlejò tí kò ní input àwòrán.
422 invalid_request_error Failed to deserialize the JSON body into the target type: … messages kò sí, tàbí field kan ní irú JSON tí kò tọ́.
429 rate_limit_error Quota exceeded. Upgrade your plan at shannon-ai.com/plan max_tokens tóbi ju ohun tó kù nínú balance rẹ lọ.
429 rate_limit_error Too many requests. Retry in <n>s. Ààbò flood: ó ju ìbéèrè 120 lọ láàárín ìṣẹ́jú kan lórí account rẹ.
429 rate_limit_error Shannon Coder call quota reached. Upgrade your plan at shannon-ai.com/plan shannon-coder-1: àwọn ìpè Shannon Coder ti plan rẹ fún sáà wákàtí 4 tó ń lọ lọ́wọ́ ti tán.
500 server_error The model backend failed to answer. Please retry. Model kò mú èsì kankan jáde. Tún fi ìbéèrè náà ránṣẹ́.
502 api_error The model backend failed to answer. Please retry. Model kò mú èsì kankan jáde. Tún fi ìbéèrè náà ránṣẹ́.

Kíkà token

POST /v1/messages/count_tokens ń gba body kan náà pẹ̀lú ìbéèrè message (model, system, messages, tools), ó sì ń dá {"input_tokens": n} padà: iye token input tí a máa gba owó rẹ̀ fún ìbéèrè náà. Ó ń kà fún àwọn model open-weight tí a gbàlejò, ọ̀fẹ́ ni, ààbò flood kò sì kà á.

import anthropic

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

count = client.messages.count_tokens(
    model="DeepSeek-V4-Flash-0731-W4A16-AUTOROUND-REAP",
    system="You are a physics teacher. Answer in two sentences.",
    messages=[{"role": "user", "content": "Why is the sky blue?"}],
)

print(count.input_tokens)

Kíkà token ní ojú-ìwé tirẹ̀, pẹ̀lú endpoint plain-text àti àwọn ààlà. Kíka token