/* tslint:disable */
/* eslint-disable */

/**
 * WASM wrapper around a tiktoken encoding instance.
 *
 * Created via [`get_encoding`] or [`encoding_for_model`].
 * Call `.free()` when done to release WASM memory.
 */
export class Encoding {
    private constructor();
    free(): void;
    [Symbol.dispose](): void;
    /**
     * Count tokens without building the full token id array.
     *
     * Faster than `encode(text).length` for cases where you only need the count.
     */
    count(text: string): number;
    /**
     * Count tokens, recognizing special tokens.
     *
     * Like `count()` but special tokens (e.g. `<|endoftext|>`) are counted
     * as single tokens instead of being split into sub-word pieces.
     */
    countWithSpecialTokens(text: string): number;
    /**
     * Decode token ids back to a UTF-8 string.
     *
     * Uses lossy UTF-8 conversion — invalid byte sequences are replaced with U+FFFD.
     */
    decode(tokens: Uint32Array): string;
    /**
     * Encode text into token ids (returns `Uint32Array` in JS).
     *
     * Special tokens like `<|endoftext|>` are treated as ordinary text.
     * Use `encodeWithSpecialTokens()` to recognize them.
     */
    encode(text: string): Uint32Array;
    /**
     * Encode text into token ids, recognizing special tokens.
     *
     * Special tokens (e.g. `<|endoftext|>`) are encoded as their designated ids
     * instead of being split into sub-word pieces.
     */
    encodeWithSpecialTokens(text: string): Uint32Array;
    /**
     * Get the encoding name (e.g. `"cl100k_base"`).
     */
    readonly name: string;
    /**
     * Get the number of special tokens in the vocabulary.
     */
    readonly numSpecialTokens: number;
    /**
     * Get the number of regular (non-special) tokens in the vocabulary.
     */
    readonly vocabSize: number;
}

/**
 * Model pricing and metadata.
 */
export class ModelInfo {
    private constructor();
    free(): void;
    [Symbol.dispose](): void;
    readonly cachedInputPer1m: number | undefined;
    readonly contextWindow: number;
    readonly id: string;
    readonly inputPer1m: number;
    readonly maxOutput: number;
    readonly outputPer1m: number;
    readonly provider: string;
}

/**
 * List all supported models with pricing info.
 *
 * Returns an array of `ModelInfo` objects.
 */
export function allModels(): ModelInfo[];

/**
 * Get an encoding for a model name (e.g. `"gpt-4o"`, `"o3-mini"`, `"llama-4"`, `"deepseek-r1"`).
 *
 * Supports models from OpenAI, Meta, DeepSeek, Qwen, and Mistral.
 * Automatically resolves the model name to the correct encoding.
 * Throws `Error` for unknown model names.
 */
export function encodingForModel(model: string): Encoding;

/**
 * Estimate cost in USD for a given model, input token count, and output token count.
 *
 * Supports OpenAI, Anthropic Claude, Google Gemini, Meta Llama, DeepSeek, Qwen, and Mistral models.
 * Throws `Error` for unknown model ids.
 */
export function estimateCost(model_id: string, input_tokens: number, output_tokens: number): number;

/**
 * Get an encoding by name.
 *
 * Supported encodings:
 * - `"cl100k_base"` — GPT-4, GPT-3.5-turbo
 * - `"o200k_base"` — GPT-4o, GPT-4.1, o1, o3
 * - `"o200k_harmony"` — gpt-oss (harmony chat format)
 * - `"p50k_base"` — text-davinci-002/003
 * - `"p50k_edit"` — text-davinci-edit
 * - `"r50k_base"` — GPT-3 (davinci, curie, etc.)
 * - `"gpt2"` — GPT-2 (alias for r50k_base)
 * - `"llama3"` — Meta Llama 3/4
 * - `"deepseek_v3"` — DeepSeek V3/R1
 * - `"qwen2"` — Qwen 2/2.5/3
 * - `"mistral_v3"` — Mistral/Codestral/Pixtral
 *
 * Throws `Error` for unknown encoding names.
 */
export function getEncoding(name: string): Encoding;

/**
 * Get model pricing and metadata.
 *
 * Returns a typed object with: `id`, `provider`, `inputPer1m`, `outputPer1m`,
 * `cachedInputPer1m`, `contextWindow`, `maxOutput`.
 *
 * Throws `Error` for unknown model ids.
 */
export function getModelInfo(model_id: string): ModelInfo;

/**
 * List all available encoding names.
 *
 * Returns an array of strings: `["cl100k_base", "o200k_base", ...]`
 */
export function listEncodings(): string[];

/**
 * Map a model name to its encoding name without loading the encoding.
 *
 * Returns the encoding name string (e.g. `"o200k_base"`) or `null` for unknown models.
 */
export function modelToEncoding(model: string): string | undefined;

/**
 * List models filtered by provider name.
 *
 * Provider names: `"OpenAI"`, `"Anthropic"`, `"Google"`, `"Meta"`, `"DeepSeek"`, `"Alibaba"`, `"Mistral"`.
 * Returns an empty array for unknown providers.
 */
export function modelsByProvider(provider: string): ModelInfo[];

export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;

export interface InitOutput {
    readonly memory: WebAssembly.Memory;
    readonly __wbg_encoding_free: (a: number, b: number) => void;
    readonly __wbg_modelinfo_free: (a: number, b: number) => void;
    readonly allModels: (a: number) => void;
    readonly encodingForModel: (a: number, b: number, c: number) => void;
    readonly encoding_count: (a: number, b: number, c: number) => number;
    readonly encoding_countWithSpecialTokens: (a: number, b: number, c: number) => number;
    readonly encoding_decode: (a: number, b: number, c: number, d: number) => void;
    readonly encoding_encode: (a: number, b: number, c: number, d: number) => void;
    readonly encoding_encodeWithSpecialTokens: (a: number, b: number, c: number, d: number) => void;
    readonly encoding_name: (a: number, b: number) => void;
    readonly encoding_vocabSize: (a: number) => number;
    readonly estimateCost: (a: number, b: number, c: number, d: number, e: number) => void;
    readonly getEncoding: (a: number, b: number, c: number) => void;
    readonly getModelInfo: (a: number, b: number, c: number) => void;
    readonly listEncodings: (a: number) => void;
    readonly modelToEncoding: (a: number, b: number, c: number) => void;
    readonly modelinfo_cachedInputPer1m: (a: number, b: number) => void;
    readonly modelinfo_id: (a: number, b: number) => void;
    readonly modelinfo_provider: (a: number, b: number) => void;
    readonly modelsByProvider: (a: number, b: number, c: number) => void;
    readonly encoding_numSpecialTokens: (a: number) => number;
    readonly modelinfo_contextWindow: (a: number) => number;
    readonly modelinfo_inputPer1m: (a: number) => number;
    readonly modelinfo_maxOutput: (a: number) => number;
    readonly modelinfo_outputPer1m: (a: number) => number;
    readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
    readonly __wbindgen_export: (a: number, b: number, c: number) => void;
    readonly __wbindgen_export2: (a: number, b: number) => number;
    readonly __wbindgen_export3: (a: number, b: number, c: number, d: number) => number;
}

export type SyncInitInput = BufferSource | WebAssembly.Module;

/**
 * Instantiates the given `module`, which can either be bytes or
 * a precompiled `WebAssembly.Module`.
 *
 * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
 *
 * @returns {InitOutput}
 */
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;

/**
 * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
 * for everything else, calls `WebAssembly.instantiate` directly.
 *
 * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
 *
 * @returns {Promise<InitOutput>}
 */
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
