Custom models
neuro-ts defaults to gpt-4o because it is cheap and fast enough
for one-shot built-in simulation. You can change this globally or per call.
Change the default model
Section titled “Change the default model”import { configureClient } from 'neuro-ts';
configureClient({ apiKey: process.env.OPENAI_API_KEY, model: 'gpt-4o', temperature: 0.1, maxTokens: 2048,});Per-call override (low level)
Section titled “Per-call override (low level)”The generated wrappers do not yet accept a per-call model parameter (kept intentionally tight to mirror the original signatures). To override per call, drop down to the client:
import { getClient } from 'neuro-ts';import prompts from 'neuro-ts/prompts';
const entry = prompts['neuro.array.map'];
const result = await getClient().executeFunction({ functionId: entry.functionId, // 'Array.prototype.map' systemPrompt: entry.systemPrompt, // generated system prompt signatureHint: entry.overloads, // TypeScript overload signatures prompt: 'classify each item as fruit or vegetable', instance: ['apple', 'carrot', 'banana'], args: { callbackfn: undefined }, model: 'gpt-4o',});signatureHint is the list of TypeScript overload signatures for the
method. It is embedded in the system prompt to help the model understand
expected parameter and return types. Always source it from prompts.json
rather than passing [] — an accurate hint measurably improves output
quality for complex signatures.
OpenAI-compatible endpoints
Section titled “OpenAI-compatible endpoints”Anything OpenAI-Chat-Completions-compatible works (vLLM, Ollama with the
OpenAI shim, Azure OpenAI, OpenRouter, Together). Pass baseURL:
configureClient({ apiKey: process.env.OPENROUTER_API_KEY, baseURL: 'https://openrouter.ai/api/v1', model: 'meta-llama/llama-3.3-70b-instruct',});configureClient({ apiKey: process.env.OLLAMA_KEY ?? 'ollama', baseURL: 'http://localhost:11434/v1', model: 'llama3.3',});Smaller or weaker models will struggle to follow the JSON-only output
contract embedded in every system prompt. If you see prose coming back,
raise maxTokens, lower temperature, or use a stronger model.