Skip to content

xiaoqianran/kaggle-demo / skills

kaggle-cli

Verified

Use the local Kaggle CLI skill for command guidance, workflows, and troubleshooting across competitions, datasets, kernels/notebooks, models, model variations and versions, inbox file uploads, forums/discussions, benchmarks, configuration, OAuth/API-token authentication, and accelerator quota. Activate this skill when the user asks about kaggle CLI commands, examples, flags, metadata files, download/upload flows, submissions, benchmark tasks, or Kaggle CLI behavior.

FileKindSize
SKILL.mdskill md4.2 KB
references/auth.mdmarkdown3.5 KB
references/benchmarks.mdmarkdown25.1 KB
references/competitions.mdmarkdown11.3 KB
references/configuration.mdmarkdown2.7 KB
references/datasets.mdmarkdown7.5 KB
references/files.mdmarkdown2.0 KB
references/forums.mdmarkdown2.9 KB
references/kernels.mdmarkdown6.0 KB
references/model_variations.mdmarkdown4.2 KB
references/model_variations_versions.mdmarkdown3.5 KB
references/models.mdmarkdown4.8 KB
references/quota.mdmarkdown1.2 KB
references/search.mdmarkdown2.4 KB

references/auth.md

View on GitHub
# Authentication CLI Reference

Use `kaggle auth` to run OAuth login, print an OAuth access token, or revoke the
active OAuth refresh token. The CLI also supports non-command authentication via
`KAGGLE_API_TOKEN`, `~/.kaggle/access_token`, and legacy API key credentials.

## Prerequisites

- Python 3.11+ with the `kaggle` package installed.
- A Kaggle account.
- Browser access for the default OAuth login flow, or use `--no-launch-browser`
  to print a URL.

## Command Hierarchy

```text
kaggle auth
├── login
├── print-access-token
└── revoke
```

## Authentication Sources

The CLI authentication flow tries these sources:

1. Access token sources such as `KAGGLE_API_TOKEN` or
   `~/.kaggle/access_token`.
2. Legacy API key config from environment/config values `username` and `key`.
3. OAuth credentials created by `kaggle auth login`.

If none succeed, the CLI prints auth help and exits.

Some commands are allowed logged out, including help/version and selected
public dataset file/download flows.

## `kaggle auth login`

Runs Kaggle OAuth login.

**Usage:**

```bash
kaggle auth login [options]
```

**Options:**

- `--no-launch-browser`: Do not launch a browser; print an auth URL instead.
- `--force`: Re-run login even if already logged in.

**Examples:**

```bash
kaggle auth login
kaggle auth login --no-launch-browser
kaggle auth login --force
```

**Purpose:** Store OAuth credentials for the active Kaggle account.

**Behavior details:**

- If credentials already exist and `--force` is not set, the command prints the
  current account and exits with instructions to use `--force`.
- The OAuth flow requests the default scope `resources.admin:*`.

## `kaggle auth print-access-token`

Prints an access token for the active OAuth account.

**Usage:**

```bash
kaggle auth print-access-token [options]
```

**Options:**

- `--expiration <DURATION>`: Override token duration. A positive integer
  followed by a unit suffix: `s` (seconds), `m` (minutes), `h` (hours),
  `d` (days) or `w` (weeks). Example: `6h`, `30m`, `2d`.

**Examples:**

```bash
kaggle auth print-access-token
kaggle auth print-access-token --expiration 6h
```

**Purpose:** Emit a token that can be placed in `KAGGLE_API_TOKEN` or another
supported token source.

**Behavior details:**

- Requires OAuth credentials from `kaggle auth login`.
- If no OAuth credentials exist, the command tells the user to run
  `kaggle auth login`.
- `--expiration` accepts a positive integer followed by a single unit suffix
  (`s`, `m`, `h`, `d`, `w`), e.g. `6h` or `2d`. Compound (`2h30s`) and colon
  (`2:30`) formats are not supported.

## `kaggle auth revoke`

Revokes the active OAuth refresh token.

**Usage:**

```bash
kaggle auth revoke [options]
```

**Options:**

- `--reason <TEXT>`: Reason sent to the server.

**Examples:**

```bash
kaggle auth revoke
kaggle auth revoke --reason "rotating credentials"
```

**Purpose:** Invalidate the active OAuth credential.

**Behavior details:**

- If no OAuth credentials exist, the command prints `There is no token to
  revoke.` and exits successfully.
- If no reason is provided, the default reason is
  `Manually revoked by user with kaggle-cli`.

## Legacy And Token Auth Notes

- `KAGGLE_API_TOKEN` can authenticate without a legacy username/key pair when
  the token introspection succeeds.
- Legacy config can come from `~/.kaggle/kaggle.json` or environment variables
  such as `KAGGLE_USERNAME` and `KAGGLE_KEY`.
- Prefer `kaggle auth login` for OAuth credentials or `KAGGLE_API_TOKEN` for
  non-interactive authentication.
deprecation-and-migrationaddyosmani/agent-skillsManages deprecation and migration. Use when removing old systems, APIs, or features. Use when migrating users from one implementation to another. Use when migrating a database schema in production, such as renaming or dropping a column without downtime (expand/contract). Use when deciding whether to maintain or sunset existing code.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
performance-optimizationaddyosmani/agent-skillsOptimizes application performance across frontend, backend, queries, and databases. Use when performance requirements exist, when you suspect performance regressions, when Core Web Vitals or load times need improvement, when N+1 query patterns need fixing, or when profiling reveals bottlenecks.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
agent-cost-reportthedotmack/claude-memBelievable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json.Stars: 118kUpdated Claude CodeCodexVerifiedInstall
agent-cost-reportthedotmack/claude-memBelievable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json.Stars: 118kUpdated Claude CodeCodexVerifiedInstall