API ドキュメント
API Many は1つのベース URL と1つのキーですべてのモデルを提供します。テキストのエンドポイントは OpenAI・Anthropic 形式に準拠しているため公式 SDK がそのまま使え、画像・動画・音楽は非同期タスクとして実行されます。
ベース URL https://apimany.com/v1
クイックスタート
curl https://apimany.com/v1/chat/completions \
-H "Authorization: Bearer $APIMANY_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "claude-sonnet-5-5", "messages": [{"role": "user", "content": "Hello"}]}'認証
キーは Authorization ヘッダーで Bearer トークンとして送ります。キーは秘密情報です。ブラウザやモバイルアプリではなく、サーバーから API を呼び出してください。
Authorization: Bearer sk_apimany_xxxxxxxxxxxxxxxx
# Anthropic-style clients may send the key as:
x-api-key: sk_apimany_xxxxxxxxxxxxxxxxSDK
公式 OpenAI SDK(Python、Node.js、Go、Java、.NET)は base_url を https://apimany.com/v1 に、公式 Anthropic SDK は https://apimany.com に設定します。メディアのエンドポイントは任意の HTTP クライアントで使えます。
課金
すべてのリクエストは開始時に最大費用を残高から仮押さえし、完了時に精算されます:
- テキスト:モデルが報告した入力・キャッシュ・出力トークンを、モデルページの100万トークン単価で課金します。
- 画像:選んだ解像度または品質で1枚ごとに課金。トークン課金の画像モデルは報告された使用量で精算します。
- 動画:選んだ解像度で1秒ごとに課金(長さ固定のモデルはクリップ単位)。
- 失敗・拒否・タイムアウトしたリクエストは課金されず、仮押さえ分は全額戻ります。
Idempotency-Key ヘッダー(1〜200文字)を送ると安全に再試行できます。同じキーなら再実行せず元の記録を返します。
Chat completions POST/v1/chat/completions
Claude、Gemini、DeepSeek、Grok、Qwen、Kimi を含むすべての言語モデルで使える OpenAI 互換チャット。ストリーミング・ツール・JSON モード・画像入力は OpenAI 形式に従い、ストリーミングでは最後のチャンクに使用量が含まれます。
curl https://apimany.com/v1/chat/completions \
-H "Authorization: Bearer $APIMANY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-v4.1-flash",
"stream": true,
"messages": [
{"role": "system", "content": "You are concise."},
{"role": "user", "content": "Summarize HTTP/3 in two sentences."}
]
}'Anthropic Messages POST/v1/messages
Claude モデルはネイティブの Anthropic Messages API にも対応し、ストリーミング、ツール利用、拡張思考、プロンプトキャッシュが使えます。anthropic-version と anthropic-beta ヘッダーはそのまま転送されます。
import anthropic
client = anthropic.Anthropic(base_url="https://apimany.com", api_key="YOUR_API_KEY")
message = client.messages.create(
model="claude-opus-5-5",
max_tokens=1024,
messages=[{"role": "user", "content": "Write a haiku about APIs."}],
)
print(message.content[0].text)Responses POST/v1/responses
対応モデル向けの OpenAI Responses API。
curl https://apimany.com/v1/responses \
-H "Authorization: Bearer $APIMANY_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "gpt-6.1-sol", "input": "Explain recursion to a child."}'埋め込み POST/v1/embeddings
curl https://apimany.com/v1/embeddings \
-H "Authorization: Bearer $APIMANY_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "text-embedding-3-small", "input": ["first text", "second text"]}'画像 POST/v1/images/generations
テキストからの画像生成と画像編集。各モデルの項目(サイズ・解像度・品質・参照画像)はモデルページに記載されているので、そのとおりに送ります。呼び出しはすぐにタスクを返します:
curl https://apimany.com/v1/images/generations \
-H "Authorization: Bearer $APIMANY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2",
"prompt": "A watercolor fox in a snowy forest",
"size": "16:9",
"resolution": "2k",
"image_urls": ["https://example.com/style-reference.png"]
}'{
"id": "2c7f9a8e-0d1b-4b5e-9a5d-6f0c1e2d3a4b",
"object": "generation.task",
"model": "seedance-2.5",
"status": "pending",
"reserved_usd": 2.16,
"task_id": "2c7f9a8e-0d1b-4b5e-9a5d-6f0c1e2d3a4b"
}動画 POST/v1/videos/generations
モデルに応じて、テキストから動画、画像から動画、参照、編集、延長に対応。秒単位のモデルは指定した長さを仮押さえし、届いたクリップで精算します。
curl https://apimany.com/v1/videos/generations \
-H "Authorization: Bearer $APIMANY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "seedance-2.5",
"prompt": "Slow dolly-in on a neon alley after rain",
"resolution": "720p",
"duration": 8,
"size": "16:9",
"callback_url": "https://your-app.com/webhooks/apimany"
}'音楽 POST/v1/music/generations
curl https://apimany.com/v1/music/generations \
-H "Authorization: Bearer $APIMANY_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "suno", "custom": false, "version": "v6", "prompt": "Late-night lo-fi piano with soft rain"}'タスクとポーリング GET/v1/tasks/{id}
status が completed または failed になるまで 3〜10 秒ごとにポーリングします。ステータスは pending、processing、completed、failed。完了したタスクには 30 日間有効な署名付き URL が付くので、必要なものはダウンロードしてください。
curl https://apimany.com/v1/tasks/TASK_ID -H "Authorization: Bearer $APIMANY_API_KEY"Webhook
メディアのリクエストに callback_url(公開 HTTPS)を付けると、完了したタスクを POST で送信し、最大6回まで間隔を空けて再試行します。X-Apimany-Signature は API キーページの Webhook シークレットで検証してください。
import crypto from 'node:crypto'
// Express-style handler; keep the raw body for the signature check.
export function verify(rawBody, headers, secret) {
const timestamp = headers['x-apimany-timestamp']
const expected = crypto.createHmac('sha256', secret.replace(/^whsec_/, ''))
.update(`${timestamp}.${rawBody}`).digest('hex')
return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(headers['x-apimany-signature']))
}
// Payload: { "event": "task.completed" | "task.failed", "data": { ...task, "record": { ... } } }文字起こし POST/v1/audio/transcriptions
multipart アップロード(最大 25 MB)による OpenAI 互換の音声文字起こし。
curl https://apimany.com/v1/audio/transcriptions \
-H "Authorization: Bearer $APIMANY_API_KEY" \
-F model=gpt-4o-transcribe \
-F [email protected] \
-F response_format=jsonモデル GET/v1/models
種類・エンドポイント・料金付きの全モデル一覧(公開)。?kind=chat|image|video|audio|embedding で絞り込めます。
# Every model with its pricing (no key needed)
curl https://apimany.com/v1/models
# Only video models
curl "https://apimany.com/v1/models?kind=video"
# One model with its parameters
curl https://apimany.com/v1/models/seedance-2.5記録 GET/v1/records
テキスト・メディア・音声のすべての呼び出しに、ステータス・使用量・費用・出力を含む記録があります。model、kind、status、api_key_id、since で絞り込めます。
curl "https://apimany.com/v1/records?limit=20&kind=video&status=completed" \
-H "Authorization: Bearer $APIMANY_API_KEY"
curl https://apimany.com/v1/records/RECORD_ID -H "Authorization: Bearer $APIMANY_API_KEY"残高 GET/v1/account/balance
curl https://apimany.com/v1/account/balance -H "Authorization: Bearer $APIMANY_API_KEY"
# { "object": "balance", "currency": "usd", "balance_usd": 42.17, "debt_usd": 0 }エラー
エラーは OpenAI 形式なので、SDK の例外処理がそのまま使えます。
{
"error": {
"message": "Your balance is too low for this request. Top up and try again.",
"type": "insufficient_quota",
"param": null,
"code": "insufficient_balance"
}
}| HTTP | code | 意味 |
|---|---|---|
| 400 | invalid_request | パラメータが不足しているか、このモデルでは使えません。課金はありません。 |
| 401 | invalid_api_key | キーがない、形式が不正、または無効化されています。 |
| 402 | insufficient_balance | 残高がこのリクエストの仮押さえ額に足りません。 |
| 404 | model_not_found | そのモデル ID は存在しません。GET /v1/models で一覧を確認してください。 |
| 409 | idempotency_replay | この Idempotency-Key は使用済みです。以前の記録を取得してください。 |
| 413 | request_too_large | リクエスト本文がサイズ上限を超えています。メディアは URL で送ってください。 |
| 429 | rate_limited | このキーの1分あたりのリクエストが多すぎます。間隔を空けて再試行してください。 |
| 502 | generation_failed | このモデルのすべてのチャネルが失敗しました。課金はありません。少し待って再試行してください。 |
| 503 | model_unavailable | このモデルは一時的に利用できません。 |
制限
- リクエスト本文:テキストは最大 25 MB、メディアは 40 MB。大きなファイルは HTTPS URL で渡してください。
- プレイグラウンドのアップロード:画像 10 MB、動画 100 MB、音声 50 MB まで。
- レート制限:既定でアカウントあたり毎分 120 リクエスト。引き上げはお問い合わせください。
- 生成ファイルは 30 日間保存されます。終了しないタスクは確認のうえ返金します。
- モデルの機能とモデルごとの制限は提供元に準じます。