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.comEndpoint:/v1/messages - Snippet e 'ngoe le e 'ngoe e ka tlase e latela khetho ea hau.
E hlophise
-
Kenya SDK
pip install anthropicnpm install @anthropic-ai/sdk -
E supe ho Shannon 'me u etse streaming
Base URL ha e na
/v1: SDK e ikekelletsa/v1/messages.max_tokense a hlokahala, joaloka ho Claude.Pythonfrom 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) -
Bitsa li-tool
Tool calls li khutla e le li-block tsa
tool_usekastop_reason: "tool_use".Pythonr = 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 model | Fensetere ea context | Tsoa e kholo ka ho fetisisa | Kenyo 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_urlkehttps://api.shannon-ai.comntle le/v1; ka/v1SDK e bitsa/v1/v1/messages'me e fumana404.- SDK e romela senotlolo e le
x-api-key; Shannon e boetse e amohelaAuthorization: Bearer. - Sebelisa li-id tsa li-model tsa Shannon ho tsoa ho
GET /v1/models; li-id tsa Claude ha li sebeletsoe.
Malebela
- SDK e boetse e bala
ANTHROPIC_BASE_URLleANTHROPIC_API_KEY, kahoo code e teng e ka fetohela ka li-environment variable tse peli. - Li-tool tse hahetsoeng Claude, tse kang Claude Code le li-agent tsa Claude Agent SDK, li sebelisa endpoint e ts'oanang.
- Ho TypeScript likhetho ke
baseURLleapiKey.
Ho rarolla mathata
| Matšoao | Lebaka | Tokiso |
|---|---|---|
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.