Tlola ho ea ho litaba
Anthropic SDK

Li-framework le li-SDK

Sebelisa Anthropic SDK le Shannon

Boloka Anthropic SDK: seta base_url ho Shannon, fetisa senotlolo sa hau, 'me u bitse li-model tsa Shannon ka Messages API.

  • E lekiloe 2026 Pun 7
  • Anthropic Messages
  • Metsotso e ka bang 1

Mabapi le Anthropic SDK

Anthropic SDK ke client ea semmuso ea Messages API, e sebelisoang ke li-app le li-agent tse hahetsoeng Claude. Shannon e sebeletsa API e ts'oanang ho /v1/messages, kahoo code e ngotsoeng bakeng sa SDK e sebetsa ho li-model tsa Shannon ka mor'a liphetoho tse peli: base URL le senotlolo. Streaming, tool use le system prompts li sebetsa ka tsela e ts'oanang.

Seo u se hlokang

Senotlolo sa API sa Shannon
Linotlolo le tšebeliso
Base URL
https://api.shannon-ai.com Endpoint: /v1/messages
Snippet e 'ngoe le e 'ngoe e ka tlase e latela khetho ea hau.

E hlophise

  1. Kenya SDK

    pip install anthropic
  2. E supe ho Shannon 'me u etse streaming

    Base URL ha e na /v1: SDK e ikekelletsa /v1/messages. max_tokens e a hlokahala, joaloka ho 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. Bitsa li-tool

    Tool calls li khutla e le li-block tsa tool_use ka 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'}]

Hlahloba hore e a sebetsa

Romela: Tsamaisa sampole ea streaming.

U lokela ho bona: Mebala e hatisoa ha e ntse e fihla.

Li-model tse loketseng Anthropic SDK

Id e 'ngoe le e 'ngoe e ka tlase e khotsofatsa seo Anthropic SDK e se hlokang. Ea pele ke default ho li-snippet.

Id ea modelFensetere ea contextTsoa e kholo ka ho fetisisaKenyo ea setšoantšo
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 Che

Ho molemo ho tseba

  • base_url ke https://api.shannon-ai.com ntle le /v1; ka /v1 SDK e bitsa /v1/v1/messages 'me e fumana 404.
  • SDK e romela senotlolo e le x-api-key; Shannon e boetse e amohela Authorization: Bearer.
  • Sebelisa li-id tsa li-model tsa Shannon ho tsoa ho GET /v1/models; li-id tsa Claude ha li sebeletsoe.

Malebela

  1. SDK e boetse e bala ANTHROPIC_BASE_URL le ANTHROPIC_API_KEY, kahoo code e teng e ka fetohela ka li-environment variable tse peli.
  2. Li-tool tse hahetsoeng Claude, tse kang Claude Code le li-agent tsa Claude Agent SDK, li sebelisa endpoint e ts'oanang.
  3. Ho TypeScript likhetho ke baseURL le apiKey.

Ho rarolla mathata

MatšoaoLebakaTokiso
404 Not Found base_url e qetella ka /v1. Sebelisa https://api.shannon-ai.com.
400 unknown model Id ea model ea Claude. Sebelisa id ea Shannon ho tsoa ho GET /v1/models.
401 Unauthorized Senotlolo ha se eo, se ngotsoe hampe kapa se fetotsoe. Kopitsa senotlolo hape ho tsoa ho Keys & usage; se qala ka sk-.
context_length_exceeded / “prompt is too long” Puisano e telele ho feta window ea model. Qala chat e ncha, tlohela tool e e compact, kapa khetha model e nang le window e kholoanyane.
insufficient_quota Balance ea hau e ke ke ea lefella kopo. Eketsa credit kapa fetola plan; kopo ha e lekoe hape ka boeona.

Lipotso

Na Anthropic SDK e sebetsa le Shannon?

E. Shannon e sebeletsa Messages API ho https://api.shannon-ai.com/v1/messages; seta base_url ho https://api.shannon-ai.com.

Na streaming le tool use li a sebetsa?

E, ka bobeli; re tsamaisitse stream le tool call ka Python SDK.

Kgetha puo ya hao

Dipuo tsohle di lekana. Kgetha eo o batlang ho e sebedisa ha o bala.

Yuropa

Middle East le Afrika Leboea

Asia Boroa

Asia Boroa-Botjhabela

Asia Botjhabela

Asia e Bohareng le Caucasus

Afrika

Oceania

Lipuo tse Entsoeng le tsa Khale