API 문서
API Many는 하나의 기본 URL과 하나의 키로 모든 모델을 제공합니다. 텍스트 엔드포인트는 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만 토큰당 가격으로 청구합니다.
- 이미지: 선택한 해상도나 품질에 따라 장당 청구하며, 토큰 과금 이미지 모델은 보고된 사용량으로 정산합니다.
- 비디오: 선택한 해상도로 초당 청구합니다(길이 고정 모델은 클립당).
- 실패·거부·시간 초과 요청은 청구되지 않으며 예약 금액은 전액 반환됩니다.
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"웹훅
미디어 요청에 callback_url(공개 HTTPS)을 추가하면 완료된 작업을 POST로 보내며 최대 6회까지 간격을 두고 재시도합니다. X-Apimany-Signature는 API 키 페이지의 웹훅 시크릿으로 확인하세요.
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 업로드(최대 25MB)로 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 | 이 키의 분당 요청이 너무 많습니다. 간격을 두고 재시도하세요. |
| 502 | generation_failed | 이 모델의 모든 채널이 실패했습니다. 청구되지 않았으니 잠시 후 다시 시도하세요. |
| 503 | model_unavailable | 모델을 일시적으로 사용할 수 없습니다. |
제한
- 요청 본문: 텍스트 최대 25MB, 미디어 40MB. 큰 파일은 HTTPS URL로 전달하세요.
- 플레이그라운드 업로드: 이미지 10MB, 비디오 100MB, 오디오 50MB까지.
- 속도 제한: 기본적으로 계정당 분당 120회. 더 높은 한도는 문의하세요.
- 생성 파일은 30일간 보관됩니다. 끝나지 않은 작업은 검토 후 환불됩니다.
- 모델 기능과 모델별 제한은 제공사를 따릅니다.