Eqa uye okuqukethwe
Mastra

Ama-framework nama-SDK

Sebenzisa i-Mastra ne-Shannon

Nika i-ejenti ye-Mastra into ye-model ene-URL, i-key ne-id ye-Shannon; ukusakaza namathuluzi bese kusebenza ezimodeleni ze-Shannon.

  • Kuhlolwe ngo-Nov 7, 2026
  • OpenAI Chat Completions
  • Cishe imizuzu engu-3

Mayelana ne-Mastra

I-Mastra uhlaka lwe-TypeScript lwama-ejenti, izinhlelo zomsebenzi, inkumbulo nokutholwa kolwazi, olunesitudiyo sokuthuthukisa sasendaweni. Ama-ejenti athatha i-model ngomzila wawo we-model, owamukela noma iyiphi i-endpoint ehambisana ne-OpenAI uma inikwe i-URL ne-key. Lokho kuvumela ama-ejenti nezinhlelo zomsebenzi ze-Mastra ukuthi zisebenze ezimodeleni ze-Shannon.

Okudingayo

I-API key ye-Shannon
Ama-key nokusetshenziswa
I-base URL
https://api.shannon-ai.com/v1 I-endpoint: /v1/chat/completions
Wonke amasampula ekhodi angezansi alandela ukukhetha kwakho.

Kusethe

  1. Faka i-Mastra

    Shell
    npm install @mastra/core zod
  2. Dala i-ejenti ku-Shannon

    I-id ithi <any prefix>/<Shannon id>; i-url yi-base URL, hhayi i-endpoint yengxoxo.

    TypeScript
    import { Agent } from "@mastra/core/agent";
    import { createTool } from "@mastra/core/tools";
    import { z } from "zod";
    
    const getWeather = createTool({
      id: "get-weather",
      description: "Weather for a city",
      inputSchema: z.object({ city: z.string() }),
      execute: async ({ city }) => ({ weather: `Sunny, 18 C in ${city}` }),
    });
    
    export const agent = new Agent({
      id: "assistant",
      name: "assistant",
      instructions: "Answer briefly. Use tools for weather.",
      model: { id: "shannon/Kimi-K3-uncensored-NVFP4", url: "https://api.shannon-ai.com/v1", apiKey: process.env.SHANNON_API_KEY },
      tools: { getWeather },
    });
  3. Sakaza bese uveza

    TypeScript
    const stream = await agent.stream("Name three colours a cat can be.");
    for await (const text of stream.textStream) process.stdout.write(text);
    
    const r = await agent.generate("What is the weather in Oslo?");
    console.log(r.text);

Hlola ukuthi liyasebenza

Thumela: Sebenzisa isampula ne-SHANNON_API_KEY isethiwe.

Kufanele ubone: Imibala iyasakaza, bese kuba nempendulo esebenzisa isimo sezulu sethuluzi.

Ama-model afanele i-Mastra

Yonke i-id engezansi ihlangabezana nalokho i-Mastra ekudingayo. Eyokuqala iyi-default kumasampula ekhodi.

I-id ye-modelIwindi lomongoOkuphumayo okuphezuluOkufakwayo kwesithombe
Kimi-K3-uncensored-NVFP4 1,022,976 262,144 Yebo
Kimi-K3-uncensored-3BIT-REAP 225,280 225,280 Yebo
shannon-3 196,608 65,536 Yebo
shannon-coder-1 131,072 65,536 Cha

Kuhle ukwazi

  • I-url kufanele ibe yi-base URL ephela nge-/v1; i-Mastra ingeza i-/chat/completions.
  • Engeza i-api: "responses" entweni ye-model ukuze usebenzise kunalokho i-/v1/responses ye-Shannon.

Amathiphu

  1. Bhalisa ama-ejenti ku-Mastra instance ukuze uwabone esitudiyo sasendaweni (mastra dev).
  2. Into efanayo ye-model isebenza ezinhlelweni zomsebenzi nasezicutshini zenkumbulo ezithatha i-model.
  3. Dlulisa i-key ku-apiKey, isibonelo evela ku-SHANNON_API_KEY; amadokhumenti e-Mastra awanikezi okuguquguqukayo ekufunda kona ngokwayo ku-endpoint yangokwezifiso.

Ukuxazulula izinkinga

UphawuImbangelaIsixazululo
404 Not Found I-url ayinayo i-/v1 noma iphela nge-/chat/completions. Sebenzisa https://api.shannon-ai.com/v1.
401 I-apiKey ayinalutho. Dlulisa i-key ku-apiKey.
401 Unauthorized I-key ayikho, ibhalwe ngephutha noma ishintshiwe. Kopisha i-key futhi ku-Ama-key nokusetshenziswa; iqala nge-sk-.
context_length_exceeded / “i-prompt inde kakhulu” Ingxoxo inde kunewindi lomongo le-model. Qala ingxoxo entsha, vumela ithuluzi liyifinyeze, noma ukhethe i-model enewindi lomongo elikhulu.
insufficient_quota I-balance yakho ayikwazi ukukhokhela isicelo. Yengeza i-credit noma ushintshe ipulani; isicelo asizanywa futhi ngokwaso.

Imibuzo

Ingabe i-Mastra isebenza ne-Shannon?

Yebo: i-model ye-ejenti { id, url, apiKey } ene-url: "https://api.shannon-ai.com/v1" ifinyelela ku-Shannon.

Ingabe amathuluzi e-Mastra ayasebenza?

Yebo; amathuluzi e-createTool athunyelwa njengokubizwa kwamathuluzi kwemvelo.

Khetha ulimi lwakho

Zonke izilimi ziyalingana. Khetha ofuna ukulusebenzisa.

Yurophu

Mpumalanga Ephakathi neNyakatho ne-Afrika

ENingizimu ye-Asia

ENingizimu-mpumalanga ye-Asia

Mpumalanga ye-Asia

Maphakathi ne-Asia ne-Caucasus

I-Afrika

I-Oceania

Ezakhiwe neziqondene nesikhathi esidlule