Peke ki ngā ihirangi
Anthropic SDK

Ngā framework me ngā SDK

Whakamahia a Anthropic SDK me Shannon

Kia mau ki te SDK Anthropic: tautuhia te base_url ki a Shannon, tukuna tō key, ka karanga i ngā model Shannon mā te Messages API.

  • I whakamātauria 7 Noe 2026
  • Anthropic Messages
  • Tata ki te 1 meneti

Mō Anthropic SDK

Ko te SDK Anthropic te kiritaki whaimana mō te Messages API, e whakamahia ana e ngā taupānga me ngā kaiwhakaahei i hangaia mō Claude. Ka whakahaere a Shannon i taua API ōrite i te /v1/messages, no reira ka rere te waehere i tuhia mō te SDK i runga i ngā model Shannon whai muri i ngā huringa e rua: te base URL me te key. Ka mahi pēnei ano te rere, te whakamahi tool me ngā tohutohu pūnaha.

Ngā mea e hiahiatia ana

He API key Shannon
Ngā kī me te whakamahinga
URL pūtake
https://api.shannon-ai.com Pito mutunga: /v1/messages
Ka whai ia wāhanga waehere i raro iho i tō kōwhiringa.

Whakaritea

  1. Whakaurua te SDK

    pip install anthropic
  2. Tohua ki a Shannon ka rere

    Kāore he /v1 i te base URL: ka tāpiri te SDK i te /v1/messages mā tōna ake. Hiahiatia ana te max_tokens, pēnei i a Claude.

    Python
    from anthropic import Anthropic
    
    client = Anthropic(base_url="https://api.shannon-ai.com", api_key="YOUR_API_KEY")
    
    with client.messages.stream(
        model="Kimi-K3-uncensored-NVFP4",
        max_tokens=1024,
        messages=[{"role": "user", "content": "Name three colours a cat can be."}],
    ) as stream:
        for text in stream.text_stream:
            print(text, end="", flush=True)
  3. Karanga i ngā tool

    Ka hoki mai ngā karanga tool hei poraka tool_use me te stop_reason: "tool_use".

    Python
    r = client.messages.create(
        model="Kimi-K3-uncensored-NVFP4",
        max_tokens=1024,
        tools=[{
            "name": "get_weather",
            "description": "Weather for a city",
            "input_schema": {"type": "object", "properties": {"city": {"type": "string"}}, "required": ["city"]},
        }],
        messages=[{"role": "user", "content": "What is the weather in Oslo?"}],
    )
    print(r.stop_reason)  # tool_use
    print([b.input for b in r.content if b.type == "tool_use"])  # [{'city': 'Oslo'}]

Tirohia kei te mahi

Tukuna: Whakahaerehia te tauira rere.

Me kite koe i: Ka taia ngā tae i a rātou e rere mai ana.

Ngā model e hāngai ana ki Anthropic SDK

Ka tutuki i ia id i raro iho ngā hiahia o Anthropic SDK. Ko te tuatahi te taunoa i ngā wāhanga waehere.

Id tauiraMatapihi horopakiOutput nui rawaInput whakaahua
Kimi-K3-uncensored-NVFP4 1,022,976 262,144 Āe
Kimi-K3-uncensored-3BIT-REAP 225,280 225,280 Āe
shannon-3 196,608 65,536 Āe
shannon-coder-1 131,072 65,536 Kāo

He pai kia mōhio

  • Ko te base_url ko https://api.shannon-ai.com kāore he /v1; mēnā he /v1, ka karanga te SDK i te /v1/v1/messages ka whiwhi i te 404.
  • Ka tuku te SDK i te key hei x-api-key; ka whakaae hoki a Shannon i te Authorization: Bearer.
  • Whakamahia ngā id model Shannon mai i te GET /v1/models; kāore ngā id Claude e whakahaeretia.

Ngā tohutohu

  1. Ka pānui hoki te SDK i te ANTHROPIC_BASE_URL me te ANTHROPIC_API_KEY, no reira ka taea e te waehere o nāianei te whakawhiti mā ngā taurangi taiao e rua.
  2. Ka whakamahi ngā taputapu i hangaia mō Claude, pēnei i a Claude Code me ngā kaiwhakaahei i runga i te Claude Agent SDK, i te endpoint ōrite.
  3. I TypeScript ko ngā kōwhiringa ko baseURL me apiKey.

Te whakatika raruraru

TohuTakeWhakatika
404 Not Found Ka mutu te base_url ki te /v1. Whakamahia https://api.shannon-ai.com.
400 unknown model He id model Claude. Whakamahia tētahi id Shannon mai i te GET /v1/models.
401 Unauthorized Kei te ngaro te key, kua hē te pato, kua hurihia rānei. Tāruatia anō te key mai i Keys & usage; ka tīmata ki te sk-.
context_length_exceeded, te karere "prompt is too long" rānei He roa ake te kōrero i te matapihi horopaki o te model. Tīmatahia he kōrerorero hou, tukuna te taputapu kia whakamāmā, kōwhiria rānei he model he nui ake te matapihi.
insufficient_quota Kāore e rawaka tō toenga hei utu i te tono. Tāpiri nama, huri mahere rānei; kāore te tono e ngana anō ko ia anake.

Ngā pātai

Ka mahi te SDK Anthropic me Shannon?

Āe. Ka whakahaere a Shannon i te Messages API ki https://api.shannon-ai.com/v1/messages; tautuhia te base_url ki https://api.shannon-ai.com.

Ka mahi te rere me te whakamahi tool?

Āe, ngā mea e rua; i whakahaere mātou i tētahi rere me tētahi karanga tool mā te SDK Python.

Kōwhiria tō reo

He ōrite ngā reo katoa. Kōwhiria te reo e hiahia ana koe ki te whakamahi.

Ūropi

Te Rāwhiti Waenga me Āwherika ki te Raki

Āhia ki te Tonga

Āhia ki te Tonga-ma-Rāwhiti

Āhia ki te Rāwhiti

Āhia Waenga me Kōkahu

Āwherika

Te Moana-nui-a-Kiwa

Reo Hanga me te Reo Tawhito