> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gptproto.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Grok-3-Mini - Text To Text - Chat - openai

> Fast grok 3 mini chat. Lightweight and witty text generation for quick answers, coding help, and daily AI interactions.

## Authentication

1. Sign up for a GPTProto account at [https://gptproto.com](https://gptproto.com)
2. Navigate to the API Keys section in your dashboard
3. Generate a new API key (sk-xxxxx)
4. Copy and securely store your API key
   For authentication details, please refer to the [Authentication](https://docs.gptproto.com/authentication) section.

## Initiate Request

<CodeGroup>
  ```bash cURL theme={null}
  curl --location 'https://gptproto.com/v1/chat/completions' \
  --header 'Authorization: GPTPROTO_API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "grok-3-mini",
    "messages": [
      {
        "role": "user",
        "content": "Who are you?"
      }
    ],
    "stream": false
  }'

  ```

  ```javascript JavaScript theme={null}
  const axios = require('axios');
  let data = JSON.stringify({
    "model": "grok-3-mini",
    "messages": [
      {
        "role": "user",
        "content": "Who are you?"
      }
    ],
    "stream": false
  });

  let config = {
    method: 'post',
    maxBodyLength: Infinity,
    url: 'https://gptproto.com/v1/chat/completions',
    headers: { 
      'Authorization': 'GPTPROTO_API_KEY', 
      'Content-Type': 'application/json'
    },
    data : data
  };

  axios.request(config)
  .then((response) => {
    console.log(JSON.stringify(response.data));
  })
  .catch((error) => {
    console.log(error);
  });


  ```

  ```python Python theme={null}
  import requests
  import json

  url = "https://gptproto.com/v1/chat/completions"

  payload = json.dumps({
    "model": "grok-3-mini",
    "messages": [
      {
        "role": "user",
        "content": "Who are you?"
      }
    ],
    "stream": False
  })
  headers = {
    'Authorization': 'GPTPROTO_API_KEY',
    'Content-Type': 'application/json'
  }

  response = requests.request("POST", url, headers=headers, data=payload)

  print(response.text)


  ```

  ```go Go theme={null}
  package main

  import (
    "fmt"
    "strings"
    "net/http"
    "io"
  )

  func main() {

    url := "https://gptproto.com/v1/chat/completions"
    method := "POST"

    payload := strings.NewReader(`{
    "model": "grok-3-mini",
    "messages": [
      {
        "role": "user",
        "content": "Who are you?"
      }
    ],
    "stream": false
  }`)

    client := &http.Client {
    }
    req, err := http.NewRequest(method, url, payload)

    if err != nil {
      fmt.Println(err)
      return
    }
    req.Header.Add("Authorization", "GPTPROTO_API_KEY")
    req.Header.Add("Content-Type", "application/json")

    res, err := client.Do(req)
    if err != nil {
      fmt.Println(err)
      return
    }
    defer res.Body.Close()

    body, err := io.ReadAll(res.Body)
    if err != nil {
      fmt.Println(err)
      return
    }
    fmt.Println(string(body))
  }

  ```
</CodeGroup>

<Accordion title="Response Example">
  ```json theme={null}
  {
      "choices": [
          {
              "finish_reason": "stop",
              "index": 0,
              "message": {
                  "content": "I'm Grok, a helpful and maximally truthful AI built by xAI. I'm designed to answer questions, provide information, and tackle problems with a bit of wit and wisdom—think of me as inspired by the Hitchhiker's Guide to the Galaxy and JARVIS from Iron Man. Not omniscient, but I'll do my best. What's on your mind?",
                  "role": "assistant"
              }
          }
      ],
      "created": 1770018847,
      "id": "abc",
      "model": "grok-4",
      "object": "chat.completion",
      "system_fingerprint": "fp_dd0aa291c6",
      "usage": {
          "completion_tokens": 196,
          "completion_tokens_details": {
              "accepted_prediction_tokens": 0,
              "audio_tokens": 0,
              "reasoning_tokens": 124,
              "rejected_prediction_tokens": 0
          },
          "prompt_tokens": 688,
          "prompt_tokens_details": {
              "audio_tokens": 0,
              "cached_tokens": 679
          },
          "total_tokens": 884
      }
  }
  ```
</Accordion>

## Parameters

### Core Parameters

| Parameter                          | Type           | Required                      | Default | Range                                 | Description                                                                                                                                                                                                               |
| ---------------------------------- | -------------- | ----------------------------- | ------- | ------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `model`                            | string         | ✅ Yes                         | -       | -                                     | Model ID used to generate the completion. Grok offers a wide range of models with different capabilities, performance characteristics, and price points. Refer to the model guide to browse and compare available models. |
| `messages`                         | array          | ✅ Yes                         | -       | -                                     | A list of messages comprising the conversation so far. Depending on the model you use, different message types (modalities) are supported, like text, images, and audio.                                                  |
| `>messages.role`                   | string         | ✅ Yes                         | -       | `developer`<br />`user`<br />`system` | The role of the messages author.                                                                                                                                                                                          |
| `>messages.name`                   | string         | ❌ No                          | -       | -                                     | An optional name for the participant. Provides the model information to differentiate between participants of the same role.                                                                                              |
| `>messages.content`                | string / array | ✅ Yes                         | -       | -                                     | The contents of the developer message.                                                                                                                                                                                    |
| `>>messages.content.type`          | string         | ✅ Yes                         | -       | `text`<br />`image_url`               | The type of the content part                                                                                                                                                                                              |
| `>>messages.content.text`          | string         | ❌ No                          | -       | -                                     | The text content                                                                                                                                                                                                          |
| `>>messages.content.image_url`     | object         | ✅ Yes(if type is `image_url`) | -       | -                                     | The image URL content                                                                                                                                                                                                     |
| `>>messages.content.image_url.url` | string         | ❌ No                          | -       | -                                     | The URL of the image                                                                                                                                                                                                      |

### Advanced Parameters

| Parameter    | Type           | Required | Default | Range               | Description                                                                                                                           |
| ------------ | -------------- | -------- | ------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| `max_tokens` | integer / null | ❌ No     | -       | -                   | An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and reasoning tokens. |
| `stream`     | boolean        | ❌ No     | `false` | `true`<br />`false` | Whether to stream the response back incrementally. Defaults to false.                                                                 |

## Error Codes

### Common Error Codes

| Error Code | Error Name               | Description                                                                                                       |
| ---------- | ------------------------ | ----------------------------------------------------------------------------------------------------------------- |
| 401        | Unauthorized             | API key is missing or invalid                                                                                     |
| 403        | Forbidden                | Your API key doesn't have permission to access this resource, or insufficient balance for the requested operation |
| 429        | Too Many Requests        | You've exceeded your rate limit                                                                                   |
| 500        | Internal server error    | An internal server error occurred                                                                                 |
| 503        | Content policy violation | Content blocked due to safety concerns (actual status code is 400)                                                |
