---
title: "Create Completion"
method: POST
path: "/v1/completions"
tags: ["text-completion.openapi_other"]
---

# Create Completion

`POST /v1/completions`

Create a completion for the provided prompt and parameters.

For RL / agent rollouts, Fireworks inference exposes additional
rollout-specific features:
[`x-session-affinity` and `x-multi-turn-session-id`](https://docs.fireworks.ai/guides/rollout-inference#session-affinity)
for multi-turn trajectories, and
[MoE Router Replay (R3)](https://docs.fireworks.ai/guides/rollout-inference#moe-router-replay)
for MoE expert tracing during rollouts.

## Request body

- CompletionRequest
  - `model` string, required — The name of the model to use. Example: `"accounts/fireworks/models/kimi-k2-instruct-0905"`
  - `user` string, nullable — A unique identifier representing your end-user, which can help monitor and detect abuse.
  - `prompt_cache_key` string, nullable — A key used for prompt caching session affinity. Requests with the same prompt_cache_key are routed to the same backend to maximize KV cache hit rates. This is the preferred field for session affinity (takes priority over the 'user' field).
  - `prompt_cache_isolation_key` string, nullable — Isolation key for prompt caching to separate cache entries.
  - `raw_output` boolean, nullable — Return raw output from the model.
  - `perf_metrics_in_response` boolean, nullable — Whether to include performance metrics in the response body. **Non-streaming requests:** Performance metrics are always included in response headers (e.g., `fireworks-prompt-tokens`, `fireworks-server-time-to-first-token`). Setting this to `true` additionally includes the same metrics in the response body under the `perf_metrics` field. **Streaming requests:** Performance metrics are only included in the response body under the `perf_metrics` field in the final chunk (when `finish_reason` is set). This is because headers may not be accessible during streaming. The response body `perf_metrics` field contains the following metrics: **Basic Metrics (all deployments):** - `prompt-tokens`: Number of tokens in the prompt - `cached-prompt-tokens`: Number of cached prompt tokens - `server-time-to-first-token`: Time from request start to first token (in seconds) - `server-processing-time`: Total processing time (in seconds, only for completed requests) **Predicted Outputs Metrics:** - `speculation-prompt-tokens`: Number of speculative prompt tokens - `speculation-prompt-matched-tokens`: Number of matched speculative prompt tokens (for completed requests) **Dedicated Deployment Only Metrics:** - `speculation-generated-tokens`: Number of speculative generated tokens (for completed requests) - `speculation-acceptance`: Speculation acceptance rates by position - `backend-host`: Hostname of the backend server - `num-concurrent-requests`: Number of concurrent requests - `deployment`: Deployment name - `tokenizer-queue-duration`: Time spent in tokenizer queue - `tokenizer-duration`: Time spent in tokenizer - `prefill-queue-duration`: Time spent in prefill queue - `prefill-duration`: Time spent in prefill - `generation-queue-duration`: Time spent in generation queue - `generation-duration`: Time spent in generation
  - `stream` boolean, nullable — Whether to stream back partial progress. If set, tokens will be sent as data-only [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format) as they become available, with the stream terminated by a `data: [DONE]` message.
  - `stream_options` StreamOptions
    - `include_usage` boolean, nullable — Whether to include a trailing SSE chunk with usage totals (with an empty `choices` array). Unlike the OpenAI spec, Fireworks includes usage by default for streaming responses; set this to `false` to opt out. When emitted, usage rides a separate final chunk (before `data: [DONE]`), not the chunk carrying `finish_reason`.
    - `include_internal_content` boolean, nullable — When true, include an `internal_content` object (currently `token_id`) inside each streaming delta — equivalent to `return_token_ids`, emitted under `choices[].delta.internal_content`. Omitted entirely from response chunks when false.
    - `buffer_tokens` integer, nullable — Coalesce streaming SSE chunks until this many text deltas (~tokens) accumulate before flushing a merged chunk. 0 disables the token threshold. Honored only on the vLLM backend; overrides the deployment default when set.
    - `buffer_ms` number, nullable — Coalesce streaming SSE chunks for up to this many milliseconds before flushing a merged chunk. 0 disables the time threshold. Honored only on the vLLM backend; overrides the deployment default when set.
    - `buffer_mode` 'any' | 'all', nullable — When both buffer_tokens and buffer_ms are set: 'any' flushes when either threshold is reached; 'all' flushes only when both are. Overrides the deployment default when set; defaults to 'any'.
  - `n` integer — How many completions to generate for each prompt. **Note:** Because this parameter generates many completions, it can quickly consume your token quota. Use carefully and ensure that you have reasonable settings for `max_tokens` and `stop`. Required range: `1 <= x <= 128` Example: `1`
  - `service_tier` 'auto' | 'default' | 'flex' | 'priority' — The service tier to use for the request. Specifies the processing type used for serving the request. Only "priority" is supported, while all other values will be treated as "default" tier.
  - `stop` union — Up to 4 sequences where the API will stop generating further tokens. The returned text will NOT contain the stop sequence.
    - string
    - string[]
  - `max_tokens` integer, nullable — The maximum number of tokens to generate in the completion. If the token count of your prompt plus max_tokens exceeds the model's context length, the behavior depends on context_length_exceeded_behavior. By default, max_tokens will be lowered to fit in the context window instead of returning an error.
  - `max_completion_tokens` integer, nullable — Alias for max_tokens. Cannot be specified together with max_tokens.
  - `temperature` number, nullable — What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or top_p but not both. Required range: `0 <= x <= 2` Example: `1`
  - `top_k` integer, nullable — Top-k sampling is another sampling method where the k most probable next tokens are filtered and the probability mass is redistributed among only those k next tokens. The value of k controls the number of candidates for the next token at each step during text generation. Must be between 0 and 100. Required range: `0 <= x <= 100` Example: `50`
  - `top_p` number, nullable — An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or temperature but not both. Required range: `0 <= x <= 1` Example: `1`
  - `min_p` number, nullable — Minimum probability threshold for token selection. Only tokens with probability >= min_p are considered for selection. This is an alternative to `top_p` and `top_k` sampling. Required range: `0 <= x <= 1`
  - `typical_p` number, nullable — Typical-p sampling is an alternative to nucleus sampling. It considers the most typical tokens whose cumulative probability is at most typical_p. Required range: `0 <= x <= 1`
  - `frequency_penalty` number, nullable — Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim. Reasonable value is around 0.1 to 1 if the aim is to just reduce repetitive samples somewhat. If the aim is to strongly suppress repetition, then one can increase the coefficients up to 2, but this can noticeably degrade the quality of samples. Negative values can be used to increase the likelihood of repetition. See also `presence_penalty` for penalizing tokens that have at least one appearance at a fixed rate. OpenAI compatible (follows OpenAI's conventions for handling token frequency and repetition penalties). Required range: `-2 <= x <= 2`
  - `presence_penalty` number, nullable — Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics. Reasonable value is around 0.1 to 1 if the aim is to just reduce repetitive samples somewhat. If the aim is to strongly suppress repetition, then one can increase the coefficients up to 2, but this can noticeably degrade the quality of samples. Negative values can be used to increase the likelihood of repetition. See also `frequency_penalty` for penalizing tokens at an increasing rate depending on how often they appear. OpenAI compatible (follows OpenAI's conventions for handling token frequency and repetition penalties). Required range: `-2 <= x <= 2`
  - `repetition_penalty` number, nullable — Applies a penalty to repeated tokens to discourage or encourage repetition. A value of `1.0` means no penalty, allowing free repetition. Values above `1.0` penalize repetition, reducing the likelihood of repeating tokens. Values between `0.0` and `1.0` reward repetition, increasing the chance of repeated tokens. For a good balance, a value of `1.2` is often recommended. Note that the penalty is applied to both the generated output and the prompt in decoder-only models. Required range: `0 <= x <= 2`
  - `mirostat_target` number, nullable — Defines the target perplexity for the Mirostat algorithm. Perplexity measures the unpredictability of the generated text, with higher values encouraging more diverse and creative outputs, while lower values prioritize predictability and coherence. The algorithm dynamically adjusts the token selection to maintain this target during text generation. If not specified, Mirostat sampling is disabled.
  - `mirostat_lr` number, nullable — Specifies the learning rate for the Mirostat sampling algorithm, which controls how quickly the model adjusts its token distribution to maintain the target perplexity. A smaller value slows down the adjustments, leading to more stable but gradual shifts, while higher values speed up corrections at the cost of potential instability.
  - `seed` integer, nullable — Random seed for deterministic sampling.
  - `logprobs` union — Include log probabilities in the response. This accepts either a boolean or an integer: If set to `true`, log probabilities are included and the number of alternatives can be controlled via `top_logprobs` (OpenAI-compatible behavior). If set to an integer N, include log probabilities for up to N most likely tokens per position in the legacy format. N must be between 0 and the deployment's `--max-logprobs` limit (5 by default). The API will always return the logprob of the sampled token, so there may be up to `logprobs+1` elements in the response when an integer is used.
    - integer
    - boolean
  - `top_logprobs` integer, nullable — An integer specifying the number of most likely tokens to return at each token position, each with an associated log probability. Must be between 0 and the deployment's `--max-logprobs` limit (5 by default). When `logprobs` is set, `top_logprobs` can be used to modify how many top log probabilities are returned. If `top_logprobs` is not set, the API will return up to `logprobs` tokens per position.
  - `sampling_mask` 'count' | 'non_zero_list' | 'non_zero_buffer', nullable — Opt-in sampling mask metadata for generated tokens. When set to `"count"`, each generated token in the new logprobs format includes the number of token logits still eligible for sampling after filters such as top_p and top_k are applied. `"non_zero_list"` additionally returns active token IDs in `sampling_mask`; `"non_zero_buffer"` additionally returns a base64-encoded little-endian uint32 buffer of active token IDs. Non-zero payloads are omitted for positions with more active tokens than 1000.
  - `echo` boolean, nullable — Echo back the prompt in addition to the completion.
  - `echo_last` integer, nullable — Echo back the last N tokens of the prompt in addition to the completion. This is useful for obtaining logprobs of the prompt suffix but without transferring too much data. Passing `echo_last=len(prompt)` is the same as `echo=True`
  - `ignore_eos` boolean — This setting controls whether the model should ignore the End of Sequence (EOS) token. When set to `True`, the model will continue generating tokens even after the EOS token is produced. By default, it stops when the EOS token is reached.
  - `context_length_exceeded_behavior` 'error' | 'truncate' — What to do if the token count of prompt plus `max_tokens` exceeds the model's context window. Passing `truncate` limits the `max_tokens` to at most `context_window_length - prompt_length`. This is the default. Passing `error` would trigger a request error. The default of `'truncate'` is selected as it allows to ask for high `max_tokens` value while respecting the context window length without having to do client-side prompt tokenization. Note, that it differs from OpenAI's behavior that matches that of `error`.
  - `response_format` ResponseFormat
    - `type` 'json_object' | 'json_schema' | 'grammar' | 'text', required
    - `schema` union
      - object
      - string
    - `grammar` string, nullable
    - `json_schema` union
      - object
      - string
  - `logit_bias` object, nullable — Modify the likelihood of specified tokens appearing in the completion. Accepts a json object that maps tokens (specified by their token ID in the tokenizer) to an associated bias value from -100 to 100. Mathematically, the bias is added to the logits generated by the model prior to sampling.
  - `speculation` union — Speculative decoding prompt or token IDs to speed up generation.
    - string
    - integer[]
  - `prediction` union — OpenAI-compatible predicted output for speculative decoding. Can be a PredictedOutput object or a simple string. Automatically transformed to speculation.
    - PredictedOutput — OpenAI-compatible struct for the "speculation" field.
      - `content` union, required
        - string
        - ChatMessageContent[]
          - `type` string, required
          - `text` string, nullable
          - `image_url` ChatMessageContentImageURL
            - `url` string, required — Image link or base64 data URI. ``mm_file://{file_id}`` is also accepted for assets uploaded via the Files API.
            - `detail` string, nullable — Detail level for image understanding. One of ``low`` / ``default`` / ``high`` (model-specific defaults table). Used to pick a default ``max_long_side_pixel`` when that field is absent.
            - `max_long_side_pixel` integer, nullable — Per-image cap on the long side after resizing. When omitted, the model derives a default from ``detail``. Currently honored by MiniMax M3 VL preprocessing; other VL models ignore this field. See the M3 VL preprocessing spec (2026-05-29) for the full 3-step resize semantics (long-side cap → short-side floor at 112 px → hard total-pixel cap).
          - `video_url` ChatMessageContentVideoURL
            - `url` string, required — Video link or base64 data URI. ``mm_file://{file_id}`` is accepted for assets uploaded via the Files API (recommended for files > 50 MB).
            - `detail` string, nullable — Detail level for video understanding. One of ``low`` / ``default`` / ``high``.
            - `max_frames` integer, nullable
            - `spatial_limit` integer, nullable
            - `sample_fps` number, nullable — Frame sampling rate (Kimi K2.5 VL legacy name). For MiniMax M3 VL prefer the canonical ``fps`` field.
            - `fps` number, nullable — Frame sampling rate, in [0.2, 5] Hz for MiniMax M3 VL (was [0.5, 2] in the pre-2026-05-29 spec). Higher values are more sensitive to motion at the cost of more tokens; lower values are cheaper but less responsive to fast scene changes. Equivalent to ``sample_fps`` on non-M3 video models.
            - `max_long_side_pixel` integer, nullable — Per-frame cap on the long side after resizing. When omitted, the model derives a default from ``detail``. Currently honored by MiniMax M3 VL preprocessing; other VL models ignore this field.
      - `type` 'content'
    - string
  - `metadata` object, nullable — Additional metadata to store with the request for tracing/distillation.
  - `reasoning_effort` union — Controls reasoning behavior for supported models. When enabled, the model's reasoning appears in the `reasoning_content` field of the response, separate from the final answer in `content`. **Accepted values:** - **String** (OpenAI-compatible): `'low'`, `'medium'`, `'high'`, or `'max'` to enable reasoning with varying effort levels; `'none'` to disable reasoning. - **Boolean** (Fireworks extension): `true` to enable reasoning, `false` to disable it. - **Integer** (Fireworks extension): A positive integer to set a hard token limit on reasoning output. Integer values enable the model's normal medium-style thinking behavior and force the model to end its thinking phase after at most that many generated thinking tokens. **Important:** Boolean values are normalized internally: `true` becomes `'medium'`, and `false` becomes `'none'`. This normalization happens before model-specific validation, so if a model doesn't support `'none'`, passing `false` will produce an error referencing `'none'`. **Model-specific behavior:** - **Qwen3**: Grammar-based reasoning on the reasoning-enabled `qwen3`/`qwen3p5` conversation styles. Older chat-mode Qwen3 deployments may opt into `qwen3-no-thinking`, which disables reasoning support. For reasoning-enabled styles, use `'none'` or `false` to disable. Supports integer token limits to cap reasoning output. `'low'`, `'medium'`, and `'high'` keep their model-specific behavior and are not hard budgets. - **MiniMax M2**: Reasoning is required (always on). Defaults to `'medium'` when omitted. Accepts only string `reasoning_effort`: `'low'`, `'medium'`, or `'high'`. `'none'` and boolean values are rejected. - **DeepSeek V3.1**: Binary on/off reasoning. Default reasoning off (matches chat template). Use `true`, `'low'`, `'medium'`, or `'high'` to enable; `'none'` or `false` to disable. - **DeepSeek V3.2**: Binary on/off reasoning. Default reasoning on. Use `'none'` or `false` to disable; effort levels and integers have no additional effect. - **DeepSeek V4**: Accepts `'none'`, `'low'`, `'medium'`, `'high'`, `'xhigh'`, and `'max'`. Default reasoning on (`'high'`). `'xhigh'` is silently promoted to `'max'`. `'max'` prepends a thorough-reasoning preamble; `'high'` enables thinking. `'low'` and `'medium'` are silently promoted to `'high'`. `'none'` or `false` disables thinking. - **GLM 4.5, GLM 4.5 Air, GLM 4.6, GLM 4.7, GLM 5.1**: Binary on/off reasoning. Default reasoning on. Use `'none'` or `false` to disable; effort levels and integers have no additional effect. - **GLM 5.2**: Two thinking tiers, `High` and `Max` (rendered as a `Reasoning Effort:` system line). `'high'` selects High; `'low'` and `'medium'` are collapsed to `'high'`; `'max'` and `'xhigh'` select Max; when omitted, the model default (`Max`) applies. `'none'` or `false` disables thinking. - **Harmony (OpenAI GPT-OSS 120B, GPT-OSS 20B)**: Accepts only `'low'`, `'medium'`, or `'high'`. Does not support `'none'`, `false`, or integer values — using these will return an error (e.g., "Invalid reasoning effort: none"). When omitted, defaults to `'medium'`. Lower effort produces faster responses with shorter reasoning.
    - 'low' | 'medium' | 'high' | 'xhigh' | 'max' | 'none' | 'adaptive'
    - integer
    - boolean
  - `reasoning_history` 'disabled' | 'interleaved' | 'preserved', nullable — Controls how historical assistant reasoning content is included in the prompt for multi-turn conversations. **Accepted values:** - `null`: Use model/template default behavior (for **GLM-4.7**, the model/template default is `'interleaved'`, i.e. historical reasoning is cleared by default) - `'disabled'`: Strip `reasoning_content` from all messages before prompt construction - `'interleaved'`: Strip `reasoning_content` from messages up to (and including) the last user message - `'preserved'`: Preserve historical `reasoning_content` across the conversation **Model support:** | Model | Default | Supported values | | --- | --- | --- | | Kimi K2.7 | `'preserved'` | `'disabled'`, `'interleaved'`, `'preserved'` | | Kimi K2.6 | `'interleaved'` | `'disabled'`, `'interleaved'`, `'preserved'` | | Kimi K2 Instruct | `'preserved'` | `'disabled'`, `'interleaved'`, `'preserved'` | | MiniMax M2 | `'interleaved'` | `'disabled'`, `'interleaved'` | | GLM-5.2 | `'interleaved'` | `'disabled'`, `'interleaved'`, `'preserved'` | | GLM-4.7 | `'interleaved'` | `'disabled'`, `'interleaved'`, `'preserved'` | | GLM-4.6 | `'interleaved'` | `'disabled'`, `'interleaved'` | | Qwen 3.6 | `'preserved'` | `'disabled'`, `'preserved'` | | DeepSeek V4 | `'interleaved'` | `'interleaved'` | For other models, refer to the model provider's documentation. **Note:** This parameter controls prompt formatting only. To disable reasoning computation entirely, use `reasoning_effort='none'`.
  - `thinking` union — Configuration for enabling extended thinking (Anthropic-compatible format). This is an alternative to `reasoning_effort` for controlling reasoning behavior. **Format:** - `{"type": "enabled"}` - Enable thinking (equivalent to `reasoning_effort: true`) - `{"type": "enabled", "budget_tokens": <int>}` - Enable thinking with a token budget (equivalent to `reasoning_effort: <int>`). Must be >= 1024. - `{"type": "enabled", "keep": "all"}` - Enable thinking and preserve all historical reasoning content in the prompt (equivalent to `reasoning_history: "preserved"`). - `{"type": "disabled"}` - Disable thinking (equivalent to `reasoning_effort: "none"`) **Precedence with `reasoning_effort`:** `thinking.effort` (when set) overrides `reasoning_effort`; otherwise, for `type=enabled`, `reasoning_effort` is used as the effort level. `type=disabled` always disables thinking.
    - ThinkingConfigEnabled — Configuration for enabling extended thinking (Anthropic-compatible format).
      - `type` 'enabled'
      - `budget_tokens` integer, nullable — Determines how many tokens the model can use for its internal reasoning process. Larger budgets can enable more thorough analysis for complex problems, improving response quality. Must be >= 1024 if specified.
      - `keep` 'all', nullable — Controls whether historical reasoning content is preserved in the prompt. When set to `"all"`, all previous assistant turns' reasoning_content is included in the rendered prompt (equivalent to `reasoning_history: "preserved"`). When omitted (null), the model uses its default history behavior. Only valid when `type` is `"enabled"`.
      - `budget_end_str` string, nullable — Natural-language transition phrase that the model is forced to emit just before the end-thinking token (`</think>`) when `budget_tokens` is exhausted. This produces a more natural conclusion than a hard token slam (matches vLLM's `reasoning_end_str` behavior). Defaults to a built-in phrase. Set to "" to disable the bridge and force `</think>` immediately. Only meaningful when `budget_tokens` is set.
      - `effort` union — Reasoning effort level (Kimi/Moonshot spec). Accepts the same values as top-level `reasoning_effort`; when set it takes precedence over (overwrites) `reasoning_effort`.
        - 'low' | 'medium' | 'high' | 'xhigh' | 'max' | 'none' | 'adaptive'
        - integer
        - boolean
    - ThinkingConfigDisabled — Configuration for disabling extended thinking (Anthropic-compatible format).
      - `type` 'disabled', required
    - ThinkingConfigAdaptive — Configuration that lets the model decide whether to think (MiniMax M3). Per the M3 API spec (§1.4), `{"type": "adaptive"}` is M3's default — the model decides whether to emit a thinking phase. No forced first token is applied. Currently accepted only by MiniMax M3; other model families reject it.
      - `type` 'adaptive', required
  - `return_token_ids` boolean, nullable — Return token IDs alongside text to avoid retokenization drift.
  - `prompt` union, required — The prompt to generate completions for. It can be a single string or an array of strings. It can also be an array of integers or an array of integer arrays, which allows to pass already tokenized prompt. If multiple prompts are specified, several choices with corresponding `index` will be returned in the output.
    - string
    - string[]
    - integer[]
    - array[]
      - integer[]
  - `images` union — The list of base64 encoded images for visual language completition generation. They should be formatted as MIME_TYPE,<base64 encoded str> eg. data:image/jpeg;base64,<base64 encoded str> Additionally, the number of images provided should match the number of image placeholder tokens in the prompt (string prompts: '<image>' or model-specific pads such as '<|image_pad|>'; tokenized prompts: one image pad token ID per image, unexpanded).
    - string[]
    - array[]
      - string[]

## Response `200`

Successful Response

- CompletionResponse — The response message from a /v1/completions call.
  - `id` string, required — A unique identifier of the response
  - `object` string — The object type, which is always "text_completion"
  - `created` integer, required — The Unix time in seconds when the response was generated
  - `model` string, required — The model used for the completion
  - `choices` Choice[], required — The list of generated completion choices
    - `index` integer, required — The index of the completion choice
    - `text` string, required — The completion response
    - `logprobs` union — The log probabilities of the most likely tokens
      - LogProbs — Legacy log probabilities format
        - `tokens` string[]
        - `token_logprobs` number[]
        - `top_logprobs` object[], nullable
        - `text_offset` integer[]
        - `token_ids` integer[], nullable
      - NewLogProbs — OpenAI-compatible log probabilities format
        - `content` NewLogProbsContent[]
          - `token` string, required
          - `logprob` number, required
          - `sampling_logprob` number, nullable, required
          - `sampling_mask_count` integer, nullable
          - `sampling_mask` union
            - integer[]
            - string
          - `bytes` integer[], required
          - `top_logprobs` NewLogProbsContentTopLogProbs[]
            - `token` string, required
            - `logprob` number, required
            - `token_id` integer, required
            - `bytes` integer[]
          - `token_id` integer, required
          - `text_offset` integer, required
          - `last_activation` string, nullable
          - `routing_matrix` string, nullable
    - `finish_reason` 'stop' | 'length' | 'error', nullable — The reason the model stopped generating tokens. This will be "stop" if the model hit a natural stop point or a provided stop sequence, or "length" if the maximum number of tokens specified in the request was reached
    - `raw_output` RawOutput — Extension of OpenAI that returns low-level interaction of what the model sees, including the formatted prompt and function calls
      - `prompt_fragments` union[], required — Pieces of the prompt (like individual messages) before truncation and concatenation. Depending on prompt_truncate_len some of the messages might be dropped. Contains a mix of strings to be tokenized and individual tokens (if dictated by the conversation template)
        - union
          - string
          - integer
      - `prompt_token_ids` integer[], required — Fully processed prompt as seen by the model
      - `completion` string, required — Raw completion produced by the model before any tool calls are parsed
      - `completion_token_ids` integer[], nullable — Token IDs for the raw completion
      - `completion_logprobs` NewLogProbs — OpenAI-compatible log probabilities format
        - `content` NewLogProbsContent[]
          - `token` string, required
          - `logprob` number, required
          - `sampling_logprob` number, nullable, required
          - `sampling_mask_count` integer, nullable
          - `sampling_mask` union
            - integer[]
            - string
          - `bytes` integer[], required
          - `top_logprobs` NewLogProbsContentTopLogProbs[]
            - `token` string, required
            - `logprob` number, required
            - `token_id` integer, required
            - `bytes` integer[]
          - `token_id` integer, required
          - `text_offset` integer, required
          - `last_activation` string, nullable
          - `routing_matrix` string, nullable
      - `images` string[], nullable — Images in the prompt
      - `videos` string[], nullable — Videos in the prompt
      - `grammar` string, nullable — Grammar used for constrained decoding, can be either user provided (directly or JSON schema) or inferred by the chat template
    - `prompt_token_ids` integer[], nullable — Token IDs for the prompt (when return_token_ids=true)
    - `token_ids` integer[], nullable — Token IDs for the generated completion (when return_token_ids=true)
  - `usage` UsageInfo, required — Usage statistics.
    - `prompt_tokens` integer, required — The number of tokens in the prompt
    - `total_tokens` integer, required — The total number of tokens used in the request (prompt + completion)
    - `completion_tokens` integer, nullable — The number of tokens in the generated completion
    - `prompt_tokens_details` PromptTokensDetails
      - `cached_tokens` integer, nullable
  - `perf_metrics` object, nullable — See parameter [perf_metrics_in_response](#body-perf-metrics-in-response)

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/fireworks/apis/fireworks-ai-anthropic-compatible-messages-api.md) · [All operations](https://skmtc.net/fireworks/apis/fireworks-ai-anthropic-compatible-messages-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/fireworks/fireworks-ai-anthropic-compatible-messages-api/revisions/954d6bc5d922/schema)
