Groq API Module for Duso

Access Groq's ultra-fast inference API directly from Duso scripts.

Setup

Set your API key as an environment variable:

export GROQ_API_KEY=gsk_xxxxx
duso script.du

Or pass it explicitly:

groq = require("groq")
response = groq.prompt("Hello", {key = "gsk_xxxxx"})

Quick Start

groq = require("groq")

// One-shot query
response = groq.prompt("What is Groq?")
print(response)

// Multi-turn conversation
chat = groq.session({
  system = "You are a helpful assistant",
  model = "mixtral-8x7b-32768"
})

response1 = chat.prompt("What is Groq known for?")
response2 = chat.prompt("What are its advantages?")
print(chat.usage)

Available Models

See Groq's models page for latest list.

Configuration Options

Same as OpenAI module - see openai.md for full reference.

Key differences:

Environment Variables

See Also