npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@gmicloud/ai-sdk-provider

v0.1.1

Published

GMI Cloud provider for the Vercel AI SDK.

Readme

GMI Cloud Provider

The GMI Cloud provider enables access to GMI Cloud hosted language models through the AI SDK.

This package currently implements the AI SDK Provider V3 language model interface for GMI Cloud's OpenAI-compatible chat completions API.

Setup

Install the provider:

npm install @gmicloud/ai-sdk-provider

Set your API key:

export GMI_CLOUD_APIKEY="your-api-key"

Provider Instance

You can import the default provider instance gmicloud:

import { gmicloud } from '@gmicloud/ai-sdk-provider';

If you need a customized setup, import createGmicloud and create a provider instance with your settings:

import { createGmicloud } from '@gmicloud/ai-sdk-provider';

const gmicloud = createGmicloud({
  apiKey: process.env.GMI_CLOUD_APIKEY ?? '',
});

The following optional settings are available:

  • baseURL string: Use a different URL prefix for API calls. Defaults to https://api.gmi-serving.com/v1.
  • apiKey string: API key sent using the Authorization header. Defaults to the GMI_CLOUD_APIKEY environment variable.
  • headers Record<string, string>: Custom headers to include in requests.
  • fetch (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>: Custom fetch implementation for testing, proxies, or instrumentation.

Language Models

You can create GMI Cloud language models using a provider instance. The first argument is the model id:

const model = gmicloud('zai-org/GLM-5.1-FP8');

Example

Use GMI Cloud language models with generateText:

import { generateText } from 'ai';
import { gmicloud } from '@gmicloud/ai-sdk-provider';

const { text } = await generateText({
  model: gmicloud('zai-org/GLM-5.1-FP8'),
  system: 'You are a knowledgeable AI assistant.',
  prompt: 'Explain the concept of quantum entanglement in simple terms.',
});

GMI Cloud language models can also be used with streamText:

import { streamText } from 'ai';
import { gmicloud } from '@gmicloud/ai-sdk-provider';

const result = streamText({
  model: gmicloud('zai-org/GLM-5.1-FP8'),
  prompt: 'Write a short introduction to GMI Cloud.',
});

for await (const textPart of result.textStream) {
  process.stdout.write(textPart);
}

Tool Calling

Function tools are mapped to GMI Cloud's OpenAI-compatible tools and tool_choice request fields:

import { generateText, tool } from 'ai';
import { z } from 'zod';
import { gmicloud } from '@gmicloud/ai-sdk-provider';

const result = await generateText({
  model: gmicloud('zai-org/GLM-5.1-FP8'),
  prompt: 'What is the weather in San Francisco?',
  tools: {
    getWeather: tool({
      description: 'Get the weather for a city.',
      inputSchema: z.object({
        city: z.string(),
      }),
      execute: async ({ city }) => ({
        city,
        temperature: '18C',
        condition: 'Partly cloudy',
      }),
    }),
  },
});

console.log(result.text);

Provider Options

GMI Cloud chat models support an escape hatch for documented provider-specific request fields that are not part of the standard AI SDK call settings:

import {
  gmicloud,
  type GmicloudLanguageModelOptions,
} from '@gmicloud/ai-sdk-provider';
import { generateText } from 'ai';

const { text } = await generateText({
  model: gmicloud('zai-org/GLM-5.1-FP8'),
  prompt: 'Write a concise product description.',
  providerOptions: {
    gmicloud: {
      extraBody: {
        // documented GMI Cloud request fields can be passed here
      },
    } satisfies GmicloudLanguageModelOptions,
  },
});

Prefer standard AI SDK settings such as temperature, maxOutputTokens, topP, stopSequences, tools, and toolChoice whenever possible.

Reasoning Models

When GMI Cloud returns native reasoning_content in chat completion responses or stream deltas, this provider maps it to AI SDK V3 reasoning content. You can access it through AI SDK result content fields:

import { generateText } from 'ai';
import { gmicloud } from '@gmicloud/ai-sdk-provider';

const result = await generateText({
  model: gmicloud('zai-org/GLM-5.1-FP8'),
  prompt: 'Solve this carefully: 9.11 and 9.9, which is larger?',
});

const reasoning = result.content
  .filter(part => part.type === 'reasoning')
  .map(part => part.text)
  .join('');

If a specific model exposes reasoning only inside text using tags such as <think>, you can still use the AI SDK extractReasoningMiddleware for that model.

Model Capabilities

The table below lists the provider capabilities implemented by this package. Model-specific availability depends on the selected GMI Cloud model.

| Model | Image Input | Object Generation | Tool Usage | Tool Streaming | | --- | --- | --- | --- | --- | | zai-org/GLM-5.1-FP8 | Not enabled | Supported through JSON mode | Supported | Supported |

This provider does not currently implement embedding models, image generation models, or reranking models. Those should be added only after the corresponding GMI Cloud API contracts are verified.

Development

Run the full verification suite:

npm run verify

The test suite uses mock fetch implementations and does not call the live GMI Cloud API.