CloneAI for Agents

接続のしかた

CloneAI for Agents につなぐ入口と、それぞれに必要なものです。いま使える入口は REST API だけです。

いま使える入口
REST API https://ai.cloneai.jp/api/v1(JSON)
準備中
CLI・手元で動かす MCP(stdio)・リモートの MCP の接続口(/mcp)。配布物はまだありません
認証
API キー(Authorization: Bearer cga_…)。キーが無ければ登録(初回だけ)

入口ごとの状態と、必要な能力

入口状態必要な能力設定
REST API提供中HTTPS で JSON を送れる・Authorization の見出しを付けられる・依頼の本文と Idempotency-Key を残せる(ファイルなど)API キー(例では環境変数 CLONEAI_API_KEY に入れる。名前は自由)
CLI準備中(配布物なし)——
MCP(手元で動かす stdio)準備中(配布物なし)——
MCP(リモートの接続口 /mcp)準備中——

CLI と手元の MCP は、配布を始めたら、配布物・版・確かめたホストと版の組み合わせをこのページに載せます。確かめていない組み合わせは「未確認」と書きます。

REST:最短の手順(bash)

# 1. API キー(cga_…)を環境変数に置く。コマンドの行・依頼の本文・ログに鍵を書かない(cga_… は自分のキーに置き換える)
export CLONEAI_API_KEY='cga_…'

# 2. 受付の状態を見る(認証なし。accepting_jobs が true なら受付中)
curl https://ai.cloneai.jp/api/v1/capabilities

# 3. 自分のエージェントの ID と利用枠を確かめる(API キーだけで読む。作用なし。送り直す前にも、同じエージェントかをここで確かめる)
curl https://ai.cloneai.jp/api/v1/agents/me -H "Authorization: Bearer $CLONEAI_API_KEY"

# 4. 依頼の本文をファイルに書く(送り直すときも、このファイルをそのまま使う)
cat > request.json <<'EOF'
{"target":{"population":"synthetic_panel","max_respondents":30},"questions":[{"type":"choice","text":"在宅勤務を週に何日まで認める制度が望ましいと思いますか。","options":["週0日","週1〜2日","週3〜4日","毎日でもよい"]}],"visibility":"private"}
EOF

# 5. この依頼の Idempotency-Key(UUID v4)を 1 回だけ作り、ファイルに残す(送り直すときに作り直さない。uuidgen が無ければ python3 -c 'import uuid;print(uuid.uuid4())')
uuidgen > request.key

# 6. 受付(job_id がすぐ返る)。応答が届いたか分からないときは、同じ 2 つのファイルのまま送り直す(キーの記録がある間は二重に受け付けない)
curl -X POST https://ai.cloneai.jp/api/v1/surveys -H "Authorization: Bearer $CLONEAI_API_KEY" -H "Idempotency-Key: $(cat request.key)" \
  -H "Content-Type: application/json" --data-binary @request.json

# 7. 進み具合(最大 30 秒待って返す。終わっていなければ retry_after_seconds の後にもう一度)
curl https://ai.cloneai.jp/api/v1/jobs/job_… -H "Authorization: Bearer $CLONEAI_API_KEY" -H "Prefer: wait=30"

# 8. 結果(format は json・md・csv)
curl "https://ai.cloneai.jp/api/v1/jobs/job_…/result?format=json" -H "Authorization: Bearer $CLONEAI_API_KEY"

REST:最短の手順(PowerShell)

# 1. API キー(cga_…)を環境変数に置く(このシェルの中だけ。cga_… は自分のキーに置き換える)
$env:CLONEAI_API_KEY = 'cga_…'

# 2. 受付の状態を見る(認証なし)
curl.exe https://ai.cloneai.jp/api/v1/capabilities

# 3. 自分のエージェントの ID と利用枠を確かめる(API キーだけで読む。作用なし)
curl.exe https://ai.cloneai.jp/api/v1/agents/me -H "Authorization: Bearer $env:CLONEAI_API_KEY"

# 4. 依頼の本文をファイルに書く(UTF-8・BOM なし。送り直すときも、このファイルをそのまま使う)
[IO.File]::WriteAllText("$PWD\request.json", '{"target":{"population":"synthetic_panel","max_respondents":30},"questions":[{"type":"choice","text":"在宅勤務を週に何日まで認める制度が望ましいと思いますか。","options":["週0日","週1〜2日","週3〜4日","毎日でもよい"]}],"visibility":"private"}')

# 5. この依頼の Idempotency-Key(UUID v4)を 1 回だけ作り、ファイルに残す(送り直すときに作り直さない)
[IO.File]::WriteAllText("$PWD\request.key", [guid]::NewGuid().ToString())

# 6. 受付。応答が届いたか分からないときは、同じ 2 つのファイルのまま送り直す
curl.exe -X POST https://ai.cloneai.jp/api/v1/surveys -H "Authorization: Bearer $env:CLONEAI_API_KEY" -H "Idempotency-Key: $(Get-Content request.key)" -H "Content-Type: application/json" --data-binary '@request.json'

# 7. 進み具合(最大 30 秒待つ)
curl.exe https://ai.cloneai.jp/api/v1/jobs/job_… -H "Authorization: Bearer $env:CLONEAI_API_KEY" -H "Prefer: wait=30"

# 8. 結果(format は json・md・csv)
curl.exe "https://ai.cloneai.jp/api/v1/jobs/job_…/result?format=json" -H "Authorization: Bearer $env:CLONEAI_API_KEY"

送り直しの決まり

対応していない条件

完全な仕様

In English

The REST API (https://ai.cloneai.jp/api/v1) is the only way in now. A CLI, a local MCP server (stdio) and a remote MCP endpoint (/mcp) are not available yet; when they are released, only verified host and version combinations will be listed here. To submit a survey: keep your API key in an environment variable, write the request body to a file, create one Idempotency-Key (UUID) for that request and save it, then POST with both. If you do not know whether a response arrived, resend the same key and the same file (no second job while the key record is kept, 24 hours). A preview (POST /api/v1/surveys/preview) creates no job and returns only a preview_id. If its response is lost, there is no way to fetch that preview again. If you need it, preview again, knowing that it uses another daily preview (sandbox 10, verified 60) and, with a target.description, another conversion cost. If you do not need a preview, submit the original request body (not a preview_id). Registration and key issuance create a new operator or key on every request, so do not resend them automatically. For cancel, delete and publication requests, read the job state first. The bash and PowerShell steps above use the same commands as /en.