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

@kortyx/google

v0.6.11

Published

Google Gemini provider integration for Kortyx.

Readme

@kortyx/google

npm version CI License TypeScript

Google Gemini provider integration for Kortyx.

Install

pnpm add @kortyx/google
npm install @kortyx/google

Basic usage

import { google } from "@kortyx/google";
import { useReason } from "kortyx";

export const answerNode = async ({ input }: { input: unknown }) => {
  const result = await useReason({
    id: "answer",
    model: google("gemini-2.5-flash"),
    input: String(input ?? ""),
    stream: true,
    emit: true,
  });

  return {
    data: { text: result.text },
  };
};

The default google export reads one of these environment variables on first use:

  • GOOGLE_API_KEY
  • GEMINI_API_KEY
  • GOOGLE_GENERATIVE_AI_API_KEY
  • KORTYX_GOOGLE_API_KEY
  • KORTYX_GEMINI_API_KEY

If you want an app-local barrel, re-export it from a shared file:

// src/lib/providers.ts
export { google } from "@kortyx/google";

Then import from that file where you use it.

Re-exporting google does not create a local binding in the same file. If you want to call google("...") in that file, use import { google } from "@kortyx/google".

Advanced usage

Use createGoogleGenerativeAI(...) when you want explicit app-owned setup or custom settings:

import { createGoogleGenerativeAI } from "@kortyx/google";

export const google = createGoogleGenerativeAI({
  apiKey: process.env.GOOGLE_API_KEY,
});

Reasoning, tools, and structured output

Model IDs accept arbitrary non-empty strings; MODELS supplies autocomplete suggestions. useReason preserves thought signatures and original function-call IDs across tool rounds and approval resumes. Thought summaries are kept separate from final text and JSON.

Compatible outputSchema calls use native JSON Schema enforcement. Tool schemas retain references and property names. Gemini 3 models receive reasoning.effort as a thinking level; Gemini 2.5 maps minimal/low/medium/high to budgets of 512/1,024/8,192/24,576 tokens, with a compatibility warning. Use reasoning.maxTokens for a specific budget, or providerOptions.google.thinkingConfig for native controls. Do not supply both generic effort and budget.

Behavior change: rejected reasoning settings now fail explicitly; Kortyx no longer retries without effort. none disables thinking on compatible Gemini 2.5 Flash models and fails on models that cannot disable thinking. No model is substituted automatically.

When combining tools with JSON output, useReason keeps output constraints off tool-selection turns. Gemini 2.x rejects the combined request, and live Gemini 3 generateContent tests repeatedly selected a tool instead of returning the final JSON. With only outputSchema, Kortyx reuses an answer that passes local validation and reports a compatibility warning. Otherwise it makes a separate JSON-only call, using the same model and reasoning and counting toward existing limits. An explicit responseFormat.schema always requires provider-enforced finalization. Direct Gemini 2.x requests combining tools and JSON fail with guidance.

See Google thought signatures and structured output.

Documentation

License

Apache-2.0. See LICENSE.