AI-powered generation and translation for YAMLResume.
npm install @yamlresume/ai
You also need a Vercel AI SDK provider and its API key. For example:
npm install @ai-sdk/openai
All providers expose an OpenAI-compatible endpoint and are configured through environment variables.
| Provider | Required env variable | Default model | Optional overrides |
|---|---|---|---|
| DeepSeek | DEEPSEEK_API_KEY |
deepseek-v4-flash |
YAMLRESUME_AI_MODEL, YAMLRESUME_AI_BASE_URL |
| Kimi (Moonshot AI) | MOONSHOT_API_KEY |
kimi-k2.6 |
YAMLRESUME_AI_MODEL, YAMLRESUME_AI_BASE_URL |
| Ollama (local) | OLLAMA_HOST |
llama3.2 |
YAMLRESUME_AI_MODEL, YAMLRESUME_AI_BASE_URL |
| OpenAI | OPENAI_API_KEY |
gpt-5 |
YAMLRESUME_AI_MODEL, YAMLRESUME_AI_BASE_URL |
The provider is inferred from the env variables in the order shown above. When no provider is detected, Kimi is used as the default so that a missing API key produces a clear configuration error.
The yamlresume CLI uses @yamlresume/ai under the hood. Set a provider API
key and run:
# Generate a new resume
export OPENAI_API_KEY=sk-...
yamlresume ai generate --position "Software Engineer" --language en resume.yml
Override the model or endpoint when needed:
export YAMLRESUME_AI_MODEL=gpt-5
export YAMLRESUME_AI_BASE_URL=https://custom.openai.endpoint/v1
yamlresume ai generate --position "Registered Nurse" --language en resume.yml
import { generateResume } from "@yamlresume/ai";
import { openai } from "@ai-sdk/openai";
const model = openai("gpt-5");
const yaml = await generateResume({
position: "Registered Nurse",
language: "en",
model,
});
Kimi exposes an OpenAI-compatible endpoint:
import { openai } from "@ai-sdk/openai";
const kimi = openai({
apiKey: process.env.MOONSHOT_API_KEY,
baseURL: "https://api.moonshot.cn/v1",
});
const yaml = await generateResume({
position: "Registered Nurse",
language: "zh-hans",
model: kimi("moonshot-v1-8k"),
});
Both functions parse the LLM output and validate it against ResumeSchema from
@yamlresume/core. If validation fails, the request is retried up to
maxRetries times (default: 2).
const yaml = await generateResume({
position: "Software Engineer",
language: "en",
model,
maxRetries: 3,
});