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/v1Endpoint:/v1/chat/completions - Manaraka ny safidinao ny ohatra rehetra etsy ambany.
Fametrahana
-
Apetraho i Mastra
Shellnpm install @mastra/core zod -
Mamoròna agent amin'i Shannon
iddia<any prefix>/<Shannon id>; nyurldia ny base URL, fa tsy ny endpoint chat.TypeScriptimport { 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 }, }); -
Manaova stream sy generate
TypeScriptconst 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 model | Context window | Output farany | Sary 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
/v1nyurl; Mastra no manampy ny/chat/completions. - Ampio
api: "responses"ao amin'ny model object mba hampiasana ny/v1/responsesan'i Shannon.
Toro-hevitra
- Soraty ao amin'ny instance
Mastrany agent mba hitanao azy ao amin'ny studio eo an-toerana (mastra dev). - Mandeha ao amin'ny workflow sy memory processor mandray model ny model object mitovy.
- Alefaso ao amin'ny
apiKeyny key, ohatra avy amin'nySHANNON_API_KEY; ny docs an'i Mastra dia tsy manonona variable vakiny ho azy ho an'ny endpoint manokana.
Famahana olana
| Soritr'aretina | Antony | Vahaolana |
|---|---|---|
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.