
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
@vivgrid/ai-sdk-provider
Advanced tools
The official Vercel AI SDK provider for Vivgrid - a global AI inference infrastructure platform.
npm install @vivgrid/ai-sdk-provider
# or
pnpm add @vivgrid/ai-sdk-provider
# or
yarn add @vivgrid/ai-sdk-provider
Retrieve your API key from the Vivgrid Console.
export VIVGRID_API_KEY=your-api-key
Model
and System Prompt
configurations are managed through the Vivgrid web console, eliminating the need to specify them in your code:
import { vivgrid } from "@vivgrid/ai-sdk-provider";
import { generateText } from "ai";
const { text } = await generateText({
// Uses the model configured in the web console
model: vivgrid(),
// System prompt is automatically attached based on console configuration
prompt: "Write a vegetable lasagna recipe for 4 people",
});
console.log(text);
import { vivgrid } from "@vivgrid/ai-sdk-provider";
import { streamText } from "ai";
const { textStream } = await streamText({
model: vivgrid(),
prompt: "Tell me a story about a brave little rabbit",
});
for await (const textPart of textStream) {
process.stdout.write(textPart);
}
Tools (LLM Function Calling) can be written in TypeScript with strongly-typed language support. They are decoupled from the main codebase and reduce management overhead through a serverless architecture. Additionally, all tools are automatically served as MCP (Model Context Protocol) servers.
Here's how to implement a get-weather
tool:
const description = "Get the current weather for `city_name`";
export type Argument = {
/**
* The name of the city to be queried
*/
city_name: string;
}
export async function handler(args: Argument) {
const result = await getWeather(args.city_name);
return result;
}
Then deploy it to Vivgrid, and use it in your code like this:
import { vivgrid } from "@vivgrid/ai-sdk-provider";
import { generateText } from "ai";
const { text, toolCalls } = await generateText({
model: vivgrid(),
prompt: "What's the weather like in San Francisco?",
/* No need to define tools locally anymore */
// tools: {
// weather: {
// description: "Get weather for a specified location",
// parameters: z.object({
// location: z.string().describe("City name"),
// }),
// execute: async ({ location }) => {
// // Actual weather API call
// return `The weather in ${location} is sunny, 22°C`;
// },
// },
// },
});
You can explore more Serverless LLM Function examples and deploy them to Vivgrid with one click.
import { vivgrid } from "@vivgrid/ai-sdk-provider";
import { generateObject } from "ai";
import { z } from "zod";
const { object } = await generateObject({
model: vivgrid(),
schema: z.object({
recipe: z.object({
name: z.string(),
ingredients: z.array(
z.object({
name: z.string(),
amount: z.string(),
})
),
steps: z.array(z.string()),
}),
}),
prompt: "Generate a pasta recipe",
});
console.log(object.recipe);
All AI model selection and configuration is managed through the Vivgrid Console. You can:
This approach provides the flexibility to switch and manage models without modifying your codebase.
const model = vivgrid({
jsonMode: true, // Forces the model to output valid JSON
});
const model = vivgrid({
structuredOutputs: true, // Enables structured outputs (default: true)
});
try {
const { text } = await generateText({
model: vivgrid(),
prompt: "Hello",
});
} catch (error) {
if (error instanceof Error) {
console.error("Error:", error.message);
}
}
We welcome issues and pull requests! Please feel free to contribute to this project.
MIT
FAQs
Vercel AI SDK provider for vivgrid AI Bridge platform
We found that @vivgrid/ai-sdk-provider demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.