Mandrosoa any amin'ny votoaty
Mastra

Framework sy SDK

Ampiasao amin'i Shannon ny Mastra

Omeo model object misy URL, key ary id Shannon ny agent Mastra; mandeha amin'ny model Shannon avy eo ny streaming sy tool.

  • Notsapaina tamin'ny 7 Nov 2026
  • OpenAI Chat Completions
  • Manodidina ny 3 min

Momba ny Mastra

Mastra dia framework TypeScript ho an'ny agent, workflow, memory ary retrieval, misy studio dev eo an-toerana. Mandray model amin'ny alalan'ny model router ny agent, izay mandray endpoint mifanaraka amin'ny OpenAI rehetra omena URL sy key. Izany no ahafahan'ny agent sy workflow Mastra mandeha amin'ny model Shannon.

Izay ilainao

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

Fametrahana

  1. Apetraho i Mastra

    Shell
    npm install @mastra/core zod
  2. Mamoròna agent amin'i Shannon

    id dia <any prefix>/<Shannon id>; ny url dia ny base URL, fa tsy ny endpoint chat.

    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. Manaova stream sy 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);

Hamarino fa miasa

Alefaso: Alefaso ny santionany miaraka amin'ny SHANNON_API_KEY voapetraka.

Tokony ho hitanao: Mandeha stream ny loko, dia valiny mampiasa ny toetrandro avy amin'ny tool.

Model mifanaraka amin'ny Mastra

Mahafeno izay ilain'ny Mastra 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

  • Tsy maintsy ny base URL mifarana amin'ny /v1 ny url; Mastra no manampy ny /chat/completions.
  • Ampio api: "responses" ao amin'ny model object mba hampiasana ny /v1/responses an'i Shannon.

Toro-hevitra

  1. Soraty ao amin'ny instance Mastra ny agent mba hitanao azy ao amin'ny studio eo an-toerana (mastra dev).
  2. Mandeha ao amin'ny workflow sy memory processor mandray model ny model object mitovy.
  3. Alefaso ao amin'ny apiKey ny key, ohatra avy amin'ny SHANNON_API_KEY; ny docs an'i Mastra dia tsy manonona variable vakiny ho azy ho an'ny endpoint manokana.

Famahana olana

Soritr'aretinaAntonyVahaolana
404 Not Found Tsy misy /v1 ny url na mifarana amin'ny /chat/completions. Ampiasao ny https://api.shannon-ai.com/v1.
401 Foana ny apiKey. Alefaso ao amin'ny apiKey ny key.
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 i Mastra?

Eny: model agent { id, url, apiKey } miaraka amin'ny url: "https://api.shannon-ai.com/v1" no mahatratra an'i Shannon.

Mandeha ve ny tool an'i Mastra?

Eny; alefa ho tool call native ny tool createTool.

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