Quickstart
Run your first AI agent on Pai in under 5 minutes -- no container image, no YAML.
Prerequisites
paiCLI installed and logged in (see Getting Started)- An API key for any supported LLM provider (Anthropic, OpenAI, Google Gemini, OpenRouter, or any OpenAI-compatible endpoint like NVIDIA NIM or vLLM)
Step 1: Store your API key
A ModelProvider holds your LLM credentials. You only need to create it once per API subscription — all agents in the namespace can then reference models from it. Pick the provider you have a key for:
- Anthropic
- OpenAI
- Google Gemini
- NVIDIA NIM
- OpenRouter
pai create model-provider anthropic \
--provider anthropic \
--api-key YOUR_ANTHROPIC_API_KEY
Models referenced as anthropic/claude-sonnet-4-6, anthropic/claude-haiku-4-5, etc. Get a key at console.anthropic.com.
pai create model-provider openai \
--provider openai \
--api-key YOUR_OPENAI_API_KEY
Models referenced as openai/gpt-4.1, openai/gpt-4o-mini, etc. Get a key at platform.openai.com.
pai create model-provider gemini \
--provider google \
--api-key YOUR_GEMINI_API_KEY
Models referenced as gemini/gemini-2.5-flash, gemini/gemini-2.5-pro, etc. Get a key at aistudio.google.com.
NVIDIA NIM exposes an OpenAI-compatible API at a custom endpoint. Use --provider openai with --endpoint and an --allowed-models allowlist so the CLI knows which models to expose:
pai create model-provider nvidia \
--provider openai \
--endpoint https://integrate.api.nvidia.com/v1 \
--allowed-models "z-ai/glm4.7,meta/llama-3.1-70b-instruct" \
--api-key YOUR_NVIDIA_API_KEY
Models referenced as nvidia/z-ai/glm4.7, nvidia/meta/llama-3.1-70b-instruct, etc. Get a key at build.nvidia.com.
pai create model-provider openrouter \
--provider openrouter \
--api-key YOUR_OPENROUTER_API_KEY
Models referenced as openrouter/anthropic/claude-sonnet-4.5, openrouter/google/gemini-2.5-pro, etc. Get a key at openrouter.ai/keys.
You can create more than one ModelProvider in the same namespace (e.g. Anthropic for production and NVIDIA NIM for experiments). Agents pick which one to use by prefixing the model name with the ModelProvider name: anthropic/claude-sonnet-4-6 or nvidia/z-ai/glm4.7.
Verify:
pai get model-providers
# NAME PROVIDER ENDPOINT MAX/DAY LAST USED AGE
# ────────────────────────────────────────────────────────────
# anthropic anthropic — 5s
The LAST USED column shows how recently each provider served an LLM call (— means unused yet). Handy for spotting stale providers you can clean up.
Step 2: Create an Agent
An Agent describes what the agent can do -- which model to use, what tools it has, and its system prompt. No container image needed; the Pai harness provides the runtime.
- Anthropic
- OpenAI
- Google Gemini
- NVIDIA NIM
- OpenRouter
pai apply -f - <<'EOF'
apiVersion: pai.io/v1
kind: Agent
metadata:
name: my-agent
spec:
models:
- anthropic/claude-sonnet-4-6
system: |
You are a helpful assistant. When asked to write files,
save them under /tmp/.
EOF
pai apply -f - <<'EOF'
apiVersion: pai.io/v1
kind: Agent
metadata:
name: my-agent
spec:
models:
- openai/gpt-4.1
system: |
You are a helpful assistant. When asked to write files,
save them under /tmp/.
EOF
pai apply -f - <<'EOF'
apiVersion: pai.io/v1
kind: Agent
metadata:
name: my-agent
spec:
models:
- gemini/gemini-2.5-flash
system: |
You are a helpful assistant. When asked to write files,
save them under /tmp/.
EOF
pai apply -f - <<'EOF'
apiVersion: pai.io/v1
kind: Agent
metadata:
name: my-agent
spec:
models:
- nvidia/z-ai/glm4.7
system: |
You are a helpful assistant. When asked to write files,
save them under /tmp/.
EOF
pai apply -f - <<'EOF'
apiVersion: pai.io/v1
kind: Agent
metadata:
name: my-agent
spec:
models:
- openrouter/anthropic/claude-sonnet-4.5
system: |
You are a helpful assistant. When asked to write files,
save them under /tmp/.
EOF
Step 3: Run a task
pai run hello --agent my-agent --task "Write a haiku about Kubernetes and save it to /tmp/haiku.txt"
You'll see the agent's reasoning and tool calls stream in real time. When it finishes, check the output:
pai logs hello
That's it -- no Dockerfile, no YAML deployment, no infrastructure to manage.
What's next?
- Chat with a running agent --
pai chat helloto send follow-up messages - Long-running service agents -- deploy a persistent agent with a custom image using
pai apply -f agent.yaml. See the Agent reference - Add external services -- give your agent access to GitHub, Telegram, AWS and more with Providers
- Browser automation -- connect a local Chrome browser with the CDP relay