Skip to content

Hello World

Let’s write a simple program that uses AI to translate “Hello World” into multiple languages.

Create a file called hello.vibe:

model translator = {
name: "claude-haiku-4-5-20251001",
provider: "anthropic",
apiKey: env("ANTHROPIC_API_KEY")
}
const languages: text[] = do "List the major human languages"
for language in languages {
const translated = do "Translate 'Hello World' into {language}"
print(translated)
}
Terminal window
vibe hello.vibe

You’ll see “Hello World” translated into various languages!

Let’s break down what’s happening:

model translator = {
name: "claude-haiku-4-5-20251001",
provider: "anthropic",
apiKey: env("ANTHROPIC_API_KEY")
}

This configures which AI model to use. The env() function reads from your environment variables.

const languages: text[] = do "List the major human languages"

The do keyword sends a prompt to the AI and returns the result. Here we’re asking for a list of languages and typing it as text[] (array of strings).

for language in languages {
const translated = do "Translate 'Hello World' into {language}"
print(translated)
}

The {language} syntax creates a reference that the AI can see in context. The AI knows what language contains and uses it to complete the task. See AI Prompts for more on interpolation.

Switch to OpenAI by changing the model:

model translator = {
name: "gpt-5.2",
provider: "openai",
apiKey: env("OPENAI_API_KEY")
}

Or Google:

model translator = {
name: "gemini-3-flash",
provider: "google",
apiKey: env("GOOGLE_API_KEY")
}

Now that you’ve written your first program, learn about: