Mandrosoa any amin'ny votoaty
Anthropic SDK

Framework sy SDK

Ampiasao amin'i Shannon ny Anthropic SDK

Tazony ny SDK Anthropic: apetraho any amin'i Shannon ny base_url, ampio ny key-nao, ary antsoy ny model Shannon amin'ny Messages API.

  • Notsapaina tamin'ny 7 Nov 2026
  • Anthropic Messages
  • Manodidina ny 1 min

Momba ny Anthropic SDK

Ny SDK Anthropic dia ny client ofisialy ho an'ny Messages API, ampiasain'ny application sy agent natao ho an'i Claude. Shannon dia manome ny API mitovy ao amin'ny /v1/messages, ka mandeha amin'ny model Shannon ny code nosoratana ho an'ny SDK aorian'ny fanovana roa: ny base URL sy ny key. Mitovy ny fandehany amin'ny streaming, tool use ary system prompt.

Izay ilainao

API key Shannon
Fanalahidy sy fampiasana
Base URL
https://api.shannon-ai.com Endpoint: /v1/messages
Manaraka ny safidinao ny ohatra rehetra etsy ambany.

Fametrahana

  1. Apetraho ny SDK

    pip install anthropic
  2. Ampitondrao any amin'i Shannon ary manaova stream

    Tsy misy /v1 ny base URL: ny SDK mihitsy no manampy ny /v1/messages. Ilaina ny max_tokens, tahaka ny amin'i 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. Miantso tool

    Miverina ho block tool_use miaraka amin'ny stop_reason: "tool_use" ny antso tool.

    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'}]

Hamarino fa miasa

Alefaso: Alefaso ny santionany streaming.

Tokony ho hitanao: Voaonta mandritra ny stream ny loko.

Model mifanaraka amin'ny Anthropic SDK

Mahafeno izay ilain'ny Anthropic SDK ny id rehetra etsy ambany. Ny voalohany no default ao amin'ny ohatra kaody.

Id modelContext windowOutput faranySary ho fidirana
Kimi-K3-uncensored-NVFP4 1,022,976 262,144 Eny
Kimi-K3-uncensored-3BIT-REAP 225,280 225,280 Eny
shannon-3 196,608 65,536 Eny
shannon-coder-1 131,072 65,536 Tsia

Tsara ho fantatra

  • Ny base_url dia https://api.shannon-ai.com tsy misy /v1; raha misy /v1, antsoin'ny SDK ny /v1/v1/messages ary mahazo 404.
  • Mandefa ny key ho x-api-key ny SDK; Shannon koa dia mandray ny Authorization: Bearer.
  • Ampiasao id model Shannon avy amin'ny GET /v1/models; tsy omena ny id Claude.

Toro-hevitra

  1. Mamaky koa ny ANTHROPIC_BASE_URL sy ANTHROPIC_API_KEY ny SDK, ka afaka mifindra amin'ny environment variable roa ny code efa misy.
  2. Ny tool natao ho an'i Claude, toy ny Claude Code sy ny agent amin'ny Claude Agent SDK, dia mampiasa ny endpoint mitovy.
  3. Amin'ny TypeScript dia baseURL sy apiKey ny option.

Famahana olana

Soritr'aretinaAntonyVahaolana
404 Not Found Mifarana amin'ny /v1 ny base_url. Ampiasao ny https://api.shannon-ai.com.
400 unknown model Id model Claude. Ampiasao id Shannon avy amin'ny GET /v1/models.
401 Unauthorized Tsy ao ny key, diso soratra, na efa novaina. Adikao indray ny key avy ao amin'ny Keys & usage; manomboka amin'ny sk- izy.
context_length_exceeded na "prompt is too long" Lava noho ny context window an'ny model ny resaka. Manombohy chat vaovao, avelao ny fitaovana hanafohy azy, na misafidiana model manana window lehibe kokoa.
insufficient_quota Tsy ampy handoavana ny fangatahana ny balance-nao. Ampio ny balance na ovay ny plan; tsy averina ho azy ny fangatahana.

Fanontaniana

Mandeha miaraka amin'i Shannon ve ny SDK Anthropic?

Eny. Shannon dia manome ny Messages API ao amin'ny https://api.shannon-ai.com/v1/messages; apetraho ho https://api.shannon-ai.com ny base_url.

Mandeha ve ny streaming sy tool use?

Eny, roa daholo; nampandehanay stream sy tool call tamin'ny SDK Python.

Safidio ny fiteninao

Mitovy lanja ny fiteny rehetra. Safidio izay tianao hampiasaina.

Eoropa

Atsinanana Afovoany sy Afrika Avaratra

Azia Atsimo

Azia Atsimo-Atsinanana

Azia Atsinanana

Azia Afovoany sy Kaokazy

Afrika

Oseania

Noforonina sy Klasika