Tlola ho ea ho litaba
Mastra

Li-framework le li-SDK

Sebelisa Mastra le Shannon

Fa agent ea Mastra object ea model e nang le URL, senotlolo le id ea Shannon; streaming le li-tool li sebetsa ho li-model tsa Shannon.

  • E lekiloe 2026 Pun 7
  • OpenAI Chat Completions
  • Metsotso e ka bang 3

Mabapi le Mastra

Mastra ke moralo oa TypeScript oa li-agent, li-workflow, memori le retrieval, o nang le studio ea lehae ea dev. Li-agent li nka model ka model router ea eona, e amohelang endpoint efe kapa efe e lumellanang le OpenAI ha ho fanoa ka URL le senotlolo. Seo se lumella li-agent le li-workflow tsa Mastra ho sebetsa ho li-model tsa Shannon.

Seo u se hlokang

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

E hlophise

  1. Kenya Mastra

    Shell
    npm install @mastra/core zod
  2. Theha agent ho Shannon

    id ke <any prefix>/<Shannon id>; url ke base URL, eseng chat endpoint.

    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. Etsa stream le generate

    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);

Hlahloba hore e a sebetsa

Romela: Tsamaisa sampole ha SHANNON_API_KEY e setiloe.

U lokela ho bona: Mebala e a fihla ka stream, ebe karabo e sebelisang boemo ba leholimo ba tool.

Li-model tse loketseng Mastra

Id e 'ngoe le e 'ngoe e ka tlase e khotsofatsa seo Mastra 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

  • url e tlameha ho ba base URL e qetellang ka /v1; Mastra e eketsa /chat/completions.
  • Eketsa api: "responses" ho object ea model ho sebelisa /v1/responses ea Shannon ho e-na le seo.

Malebela

  1. Ngolisa li-agent ho Mastra instance ho li bona ho studio ea lehae (mastra dev).
  2. Object e ts'oanang ea model e sebetsa ho li-workflow le li-memory processor tse nkang model.
  3. Fetisa senotlolo ho apiKey, mohlala ho tsoa ho SHANNON_API_KEY; litokomane tsa Mastra ha li rete variable eo e e balang ka boeona bakeng sa endpoint e ikhethileng.

Ho rarolla mathata

MatšoaoLebakaTokiso
404 Not Found url ha e na /v1 kapa e qetella ka /chat/completions. Sebelisa https://api.shannon-ai.com/v1.
401 apiKey e se na letho. Fetisa senotlolo ho apiKey.
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 Mastra e sebetsa le Shannon?

E: model ea agent { id, url, apiKey } e nang le url: "https://api.shannon-ai.com/v1" e fihla ho Shannon.

Na li-tool tsa Mastra lia sebetsa?

E; li-tool tsa createTool li romeloa e le tool calls tsa tlhaho.

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