Perf Chat
AI-generatedSummary
Send a chat message to an LLM with intelligent model routing, supporting simple text, multi‑turn messages, or raw JSON input.
Inputs
- inputMode — How to provide the input messages (simple, messages, or json).
- message (required) — The single user message when inputMode is simple.
- messages — Array of role‑content messages for conversation context.
- messagesJson — Messages array in OpenAI JSON format as a string or parsed object.
- model — Target model to use; auto selects the best model if set to 'auto'.
- systemPrompt — Optional system prompt prepended to the conversation.
- options.maxCostPerCall — Maximum cost in USD for the call; 0 means no limit.
- options.responseFormat — Response format (text or json).
- options.jsonSchema — JSON Schema to enforce on the response when responseFormat is json.
- options.includeMetadata — Whether to include routing metadata (model, cost, latency) in the output.
Output shape
array of objects representing chat responses
Each item always contains content, role, model, and finish_reason; may also include json_content, perf metadata, and usage fields depending on configuration.
Examples
Example 1: Send a single user message with intelligent routing
inputMode=simple, message="Hello world", model=auto
Example 2: Send a multi‑turn conversation using JSON format
inputMode=json, messagesJson='[{"role":"user","content":"Explain quantum computing"}]', model=gpt-4o
Example 3: Enforce a JSON schema on the response
inputMode=simple, message="List tools", responseFormat=json, jsonSchema='{"type":"object","properties":{"tools":{"type":"array"}}}'