LLM chat

Ask Anthropic, OpenAI or Gemini with your own vault key through the completion endpoint; text or JSON out.

  • AI
  • Since 0.2.0
  • ai
  • llm
  • chat
  • claude
  • openai
  • gemini
  • prompt
  • json
  • data

Open in TuneToys

LLM chat as the Patch draws it, at default values: inlets on the left, outlets on the right.

LLM chat sends a prompt to a language model with your own API key and sends the answer into the Patch as text or JSON.

What it does#

With trigger cabled, each trigger asks once; otherwise a new prompt does. The request goes to the Tune.Toys completion endpoint (POST /v1/ai/complete), which reads your key from the vault slot named after the provider (anthropic, openai or gemini) and calls the provider on the server. The key never reaches the browser or the Toy, and the platform's own key is never used for this node. Usage is billed to your key and shown on usage as tokens, model and provider.

The node's system field (up to 8 KiB) sets the instructions. context adds either a list of { role, content } messages as conversation history or any JSON as extra context. With Format JSON the model is asked for one JSON value, which arrives parsed on json; text always carries the raw answer, and bytes carries a data: base64 payload if the answer contains one.

A Toy with LLM chat requires the network and the provider's vault slot; the Play surface shows a chip until both are ready. During replay the model is not asked again: the recorded answers are played back, so a take plays without a key.

When to use it#

Use it to generate material: a melody as JSON for Data to MIDI, words for a display, settings from a description. Collect inputs with Merge to give it context.

Ports#

PortDirectionSignalLanes
promptInputData (json)1
triggerInputData (trigger)1
contextInputData (json)1
textOutputData (string)1
jsonOutputData (json)1
bytesOutputData (bytes)1
usageOutputData (json)1
errorOutputData (string)1

Parameters#

ParameterLabelRangeDefaultUnitScaleNotes
providerProvider0 to 20linearModel provider; its key comes from the vault slot of the same name. Choices: 0 Anthropic, 1 OpenAI, 2 Gemini.
formatFormat0 to 10linearAsk for plain text or a JSON value. Choices: 0 Text, 1 JSON.
max_tokensMax tokens1 to 81921024linearLongest response in tokens.
temperatureTemperature0 to 21linearHigher values make answers more varied.
  • model: text.
  • system: text.

Provider (provider)#

Anthropic, OpenAI or Gemini. Its key comes from the vault slot of the same name. The node's model field picks a model; it defaults to the first model the addon manifest pins and accepts any other model id.

Format (format)#

Text, or JSON to ask for a single JSON value on json.

Max tokens (max_tokens)#

The longest answer, 1 to 8 192 tokens. Longer answers cost more.

Temperature (temperature)#

0 to 2. Low values give steadier answers; higher values more varied ones.

Tips#

  • Ask for exactly the JSON shape you want, and test it with a Console log on text and error.
  • Record a take of a good answer: it replays anywhere without a key.

See also#

Data to MIDI, Merge, Secrets and the vault, Data cables.

Help patches

Each help patch is an ordinary Toy that teaches one idea. The diagram shows the Patch; the preview shows its Frame. Open it in TuneToys to play and edit it.

1. Ask for a haiku

beginner Teaches: provider, format, max_tokens, temperature

A prompt goes to a language model with your own vault key; the answer is logged.

Patch: Value value output connected to Convert value input. LLM chat text output connected to Console log “log” value input. LLM chat error output connected to Console log “oops” value input. Convert value output connected to LLM chat prompt input.
Connections as text
  • Value value output connected to Convert value input
  • LLM chat text output connected to Console log “log” value input
  • LLM chat error output connected to Console log “oops” value input
  • Convert value output connected to LLM chat prompt input
  • Provider Anthropic uses the vault slot anthropic; the Toy only names the provider.
  • Format Text; JSON asks for one JSON value on the json output.
Frame preview: Ask for a haikuFrame “Ask for a haiku” with 2 elements: text heading, text hint.ASK FOR A HAIKUNeeds sign-in and your own anthropic key in Settings → Vault. Usage is billed t…
Frame preview (static). Controls show their default values.

Open in TuneToys

  • Data to MIDI Play a JSON list of notes in beats as MIDI on each trigger, scheduled on the transport.
  • Merge Combine up to eight inputs into one JSON object keyed by port, when any or all have arrived.
  • Console log Write each incoming value to the Console panel with a level and label, rate-limited.

Edit this page on GitHub

esc

↑ ↓ move↩ open⌘↩ new tabesc close