# Claude Opus 5.5 API Anthropic에서 제공하는 Claude Opus 5.5 LLM 모델의 전체 API 참조 문서입니다. ## 모델 변형 이 API는 두 가지 Claude Opus 5.5 모델 변형을 지원합니다. | 모델 | ID | 설명 | |-------|----|-------------| | **Claude Opus 5.5 Text to Text** | `claude-opus-5.5-text-to-text` | 최신 Claude Opus의 텍스트 추론 및 작성 | | **Claude Opus 5.5 File Analysis** | `claude-opus-5.5-file-analysis` | 최신 Claude Opus의 파일 및 이미지 분석 | ## 빠른 비교 | 기능 | 텍스트 입력 및 텍스트 출력 | 파일 분석 | |---------|--------------|---------------| | 텍스트 입력 | 필수 ✅ | 선택 사항 | | 이미지 입력 | 지원하지 않음 ❌ | 선택 사항 | | 파일 입력 | 지원하지 않음 ❌ | 선택 사항 | | 스트리밍 응답 | SSE | SSE | | `max_tokens` | 선택 사항 | 선택 사항 | ## Claude Opus 5.5 Text to Text ### 엔드포인트 ```http POST /api/v1/chat/completions ``` ### 요청 매개변수 #### 필수 | 매개변수 | 유형 | 설명 | |-----------|------|-------------| | `model` | string | `"claude-opus-5.5-text-to-text"`이어야 합니다. | | `messages` | array | 순서대로 정렬된 메시지입니다. 메시지 구조는 LLM API를 참조하세요. | | `stream` | boolean | SSE 응답은 `true`, 단일 JSON 응답은 `false`로 설정합니다. | #### 메시지 입력 지원 | 필드 | 텍스트 | 파일 | 이미지 | |-------|------|------|-------| | `messages` | 필수 ✅ | 지원하지 않음 ❌ | 지원하지 않음 ❌ | #### 선택 사항 | 매개변수 | 유형 | 범위 | 설명 | |-----------|------|-------|-------------| | `max_tokens` | integer | `≥ 1` | 최대 출력 토큰 수입니다. 기본 상한값은 없습니다. | ### 요청 예시 ```javascript const response = await fetch('https://api.flaq.ai/api/v1/chat/completions', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_API_KEY', 'Accept': 'text/event-stream', 'Content-Type': 'application/json' }, body: JSON.stringify({ model: 'claude-opus-5.5-text-to-text', messages: [ { role: 'user', content: 'Draft a technical decision memo for this architecture choice.' } ], stream: true, max_tokens: 2048 }) }); ``` ## Claude Opus 5.5 File Analysis ### 엔드포인트 ```http POST /api/v1/chat/completions ``` ### 요청 매개변수 #### 필수 | 매개변수 | 유형 | 설명 | |-----------|------|-------------| | `model` | string | `"claude-opus-5.5-file-analysis"`이어야 합니다. | | `messages` | array | 순서대로 정렬된 메시지입니다. LLM API와 메시지 첨부 파일 문서를 참조하세요. | | `stream` | boolean | SSE 응답은 `true`, 단일 JSON 응답은 `false`로 설정합니다. | #### 메시지 입력 지원 | 필드 | 텍스트 | 파일 | 이미지 | |-------|------|------|-------| | `messages` | 선택 사항 | 선택 사항 | 선택 사항 | #### 선택 사항 | 매개변수 | 유형 | 범위 | 설명 | |-----------|------|-------|-------------| | `max_tokens` | integer | `≥ 1` | 최대 출력 토큰 수입니다. 기본 상한값은 없습니다. | ### 요청 예시 ```javascript const response = await fetch('https://api.flaq.ai/api/v1/chat/completions', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_API_KEY', 'Accept': 'text/event-stream', 'Content-Type': 'application/json' }, body: JSON.stringify({ model: 'claude-opus-5.5-file-analysis', messages: [ { role: 'user', content: [ { type: 'text', text: 'Summarize this file and extract the key risks.' }, { type: 'file', file: { filename: 'demo.pdf', file_data: 'https://example.com/demo.pdf' } } ] } ], stream: true, max_tokens: 4096 }) }); ``` ## 응답 형식 Claude Opus 5.5 LLM 모델은 OpenAI 호환 완성 응답을 반환합니다. `stream: true`이면 응답은 서버 전송 이벤트(SSE) 형식이며, `stream: false`이면 단일 JSON 객체입니다. ### 성공 응답 ```text data: {"id":"chatcmpl-...","object":"chat.completion.chunk","created":1710000000,"model":"claude-opus-5.5-file-analysis","choices":[{"index":0,"delta":{"role":"assistant"},"finish_reason":null}]} data: {"id":"chatcmpl-...","object":"chat.completion.chunk","created":1710000000,"model":"claude-opus-5.5-file-analysis","choices":[{"index":0,"delta":{"content":"Here is a concise summary"},"finish_reason":null}]} data: {"id":"chatcmpl-...","object":"chat.completion.chunk","created":1710000000,"model":"claude-opus-5.5-file-analysis","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]} data: {"id":"chatcmpl-...","object":"chat.completion.chunk","created":1710000000,"model":"claude-opus-5.5-file-analysis","choices":[],"usage":{"prompt_tokens":12,"completion_tokens":8,"total_tokens":20}} data: [DONE] ``` ### 오류 응답 ```text event: error data: {"error":{"message":"API requests too frequent, exceeding rate limit","type":"rate_limit_error","code":"1302","param":null}} ``` ## 모범 사례 1. **구조화된 메시지 사용:** 컨텍스트를 하나의 프롬프트로 합치지 말고 `messages[]`를 통해 대화 기록을 전송하세요. 2. **적절한 모델 변형 선택:** 텍스트 전용 추론 및 작성에는 Text to Text를 사용하고, 파일이나 이미지가 필요하면 File Analysis를 사용하세요. 3. **SSE 이벤트 처리:** `choices[0].delta.content`를 이어 붙여 스트리밍으로 표시하고 `data: [DONE]`을 성공적인 완료로 처리하세요. 4. **지원되는 입력만 전송:** 현재 클라이언트에서 텍스트 모델은 지원되지 않는 파일 및 이미지 부분을 무시합니다.