Skip to main content

Krims Code SDK

A lightweight, zero-dependency, universal developer SDK for integrating with the Krims Code ecosystem and querying a wide array of AI model providers.

Key Features

  • Multi-Provider Support: Out-of-the-box wrappers for OpenAI, Google Gemini, Anthropic Claude, Cohere, Ollama (local), Groq, Together, Cerebras, Mistral, Fireworks, OpenRouter, DeepSeek, Perplexity, and xAI.
  • Unified Chat Client: Perform stateless queries across different API providers with a single, simple .ask(prompt) method.
  • Stateful Client-Side Sessions: Use KrimsSession to manage conversation histories locally. Chat histories are automatically mapped to the appropriate provider format.
  • Zero-Config Integrations: Auto-detects standard environment variables (like OPENAI_API_KEY, GOOGLE_API_KEY, etc.).
  • TypeScript Support: Native .d.ts declarations included for autocomplete and code validation.
  • Zero Dependencies: Lightweight and fast, using native fetch and standard web APIs.

Installation

npm install krims-code-sdk

Quick Start

1. Zero-Config (Using local Krims Chatbot Server)

By default, the SDK targets the local Krims Chatbot backend at http://localhost:3000.

import { createKrimsClient } from 'krims-code-sdk';

const client = createKrimsClient();

// Call local health check
const health = await client.health();
console.log('Status:', health);

// Call local Markov AI model
const res = await client.ask('Who created you?');
console.log('Response:', res.text);

2. Multi-Provider Queries (e.g. Google Gemini)

Configuring a specific provider is simple. The SDK handles formatting differences underneath.

import { createKrimsClient } from 'krims-code-sdk';

// Auto-detects process.env.GOOGLE_API_KEY
const client = createKrimsClient({
  provider: 'google', // or 'openai', 'anthropic', 'cohere', 'groq', etc.
  model: 'gemini-2.5-flash'
});

const res = await client.ask('Explain quantum computing in one sentence.');
console.log('Gemini:', res.text);

3. Stateful Chat Sessions

The stateful KrimsSession handles storing message history and appends it automatically to subsequent calls in the session.

import { createKrimsClient } from 'krims-code-sdk';

const client = createKrimsClient({
  provider: 'openai',
  apiKey: 'your-openai-api-key'
});

const session = client.createSession({
  name: 'coding-assistant',
  systemInstruction: 'You are a Senior JavaScript developer.'
});

// Turn 1
let res = await session.ask('What is closures?');
console.log(res.text);

// Turn 2 (Session maintains context of Turn 1 automatically)
res = await session.ask('Can you show me a code example?');
console.log(res.text);

// View cumulative history
console.log(session.getHistory());

API Reference

KrimsClient Options

When calling createKrimsClient(options) or new KrimsClient(options), you can configure:

Option Type Description Environment Variable Fallback
provider string The AI provider to query (e.g. openai, google, anthropic, cohere, groq, together, krims, custom). -
model string The model identifier. Default values defined per provider
apiKey string API authorization key. OPENAI_API_KEY, GOOGLE_API_KEY, ANTHROPIC_API_KEY, etc.
baseUrl string Custom root URL for the endpoints. KRIMS_BASE_URL (for krims provider only)
headers object Custom headers to append on every request. -
timeout number Timeout in milliseconds (default: 30000). -
fetchFn function Custom fetch function (for proxies or custom clients). globalThis.fetch

Running Tests

To run the unit tests natively in Node:

npm test

Metadata

Release files for krims-code-sdk 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for krims-code-sdk 0.1.0
File Size Uploaded Provenance
krims_code_sdk-0.1.0.tar.gz 7.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for krims-code-sdk 0.1.0
File Interpreter ABI Platform
krims_code_sdk-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 14.4 kB

Release files / krims_code_sdk-0.1.0.tar.gz

Download URL krims_code_sdk-0.1.0.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
726d98d849595b4de734004c10c5cac5b5df57f0b600ca951172deca8ee6f5ca
BLAKE2b-256 checksum
How to use checksums
541fd4eefc374a4fc38450b50e3723a4f89d29bbcefcebe643abdebfae980256
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / krims_code_sdk-0.1.0-py3-none-any.whl

Download URL krims_code_sdk-0.1.0-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7fefe2ef7c331d09f4894963475f2fbadb45003bdb5604c971d82a2af395efc7
BLAKE2b-256 checksum
How to use checksums
ce6d883dc2ccf526340cba0881df24dfed755de746fc02fcc6b2adcf30238d69
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Security for krims-code-sdk 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page