8 minutes

Read the response

Find the model’s answer in a response, see which model and provider served it, and read what the request cost.

A chat completion returns a JSON object. Top-level fields identify the request and what served it, choices holds the model’s reply, and usage reports token counts and cost. choices is always an array, even though a request returns one reply, so read the reply from choices[0].

Response200 OK
{"choices": [{"message": {"role": "assistant",}}],"usage": {"prompt_tokens": 14,"completion_tokens": 19,}}
A shortened example of a successful response. Select a field to see how to read it.

The fields you’ll use most as you wire this into your code:

  • choices[0].finish_reason: stop means the model finished on its own; length means it hit a token limit (max_tokens) and the reply was cut off. The finish reason docs list every value, including tool_calls, content_filter, and error.
  • model and provider: Even when you request a router or alias like openrouter/free, the response names the exact model slug (google/gemma-4-31b-it:free) and provider that served it.
  • usage.cost: The amount charged in OpenRouter credits (0 for free models).
  • id: Keep this in your logs so you can look up the request on your activity page or share it with support.

Check your understanding

Question 1 of 2

A customer asks for the return policy and the reply stops mid-sentence. The status is 200. Which field tells you what happened?

Apply it

You asked for one model, and the response’s model field shows exactly that model, but the provider field changes from one request to the next. Is something wrong?

Takeaway

The answer is in choices[0].message.content, why it stopped is in finish_reason, what ran is in model and provider, and what it cost is in usage.cost. Log the id.

Try it live

Optional

Send a message in OpenRouter chat and open the message details. You’ll see the same model, provider, and cost fields.