Your First Program
A minimal Spark program selects a model alias, asks a question, and prints the result — like “Hello World” for an AI-first language.
hello.spark
Create a file named hello.spark:
use code
ask "Explain gravity in one sentence" -> text
print text
use code is sugar for
model code — it sets the default model
alias for following ask calls. Aliases like
fast and best are
configured in your runtime, not hardcoded vendor strings.
Run it
./spark --dry-run hello.spark
Dry-run returns a fixture reply so you can iterate without an API key. For a real response:
export OPENAI_API_KEY=your_key
./spark --live hello.spark
Optional sugar
Spark supports shorthand for quick scripts:
use fast
? "Explain gravity in one sentence" -> text
print text
? is sugar for
ask. Try it on the
Playground page or see
language reference.
Next lesson
AI in 5 Minutes — classify, extract, and pipeline in one short lesson.