본문으로 건너뛰기
Apidly Cloud
쿠키 정책

분석 및 광고 쿠키는 수락하지 않으면 꺼진 상태로 유지됩니다. 쿠키 정책

페이지 조회와 세션 녹화를 포함해 공개 페이지가 어떻게 사용되는지 파악하기 위해 Google Analytics와 Microsoft Clarity를, Reddit에서의 광고가 방문과 가입으로 이어지는지 측정하기 위해 Reddit Pixel을 사용하고자 합니다. 사용 여부는 여기에서 선택하실 수 있습니다. 거부해도 사이트 이용에는 변함이 없습니다.

CLI 프로필, 업데이트, 기다리기

프로필로 apidly 명령에 여러 계정을 두고, 검증된 다운로드로 업데이트하고, 서버가 실행되거나 중지될 때까지 스크립트가 기다리게 합니다.

최종 업데이트 2026년 11월 24일읽는 데 2분
Markdown으로 보기

명령줄 도구를 매일 또는 스크립트에서 쓸 때 도움이 되는 세 가지입니다. 각각 SDK나 API로 코드에서 같은 일을 하는 방법도 보여 줍니다.

여러 계정: 프로필

apidly login --profile NAME은 기본 키 옆에 이름을 붙여 키를 저장합니다. 명령 하나에 쓸 프로필은 --profile NAME이나 환경 변수 APIDLY_PROFILE로 고르고, 기본으로 만들려면 apidly config use NAME을 쓰세요. apidly config profiles는 프로필을 나열하고 apidly config profiles rm NAME은 하나를 지웁니다. APIDLY_API_KEY가 설정되어 있으면 저장된 어떤 프로필보다 우선합니다.

apidly login --profile work
apidly config profiles
apidly servers --profile work
APIDLY_PROFILE=work apidly balance
apidly config use work
apidly config profiles rm work

코드에는 프로필이 없습니다. 키마다 각자의 클라이언트입니다. 키는 각각 자기 환경 변수에 두고 코드에는 절대 넣지 마세요.

curl "https://apidly.com/api/v1/me" \
  -H "Authorization: Bearer $APIDLY_WORK_KEY"
import { Apidly } from "@apidly/sdk";

const personal = new Apidly({ apiKey: process.env.APIDLY_API_KEY });
const work = new Apidly({ apiKey: process.env.APIDLY_WORK_KEY });
console.log((await work.billing.balance()).balance);
console.log((await personal.billing.balance()).balance);
import os
from apidly import Client

personal = Client(api_key=os.environ["APIDLY_API_KEY"])
work = Client(api_key=os.environ["APIDLY_WORK_KEY"])
print(work.billing.balance()["balance"])
print(personal.billing.balance()["balance"])

CLI 업데이트하기

apidly update는 더 새 버전을 찾아 이 사이트에서 내려받고 체크섬을 확인한 뒤, 묻고 나서 npm으로 설치합니다. --check는 알려 주기만 하며 새 버전이 있으면 종료 코드 3을 돌려주므로 CI 단계에 알맞습니다. --print는 명령을 실행하지 않고 출력합니다. 현재 버전과 각 파일의 체크섬은 latest.json에도 있습니다.

apidly --version
apidly update --check
apidly update --print
apidly update --yes

curl -fsS "https://apidly.com/downloads/latest.json" | jq -r '.version'
const res = await fetch("https://apidly.com/downloads/latest.json");
const latest = await res.json();
const cli = latest.files.find((f) => f.kind === "cli");
console.log(latest.version, cli.name, cli.sha256);
import json
import urllib.request

with urllib.request.urlopen("https://apidly.com/downloads/latest.json") as res:
    latest = json.load(res)
cli = next(f for f in latest["files"] if f["kind"] == "cli")
print(latest["version"], cli["name"], cli["sha256"])

스크립트에서 서버 기다리기

apidly servers wait ID는 서버가 실행되면 종료 코드 0으로, 그 상태가 될 수 없으면(예: 시작 실패) 1로 끝납니다. --for stopped나 --for destroyed는 그 상태를 기다리고, --timeout은 그 초가 지나면 포기합니다(기본값 600). apidly deploy --wait와 apidly stop --wait는 같은 명령 안에서 기다립니다. Ctrl-C로 기다리기를 끝내면 종료 코드는 130이며 서버는 그대로 둡니다. API에서는 몇 초마다 서버의 status를 읽으세요.

apidly servers wait ins_ID
apidly servers wait ins_ID --for stopped --timeout 300
apidly deploy --plan rtx-4090-1x --template pytorch --yes --wait
apidly stop ins_ID --wait

until [ "$(curl -fsS "https://apidly.com/api/v1/servers/ins_ID" \
  -H "Authorization: Bearer $APIDLY_API_KEY" | jq -r '.server.status')" = running ]; do
  sleep 5
done
import { Apidly } from "@apidly/sdk";

const apidly = new Apidly({ apiKey: process.env.APIDLY_API_KEY });
for (;;) {
  const { server } = await apidly.servers.get("ins_ID");
  if (server.status === "running") break;
  if (server.status === "error" || server.status === "destroyed") {
    throw new Error(server.statusMessage ?? server.status);
  }
  await new Promise((r) => setTimeout(r, 5000));
}
import os
import time
from apidly import Client

client = Client(api_key=os.environ["APIDLY_API_KEY"])
while True:
    server = client.servers.get("ins_ID")["server"]
    if server["status"] == "running":
        break
    if server["status"] in ("error", "destroyed"):
        raise SystemExit(server.get("statusMessage") or server["status"])
    time.sleep(5)

써볼 준비가 되셨나요?

무료 계정을 만들고, 서버를 시작하고 싶을 때 크레딧을 충전하세요. 최소 충전 금액은 $10입니다.

무료 계정 만들기

도움이 되었나요?

해결되지 않았나요? 문의하기