Schlussfolgerungen für Grok-Modelle

Grok-Modelle unterstützen einen „Denkmodus“, mit dem sie Schritt für Schritt Schlussfolgerungen ziehen können, bevor sie eine endgültige Antwort geben. Dies ist nützlich für Aufgaben, die eine transparente Logik erfordern, z. B. mathematische Beweise, kompliziertes Code-Debugging oder mehrstufige Agentenplanung.

Grok-Anleitung

  • Die Anzahl der Reasoning-Tokens wird im Feld reasoning_tokens ausgegeben und von den completion_tokens getrennt.
  • Die Antwort enthält nicht das Feld reasoning_content. Alle Antworttexte werden im Feld content ausgegeben.
  • Grok-Reasoning-Modelle unterstützen reasoning_effort nicht.

Beispielanfrage :

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?"
  }],
}'

Beispielantwort :

{
  "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
  }
}

Nächste Schritte