# Grok Grok 4 0709 > Try Grok-4 on GPT Proto. xAI’s flagship text model for reasoning, coding, and analysis via OpenAI-style API. Get more affordable AI API access. ## Overview - **Base URL**: `https://gptproto.com/v1` - **Model ID**: `grok-4-0709` - **Vendor**: Grok - **Category**: text-to-text - **Capabilities**: text-to-text, image-to-text - **Supported endpoints**: Chat Completions - **Model page**: https://gptproto.com/model/grok/grok-4-0709 - **API documentation**: https://docs.gptproto.com/docs/allapi/Grok/grok-4-0709/openai-format/text-to-text-chat ## Authentication Every request needs a GPTProto API key in the `Authorization` header. Create one at https://gptproto.com/dashboard/api-key, then export it: ```bash export GPTPROTO_API_KEY="your-api-key" ``` Header: `Authorization: Bearer $GPTPROTO_API_KEY`. Use `base_url` `https://gptproto.com/v1` with any OpenAI-compatible SDK. ## Pricing Platform price by tier (USD, already includes the GPTProto discount): - **Output** — $0.009 per 1K tokens - **Input** — $0.0018 per 1K tokens Price range: $0 – $0 per generation. Prices may change. The model page always shows the live price: https://gptproto.com/model/grok/grok-4-0709 ## Endpoints ### Chat Completions Sends a request for a model response for the given chat conversation. Supports both streaming and non-streaming modes. `POST https://gptproto.com/v1/chat/completions` - **Authorization**: `Bearer $GPTPROTO_API_KEY` - **Content-Type**: `application/json` ## Parameters Common request body fields for this model: - **`frequency_penalty`** (`float`): -2 to 2 - **`logprobs`** (`boolean`): return logprobs - **`max_tokens`** (`integer`): max output - **`presence_penalty`** (`float`): -2 to 2 - **`reasoning`** (`object`): {effort: low/medium/high} - **`reasoning_effort`** (`string`): low/medium/high - **`response_format`** (`object`): output format - **`seed`** (`integer`): random seed - **`stop`** (`string`): stop sequences - **`temperature`** (`float`): 0-2 - **`tool_choice`** (`string`): default: auto - **`tools`** (`array`): function calling - **`top_p`** (`float`): 0-1 ## Usage Examples ### 1. First request The snippets below call **Chat Completions**. Swap the path if you prefer another supported endpoint. ```bash curl --request POST "https://gptproto.com/v1/chat/completions" \ --header "Authorization: Bearer $GPTPROTO_API_KEY" \ --header "Content-Type: application/json" \ --data '{ "model": "grok-4-0709", "messages": [ { "role": "user", "content": "Hello" } ] }' ``` ```python import os import requests url = "https://gptproto.com/v1/chat/completions" headers = { "Authorization": f"Bearer {os.environ['GPTPROTO_API_KEY']}", "Content-Type": "application/json" } payload = { "model": "grok-4-0709", "messages": [ { "role": "user", "content": "Hello" } ] } response = requests.request("POST", url, headers=headers, json=payload) print(response.json()) ``` ```typescript const response = await fetch("https://gptproto.com/v1/chat/completions", { method: "POST", headers: { "Authorization": `Bearer ${process.env.GPTPROTO_API_KEY}`, "Content-Type": "application/json", }, body: JSON.stringify({ model: "grok-4-0709", messages: [ { role: "user", content: "Hello", }, ], }), }); const data = await response.json(); console.log(data); ``` ```python from openai import OpenAI import os client = OpenAI( base_url="https://gptproto.com/v1", api_key=os.environ["GPTPROTO_API_KEY"], ) completion = client.chat.completions.create( model="grok-4-0709", messages=[ { "role": "user", "content": "Hello" } ] ) print(completion.choices[0].message.content) ``` ```typescript import OpenAI from "openai"; const client = new OpenAI({ baseURL: "https://gptproto.com/v1", apiKey: process.env.GPTPROTO_API_KEY, }); const completion = await client.chat.completions.create({ model: "grok-4-0709", messages: [ { role: "user", content: "Hello", }, ], }); console.log(completion.choices[0].message.content); ``` ### 2. Enable streaming Add `"stream": true` to the request body to receive tokens as server-sent events: ```bash curl -N --request POST "https://gptproto.com/v1/chat/completions" \ --header "Authorization: Bearer $GPTPROTO_API_KEY" \ --header "Content-Type: application/json" \ --data '{ "stream": true, "model": "grok-4-0709", "messages": [ { "role": "user", "content": "Hello" } ] }' ``` ## HTTP Status Codes - `400` — malformed body, a parameter or value this model does not accept, or input blocked by the provider's content moderation - `401` — missing or invalid API key - `403` — insufficient credits - `413` — request body too large - `429` — rate limited; retry with backoff - `500` — An internal server error occurred - `502` — An internal server error occurred - `504` — Gateway timeout — upstream service did not respond in time; retry later ## Additional Resources - [Model page](https://gptproto.com/model/grok/grok-4-0709) - [API documentation](https://docs.gptproto.com/docs/allapi/Grok/grok-4-0709/openai-format/text-to-text-chat) - [All models](https://gptproto.com/model) - [API keys](https://gptproto.com/dashboard/api-key) - [Platform overview for LLMs](https://gptproto.com/llm-full.txt) - Any other model: `https://gptproto.com/model/{vendor}/{model}/{scene}/llms.txt`