Grok 모델의 추론

Grok 모델은 최종 답변을 제공하기 전에 단계별 추론을 실행할 수 있는 '사고' 모드를 지원합니다. 이는 수학적 증명, 복잡한 코드 디버깅, 다단계 에이전트 계획과 같이 투명한 논리가 필요한 작업에 유용합니다.

Grok 안내

  • 추론 토큰 수는 completion_tokens와 분리되어 reasoning_tokens 필드에 출력됩니다.
  • 응답에 reasoning_content 필드가 없습니다. 모든 응답 텍스트는 content 필드에 출력됩니다.
  • Grok 추론 모델은 reasoning_effort을 지원하지 않습니다.

요청 예시:

curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json" \
https://aiplatform.googleapis.com/v1/projects/test-project/locations/global/endpoints/openapi/chat/completions -d '{
  "model": "xai/grok-4.1-fast-reasoning",
  "messages": [{
    "role": "user",
    "content": "Who are you?"
  }],
}'

응답 예:

{
  "choices": [
    {
      "finish_reason": "stop",
      "index": 0,
      "logprobs": null,
      "message": {
        "content": "I am Grok, an AI assistant built by xAI...",
        "role": "assistant"
      }
    }
  ],
  "created": 1775523905,
  "id": "knTMaJC0EJfM5OMP7I3xkAk",
  "model": "xai/grok-4.1-fast-reasoning",
  "object":"chat.completion",
  "system_fingerprint":"fp_39c5j0a324",
  "usage":{
    "completion_tokens":50,
    "completion_tokens_details":{
      "accepted_prediction_tokens":0,
      "audio_tokens":0,
      "reasoning_tokens":124,
      "rejected_prediction_tokens":0
    },
    "cost_in_usd_ticks":0,
    "num_sources_used":0,
    "prompt_tokens":663,
    "prompt_tokens_details":{"audio_tokens":0,"cached_tokens":654,"image_tokens":0,"text_tokens":663},
    "total_tokens":837
  }
}

다음 단계