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

@runtypelabs/mixlayer-ai-provider

v1.1.1

Published

AI SDK (Vercel) provider for Mixlayer — open-weight model inference (currently the Qwen 3.5 / 3.6 family) over an OpenAI-compatible endpoint.

Readme

@runtypelabs/mixlayer-ai-provider

npm license

An AI SDK provider for Mixlayer — fast, open-weight model inference served over an OpenAI-compatible endpoint. Mixlayer's catalog is currently the Qwen 3.5 / 3.6 family and grows over time; this provider is model-family-agnostic and only layers family-specific tuning on models it recognizes.

It wraps @ai-sdk/openai-compatible for Chat Completions and @ai-sdk/openai for Responses API models, baking in everything Mixlayer needs to behave correctly out of the box:

  • the Mixlayer base URL
  • recommended Chat Completions Qwen sampling defaults (thinking / non-thinking), scoped to the Qwen 3.5 / 3.6 models and overridable per request
  • reasoning support — <think> tags and native reasoning_content both surface as AI SDK reasoning parts
  • Responses API models and a Responses WebSocket fetch adapter for lower latency streaming on repeat calls
  • tolerant model-id handling (strips a leading mixlayer/ prefix)

Install

pnpm add @runtypelabs/mixlayer-ai-provider ai@^7

This package targets AI SDK v7 and is ESM-only. For Node.js applications, use Node.js 22+; the package itself avoids Node-only WebSocket dependencies so it can be bundled for standards-based runtimes such as Cloudflare Workers. ai is a peer dependency, so your app dedupes a single AI SDK version.

Usage

import { mixlayer } from '@runtypelabs/mixlayer-ai-provider'
import { streamText } from 'ai'

const result = streamText({
  model: mixlayer('qwen/qwen3.6-27b'),
  prompt: 'Explain reasoning models in one paragraph.',
})

for await (const text of result.textStream) process.stdout.write(text)

The default mixlayer instance reads MIXLAYER_API_KEY from the environment (Node). To set the key (or any other option) explicitly, create your own provider with createMixlayer:

import { createMixlayer } from '@runtypelabs/mixlayer-ai-provider'

const provider = createMixlayer({
  apiKey: process.env.MIXLAYER_API_KEY,
  thinking: false, // use the non-thinking Qwen sampling defaults
})

const model = provider('qwen/qwen3.5-9b')

Responses API and WebSocket mode

The callable provider and provider.languageModel(id) use Chat Completions by default for backwards compatibility. Use provider.responses(id) for Mixlayer's OpenAI-compatible Responses API:

import { createMixlayer } from '@runtypelabs/mixlayer-ai-provider'
import { streamText } from 'ai'

const provider = createMixlayer({
  apiKey: process.env.MIXLAYER_API_KEY,
  thinking: false, // for Qwen Responses API calls, maps to reasoning.effort: 'none'
})

const result = streamText({
  model: provider.responses('qwen/qwen3.5-9b'),
  prompt: 'Say hello via the Responses API.',
})

To route streaming Responses API requests over Mixlayer's WebSocket endpoint, pass createMixlayerWebSocketFetch() as the provider fetch:

import {
  createMixlayer,
  createMixlayerWebSocketFetch,
} from '@runtypelabs/mixlayer-ai-provider'
import { streamText } from 'ai'

const wsFetch = createMixlayerWebSocketFetch()
const provider = createMixlayer({
  apiKey: process.env.MIXLAYER_API_KEY,
  thinking: false,
  fetch: wsFetch,
})

try {
  const result = streamText({
    model: provider.responses('qwen/qwen3.5-9b'),
    prompt: 'Say hello over WebSocket.',
  })

  for await (const text of result.textStream) process.stdout.write(text)
} finally {
  wsFetch.close()
}

createMixlayerWebSocketFetch() is designed to be Workers-friendly by default: it performs a fetch() request with Upgrade: websocket, uses Response.webSocket, and calls accept() before sending the response.create event. That matches Cloudflare Workers' outbound WebSocket API and keeps this package free of a hard ws / Node.js dependency.

Runtimes that do not expose Response.webSocket on upgraded fetch responses (for example, typical Node.js fetch implementations) can pass a custom connect option. Browsers also cannot attach arbitrary Authorization headers to direct WebSocket handshakes, so browser apps should use a server/Worker connector or proxy rather than connecting directly with a secret API key.

If you want provider registries or provider(id) to use Responses API models, set defaultModelApi: 'responses' in createMixlayer(...).

The provider also slots into createProviderRegistry:

import { createProviderRegistry } from 'ai'

const registry = createProviderRegistry({ mixlayer })
const model = registry.languageModel('mixlayer:qwen/qwen3.6-27b')

Models

Pass any model id from Mixlayer's catalog — see the Mixlayer models page for the live list and pricing. Ids look like qwen/qwen3.6-27b or moonshotai/kimi-k2.6.

The MixlayerChatModelId union ships a snapshot of the known ids for editor autocomplete, but the union is open — any model id string is accepted, so new models and future families work without a package update.

Sampling defaults

For Chat Completions models (provider(id), provider.chat(id), and provider.chatModel(id)), the provider applies Mixlayer's recommended Qwen sampling defaults automatically, drawn from Mixlayer's chat completions parameter reference and per-model notes. They apply only to Qwen 3.5 / 3.6 models, so later Qwen generations and other model families pass through untouched. Any temperature / top_p / etc. you set on a request always takes precedence. Use the exported isQwen35Or36(modelId) helper if you need the same predicate.

Responses API models (provider.responses(id)) use the OpenAI Responses request shape so they remain compatible with Mixlayer's Responses HTTP and WebSocket endpoints. For Qwen 3.5 / 3.6 Responses API calls, thinking: false maps to the OpenAI-compatible reasoning.effort: 'none' request shape because the Responses API rejects the Chat Completions-only thinking field.

API

| Export | Description | | --------------------------------------------------------------- | ---------------------------------------------------------------- | | mixlayer | Default provider instance (thinking mode, key from env) | | createMixlayer(settings) | Provider factory | | createMixlayerWebSocketFetch(options?) | Fetch adapter for Responses API streaming over WebSocket | | extractMixlayerModelId(id) | Strips a leading mixlayer/ prefix | | getMixlayerSamplingDefaults(thinking) | Returns the Qwen sampling defaults for a mode | | isQwen35Or36(modelId) | Whether an id is a Qwen 3.5 / 3.6 model (the scoped generations) | | applyQwenSamplingDefaults(body, thinking?) | Applies the defaults to a request body, scoped to Qwen 3.5 / 3.6 | | MIXLAYER_DEFAULT_BASE_URL | https://models.mixlayer.ai/v1 | | MIXLAYER_DEFAULT_RESPONSES_WEBSOCKET_URL | wss://models.mixlayer.ai/v1/responses | | getMixlayerResponsesWebSocketURL(baseURL?) | Derives a Responses WebSocket URL from an HTTP base URL | | MIXLAYER_THINKING_DEFAULTS / MIXLAYER_NON_THINKING_DEFAULTS | The raw sampling-default objects |

The provider also exposes:

  • provider.languageModel(id) — equivalent to calling provider(id)
  • provider.chat(id) / provider.chatModel(id) — Chat Completions model
  • provider.responses(id) / provider.responsesModel(id) — Responses API model

MixlayerProviderSettings

| Option | Type | Default | Description | | ----------------- | ---------------------- | --------------------------- | ------------------------------------------------------------------------ | | apiKey | string | MIXLAYER_API_KEY env | Mixlayer API key | | baseURL | string | MIXLAYER_DEFAULT_BASE_URL | Override the inference endpoint | | headers | Record<string,string> | — | Extra headers sent with every request | | fetch | typeof fetch | globalThis.fetch | Custom fetch; pass createMixlayerWebSocketFetch() for WS streaming | | includeUsage | boolean | — | Include usage information in streaming Chat Completions responses | | thinking | boolean | true | Apply Qwen thinking/non-thinking defaults; Responses uses reasoning.effort: 'none' for false | | defaultModelApi | 'chat' \| 'responses' | 'chat' | API used by provider(id) and provider.languageModel(id) |

createMixlayerWebSocketFetch(options)

| Option | Type | Default | Description | | ------------ | --------------------- | ---------------------------------------- | ------------------------------------------------ | | url | string | Derived from baseURL | Responses WebSocket endpoint | | baseURL | string | MIXLAYER_DEFAULT_BASE_URL | HTTP base URL used to derive url | | headers | Record<string,string> | — | Extra headers for the WebSocket handshake | | betaHeader | string \| false | MIXLAYER_RESPONSES_WEBSOCKET_BETA | OpenAI Responses WebSocket beta header value | | fetch | typeof fetch | globalThis.fetch | Fallback fetch and default fetch-upgrade client | | connect | WebSocket connector | Workers-compatible fetch upgrade | Override for runtimes without Response.webSocket |

License

MIT