| 31 | type PiReasoningLevel = Exclude<ReasoningLevel, 'off'>; |
| 32 | |
| 33 | export interface GenerateOptions { |
| 34 | apiKey: string; |
| 35 | baseUrl?: string; |
| 36 | signal?: AbortSignal; |
| 37 | /** Hard cap on output tokens. When omitted, pi-ai uses roughly 1/3 of |
| 38 | * the model's context window. */ |
| 39 | maxTokens?: number; |
| 40 | /** When set, asks the provider to "think before answering". On Anthropic |
| 41 | * Claude 4.x models this enables extended thinking; on OpenAI/Gemini it |
| 42 | * maps to their reasoning effort. Older/non-reasoning models ignore it. */ |
| 43 | reasoning?: ReasoningLevel; |
| 44 | /** v3 wire override — when set, a synthetic PiModel is constructed so |
| 45 | * custom endpoints (DeepSeek, Ollama, LiteLLM, Azure, …) route through |
| 46 | * the correct pi-ai adapter even if the provider id isn't in pi-ai's |
| 47 | * registry. */ |
| 48 | wire?: WireApi; |
| 49 | /** Extra HTTP headers (merged last). Supports Codex-style static headers |
| 50 | * for gateways that require custom auth keys. */ |
| 51 | httpHeaders?: Record<string, string>; |
| 52 | userImages?: Array<{ data: string; mimeType: string }>; |
| 53 | /** |
| 54 | * Allow OpenAI-compatible keyless gateways. The upstream SDK still requires |
| 55 | * a non-empty apiKey string to instantiate its client, so this uses a local |
| 56 | * placeholder while auth is supplied by `httpHeaders` or by the gateway. |
| 57 | */ |
| 58 | allowKeyless?: boolean; |
| 59 | } |
| 60 | |
| 61 | export interface GenerateResult { |
| 62 | content: string; |
nothing calls this directly
no outgoing calls
no test coverage detected