About
A function is one handler: you write it, and we add a small runtime that serves it over HTTP, build it and run it like a Container that stops when idle. The same code shows in the Console’s editor, so you can edit it there or locally: th functions pull fetches what the Console saved and th functions deploy sends your folder back.
| Runtimes | Main file | Handler |
|---|---|---|
python314, python313 (recommended), python312, python311 | main.py (+ requirements.txt) | def main(request) returning a str, dict (JSON) or (body, status, headers) |
nodejs24 (recommended), nodejs22 | index.ts or index.js (+ package.json) | export async function handler(req: Request) returning a Response, string or object |
go126 (recommended), go125 | *.go + go.mod | func Handle(w http.ResponseWriter, r *http.Request) |
A function has at most 100 text files, 512 KiB each and 2 MiB in all. Files in .thignore (else .dockerignore, else .gitignore), .git, node_modules, .venv, __pycache__ and dist are left out, and a Dockerfile is ignored. Builds are billed like Container builds. To run it on a schedule or for every queue message, add a trigger with th triggers.
How-to guides
Deploy a function from a folder
mkdir hello && cd hello
printf 'def main(request):\n return {"message": "Hello, " + request.args.get("name", "World")}\n' > main.py
th functions deploy hello --env GREETING=hi
th functions call hello --path "/?name=Thai"The first deploy creates the function; its runtime comes from the files (or --runtime). th waits for the build and prints the URL. --async returns once the build is queued.
Go back to an earlier version
th functions versions list hello
th functions versions activate hello 12
th functions pull hello --version 12 --dir hello-v12Every deploy is a version, and the latest 30 are kept. Activating one serves it again with today’s settings and variables; if its image was cleaned up, its code is built again as a new version. --runtime on a deploy moves the function to another version of its language, e.g. --runtime python314.
Run a function only from its triggers
th functions deploy nightly-report --ingress triggers
th triggers create nightly --service nightly-report --schedule "0 3 * * *"With --ingress triggers the function has no endpoint at all: no public URL, no custom domain and no address inside the project’s VPC. Only its Cron and Queue triggers reach it, and th triggers run runs one now. --ingress all opens it again.
Edit in the Console, then work locally
th functions pull hello --dir hello
# edit the files
th functions deploy hello --source hellopull keeps local files that differ unless you pass --force.
Commands
| Command | Description |
|---|---|
th functions deploy | Uploads the files of DIR (default .) as the function's code, builds them and serves the result. |
th functions list | Lists the functions of the active Project. |
th functions describe | Shows a function's runtime, deploy state, settings and files. |
th functions pull | Writes the function's saved code (what the Console editor shows), or the code of one version, into DIR (default ./NAME). |
th functions call | Sends one request to the function and prints the answer. |
th functions logs | Prints the latest log lines of a function (what the handler printed). |
th functions versions list | Lists a function's versions, newest first. |
th functions versions activate | Serves an earlier version again; today's settings and variables stay. |
th functions runtimes | Lists the runtimes a function can use and the handler each expects. |
th functions delete | Deletes a function with its code, triggers and revisions. |
th functions deploy
Uploads the files of DIR (default .) as the function's code, builds them and serves the result.
Syntax
th functions deploy NAME [--source DIR] [flags]A new function is created first; its runtime comes from --runtime or from the files (go.mod: Go, package.json / index.ts: Node.js, main.py / requirements.txt: Python).
Files listed in .thignore (or .dockerignore / .gitignore), .git, node_modules, .venv, __pycache__ and dist are left out. A Dockerfile is ignored: functions always build with the platform's runtime.
--runtime takes a runtime (python313, nodejs24, go126) or a language (python, nodejs, go: its recommended version). An existing function may move to another version of its language.
Every deploy is kept as a version (th functions versions list); --message describes it. --ingress sets who reaches the function: all (the internet, the default), internal (other services in its project) or triggers (no endpoint at all; only its Cron and Queue triggers run it). --env, --set-env-vars and --secret-env replace every variable of the function; without them the current variables stay. Settings given for an existing function (--cpu, --memory, --min-instances, ...) are applied before its code is built.
Examples
th functions deploy helloth functions deploy hello --runtime python314 --message "Python 3.14"th functions deploy orders --source ./orders --memory 512Mi --max-instances 10th functions deploy nightly-report --ingress triggersPositional arguments
| Name | Description |
|---|---|
NAMERequired | The function’s name: lowercase letters, digits and -, starting with a letter. It is also its URL slug. |
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
--source | string | . | Directory with the function's files |
--runtime | string | Runtime (e.g. python313, nodejs24, go126) or language (python, nodejs, go) | |
--entry-point | string | the runtime's, e.g. main, handler, Handle | Handler name |
--cpu | string | vCPU, e.g. 0.25, 0.5, 1 (a size of the Container menu) | |
--memory | string | Memory, e.g. 256Mi, 512Mi, 1Gi | |
--compute-class | string | Compute class of a new function | |
--env | list | Environment variable KEY=VALUE (repeatable) | |
--set-env-vars | list | Environment variables KEY=VALUE,KEY2=VALUE2 | |
--secret-env | list | Secret environment variable KEY=VALUE (repeatable) | |
--min-instances | number | Minimum instances (0 stops it when idle) | |
--max-instances | number | Maximum instances | |
--timeout | string | Request timeout, e.g. 60s or 5m | |
--concurrency | number | Requests at once per instance (1-1000) | |
--cpu-always-allocated | flag | Keep CPU between requests | |
--allow-unauthenticated | flag | for a new function; --no-allow-unauthenticated needs an invoker token | Allow public calls |
--ingress | string | Who reaches the function: all, internal or triggers (no endpoint, triggers only) | |
--message | string | Describe this version | |
--async | flag | Return once the build is queued |
Global parameters
This command also takes the global parameters: --project, --region, --endpoint, --format, --quiet.
th functions list
Lists the functions of the active Project.
Syntax
th functions listGlobal parameters
This command also takes the global parameters: --project, --region, --endpoint, --format, --quiet.
th functions describe
Shows a function's runtime, deploy state, settings and files.
Syntax
th functions describe NAMEPositional arguments
| Name | Description |
|---|---|
NAMERequired | The function’s name: lowercase letters, digits and -, starting with a letter. It is also its URL slug. |
Global parameters
This command also takes the global parameters: --project, --region, --endpoint, --format, --quiet.
th functions pull
Writes the function's saved code (what the Console editor shows), or the code of one version, into DIR (default ./NAME).
Syntax
th functions pull NAME [--dir DIR] [--version N] [--force]An existing file with other content is kept unless --force.
Positional arguments
| Name | Description |
|---|---|
NAMERequired | The function’s name: lowercase letters, digits and -, starting with a letter. It is also its URL slug. |
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
--dir | string | ./NAME | Directory to write into |
--version | string | the saved code | A version from th functions versions list |
--force | flag | Overwrite files that differ |
Global parameters
This command also takes the global parameters: --project, --region, --endpoint, --format, --quiet.
th functions call
Sends one request to the function and prints the answer.
Syntax
th functions call NAME [--data BODY|@FILE] [--method POST] [--path /x] [--token TOKEN]With --data the method defaults to POST, otherwise GET. --token is the invoker token of a function that does not allow unauthenticated calls.
Positional arguments
| Name | Description |
|---|---|
NAMERequired | The function’s name: lowercase letters, digits and -, starting with a letter. It is also its URL slug. |
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
--data | string | Request body, or @FILE to read it from a file | |
--method | string | HTTP method | |
--path | string | / | Path to call |
--token | string | Invoker token |
Global parameters
This command also takes the global parameters: --project, --region, --endpoint, --format, --quiet.
th functions logs
Prints the latest log lines of a function (what the handler printed).
Syntax
th functions logs NAME [--lines N]Positional arguments
| Name | Description |
|---|---|
NAMERequired | The function’s name: lowercase letters, digits and -, starting with a letter. It is also its URL slug. |
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
--lines | number | 100 | Number of lines (default 100) |
Global parameters
This command also takes the global parameters: --project, --region, --endpoint, --format, --quiet.
th functions versions list
Lists a function's versions, newest first.
Syntax
th functions versions list NAMEEvery deploy is a version; the serving one is marked. The latest 30 are kept.
Positional arguments
| Name | Description |
|---|---|
NAMERequired | The function’s name: lowercase letters, digits and -, starting with a letter. It is also its URL slug. |
Global parameters
This command also takes the global parameters: --project, --region, --endpoint, --format, --quiet.
th functions versions activate
Serves an earlier version again; today's settings and variables stay.
Syntax
th functions versions activate NAME VERSIONWhen the registry no longer holds its image, its code is built again as a new version and served once the build succeeds.
Examples
th functions versions activate hello 12th functions versions activate hello v12Positional arguments
| Name | Description |
|---|---|
NAMERequired | The function’s name: lowercase letters, digits and -, starting with a letter. It is also its URL slug. |
VERSIONRequired |
Global parameters
This command also takes the global parameters: --project, --region, --endpoint, --format, --quiet.
th functions runtimes
Lists the runtimes a function can use and the handler each expects.
Syntax
th functions runtimesGlobal parameters
This command also takes the global parameters: --project, --region, --endpoint, --format, --quiet.
th functions delete
Deletes a function with its code, triggers and revisions.
Syntax
th functions delete NAME [--quiet]--quiet skips the prompt.
Positional arguments
| Name | Description |
|---|---|
NAMERequired | The function’s name: lowercase letters, digits and -, starting with a letter. It is also its URL slug. |
Global parameters
This command also takes the global parameters: --project, --region, --endpoint, --format, --quiet.