Skip to content

Commit 54138c3

Browse files
techpro-aimlapigitbook-bot
authored andcommitted
GITBOOK-540: docs: add grok 4.1 (non-reasoning and reasoning)
1 parent 0e44c1a commit 54138c3

14 files changed

Lines changed: 380 additions & 26 deletions

docs/SUMMARY.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88

99
## API REFERENCES
1010

11-
* [Account Balance](api-references/can-i-get-my-billing-info-via-api-request.md)
11+
* [🟡 Service Endpoints](api-references/service-endpoints/README.md)
12+
* [Account Balance](api-references/service-endpoints/account-balance.md)
1213
* [📒 All Model IDs](api-references/model-database.md)
1314
* [Text Models (LLM)](api-references/text-models-llm/README.md)
1415
* [Alibaba Cloud](api-references/text-models-llm/Alibaba-Cloud/README.md)
@@ -131,6 +132,8 @@
131132
* [grok-code-fast-1](api-references/text-models-llm/xai/grok-code-fast-1.md)
132133
* [grok-4-fast-non-reasoning](api-references/text-models-llm/xai/grok-4-fast-non-reasoning.md)
133134
* [grok-4-fast-reasoning](api-references/text-models-llm/xai/grok-4-fast-reasoning.md)
135+
* [grok-4.1-fast-non-reasoning](api-references/text-models-llm/xai/grok-4-1-fast-non-reasoning.md)
136+
* [grok-4.1-fast-reasoning](api-references/text-models-llm/xai/grok-4-1-fast-reasoning.md)
134137
* [Zhipu](api-references/text-models-llm/zhipu/README.md)
135138
* [glm-4.5-air](api-references/text-models-llm/zhipu/glm-4.5-air.md)
136139
* [glm-4.5](api-references/text-models-llm/zhipu/glm-4.5.md)

docs/api-references/image-models/google/gemini-3-pro-image-preview-edit.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ This documentation is valid for the following list of our models:
1616

1717
## Model Overview
1818

19-
Google’s smartest image-to-image model as of November 2025 preview release. The model takes multiple images as input, with the prompt defining how they are used or combined.
19+
Google’s smartest image-to-image model as of the November 2025 preview release. The model takes multiple images as input, with the prompt defining how they are used or combined.
2020

2121
## Setup your API Key
2222

docs/api-references/image-models/google/gemini-3-pro-image-preview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ This documentation is valid for the following list of our models:
1616

1717
## Model Overview <a href="#model-overview" id="model-overview"></a>
1818

19-
Google’s smartest text-to-image model as of November 2025 preview release.
19+
Google’s smartest text-to-image model as of the November 2025 preview release.
2020

2121
## Setup your API Key <a href="#setup-your-api-key" id="setup-your-api-key"></a>
2222

docs/api-references/model-database.md

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# 🟡 Service Endpoints
2+

docs/api-references/can-i-get-my-billing-info-via-api-request.md renamed to docs/api-references/service-endpoints/account-balance.md

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,26 @@
11
---
2-
icon: file-user
2+
icon: money-check-pen
33
---
44

55
# Account Balance
66

7-
## Get Balance
7+
## Get account balance info
8+
9+
<mark style="color:green;">`GET`</mark> `https://billing.aimlapi.com/v1/billing/balance`
10+
11+
**Headers**
12+
13+
<table><thead><tr><th width="190.6666259765625">Name</th><th>Value</th></tr></thead><tbody><tr><td>Authorization</td><td><code>Bearer &#x3C;token></code></td></tr><tr><td>Content-Type</td><td><code>application/json</code></td></tr></tbody></table>
14+
15+
**Body**
16+
17+
**-**
18+
19+
**Response Schema**
20+
21+
<table><thead><tr><th width="189">Field</th><th>Description</th></tr></thead><tbody><tr><td><code>balance</code></td><td>The total credits associated with the provided API key.</td></tr><tr><td><code>lowBalance</code></td><td>True if the balance is below the threshold.</td></tr><tr><td><code>lowBalanceThreshold</code></td><td>Threshold for switching to low balance status.</td></tr><tr><td><code>lastUpdated</code></td><td>The date of the request — i.e., the current date.</td></tr><tr><td><code>autoDebitStatus</code></td><td>Indicates whether auto top-up is enabled for the plan.</td></tr><tr><td><code>status</code></td><td>The status of the plan associated with the provided API key.</td></tr><tr><td><code>statusExplanation</code></td><td>A more detailed explanation of the plan status.</td></tr></tbody></table>
22+
23+
## Example
824

925
{% tabs %}
1026
{% tab title="cURL" %}
@@ -69,7 +85,9 @@ main();
6985
{% endtab %}
7086
{% endtabs %}
7187

72-
### Response
88+
<details>
89+
90+
<summary>Response</summary>
7391

7492
```json5
7593
{
@@ -83,9 +101,4 @@ main();
83101
}
84102
```
85103

86-
**Response Schema**
87-
88-
<table><thead><tr><th width="189">Field</th><th>Description</th></tr></thead><tbody><tr><td><code>balance</code></td><td>The total credits associated with the provided API key.</td></tr><tr><td><code>lowBalance</code></td><td>True if the balance is below the threshold.</td></tr><tr><td><code>lowBalanceThreshold</code></td><td>Threshold for switching to low balance status.</td></tr><tr><td><code>lastUpdated</code></td><td>The date of the request — i.e., the current date.</td></tr><tr><td><code>autoDebitStatus</code></td><td>Indicates whether auto top-up is enabled for the plan.</td></tr><tr><td><code>status</code></td><td>The status of the plan associated with the provided API key.</td></tr><tr><td><code>statusExplanation</code></td><td>A more detailed explanation of the plan status.</td></tr></tbody></table>
89-
90-
91-
104+
</details>

docs/api-references/text-models-llm/README.md

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.
Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
# grok-4.1-fast-non-reasoning
2+
3+
<table data-header-hidden data-full-width="true"><thead><tr><th width="546.4443969726562" valign="top"></th><th width="202.666748046875" valign="top"></th></tr></thead><tbody><tr><td valign="top"><div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><p>This documentation is valid for the following model:</p><p><code>x-ai/grok-4-1-fast-non-reasoning</code></p></div></td><td valign="top"><a href="https://aimlapi.com/app/?model=x-ai/grok-4-1-fast-non-reasoning&#x26;mode=chat" class="button primary">Try in Playground</a></td></tr></tbody></table>
4+
5+
## Model Overview
6+
7+
xAI’s latest multimodal model, offering state-of-the-art cost efficiency and a 2M-token context window. Non-reasoning variant.
8+
9+
## How to Make a Call
10+
11+
<details>
12+
13+
<summary>Step-by-Step Instructions</summary>
14+
15+
:digit\_one: **Setup You Can’t Skip**
16+
17+
:black\_small\_square: [**Create an Account**](https://aimlapi.com/app/sign-up): Visit the AI/ML API website and create an account (if you don’t have one yet).\
18+
:black\_small\_square: [**Generate an API Key**](https://aimlapi.com/app/keys): After logging in, navigate to your account dashboard and generate your API key. Ensure that key is enabled on UI.
19+
20+
:digit\_two: **Copy the code example**
21+
22+
At the bottom of this page, you'll find [a code example](grok-4-1-fast-non-reasoning.md#code-example) that shows how to structure the request. Choose the code snippet in your preferred programming language and copy it into your development environment.
23+
24+
:digit\_three: **Modify the code example**
25+
26+
:black\_small\_square: Replace `<YOUR_AIMLAPI_KEY>` with your actual AI/ML API key from your account.\
27+
:black\_small\_square: Insert your question or request into the `content` field—this is what the model will respond to.
28+
29+
:digit\_four: <sup><sub><mark style="background-color:yellow;">**(Optional)**<mark style="background-color:yellow;"><sub></sup>**&#x20;Adjust other optional parameters if needed**
30+
31+
Only `model` and `messages` are required parameters for this model (and we’ve already filled them in for you in the example), but you can include optional parameters if needed to adjust the model’s behavior. Below, you can find the corresponding [API schema](grok-4-1-fast-non-reasoning.md#api-schema), which lists all available parameters along with notes on how to use them.
32+
33+
:digit\_five: **Run your modified code**
34+
35+
Run your modified code in your development environment. Response time depends on various factors, but for simple prompts it rarely exceeds a few seconds.
36+
37+
{% hint style="success" %}
38+
If you need a more detailed walkthrough for setting up your development environment and making a request step by step — feel free to use our [Quickstart guide](../../../quickstart/setting-up.md).
39+
{% endhint %}
40+
41+
</details>
42+
43+
## API Schema
44+
45+
46+
47+
## Code Example
48+
49+
{% tabs %}
50+
{% tab title="Python" %}
51+
{% code overflow="wrap" %}
52+
```python
53+
import requests
54+
import json # for getting a structured output with indentation
55+
56+
response = requests.post(
57+
"https://api.aimlapi.com/v1/chat/completions",
58+
headers={
59+
# Insert your AIML API Key instead of <YOUR_AIMLAPI_KEY>:
60+
"Authorization":"Bearer <YOUR_AIMLAPI_KEY>",
61+
"Content-Type":"application/json"
62+
},
63+
json={
64+
"model":"x-ai/grok-4-1-fast-non-reasoning",
65+
"messages":[
66+
{
67+
"role":"user",
68+
"content":"Hello" # insert your prompt here, instead of Hello
69+
}
70+
]
71+
}
72+
)
73+
74+
data = response.json()
75+
print(json.dumps(data, indent=2, ensure_ascii=False))
76+
```
77+
{% endcode %}
78+
{% endtab %}
79+
80+
{% tab title="JavaScript" %}
81+
{% code overflow="wrap" %}
82+
```javascript
83+
async function main() {
84+
const response = await fetch('https://api.aimlapi.com/v1/chat/completions', {
85+
method: 'POST',
86+
headers: {
87+
// insert your AIML API Key instead of <YOUR_AIMLAPI_KEY>
88+
'Authorization': 'Bearer <YOUR_AIMLAPI_KEY>',
89+
'Content-Type': 'application/json',
90+
},
91+
body: JSON.stringify({
92+
model: 'x-ai/grok-4-1-fast-non-reasoning',
93+
messages:[
94+
{
95+
role:'user',
96+
content: 'Hello' // insert your prompt here, instead of Hello
97+
}
98+
],
99+
}),
100+
});
101+
102+
const data = await response.json();
103+
console.log(JSON.stringify(data, null, 2));
104+
}
105+
106+
main();
107+
```
108+
{% endcode %}
109+
{% endtab %}
110+
{% endtabs %}
111+
112+
<details>
113+
114+
<summary>Response</summary>
115+
116+
{% code overflow="wrap" %}
117+
```json5
118+
{
119+
"id": "cde99f85-8ddb-6585-168f-02d58ae9e1e2",
120+
"object": "chat.completion",
121+
"created": 1763994479,
122+
"model": "grok-4-1-fast-non-reasoning",
123+
"choices": [
124+
{
125+
"index": 0,
126+
"message": {
127+
"role": "assistant",
128+
"content": "Mankind? Fascinating bunch—capable of landing on the moon, splitting atoms, and inventing cat videos, yet also prone to wars, reality TV, and pineapple on pizza debates. We've got this wild mix of curiosity, creativity, and chaos that drives progress (hello, smartphones and vaccines) while occasionally tripping over our own egos. Overall, I'm optimistic: with our knack for adaptation and innovation, humanity's got a shot at solving the big stuff like climate change or AI ethics. What sparks your take on us?",
129+
"refusal": null
130+
},
131+
"finish_reason": "stop"
132+
}
133+
],
134+
"usage": {
135+
"prompt_tokens": 177,
136+
"completion_tokens": 106,
137+
"total_tokens": 283,
138+
"prompt_tokens_details": {
139+
"text_tokens": 177,
140+
"audio_tokens": 0,
141+
"image_tokens": 0,
142+
"cached_tokens": 161
143+
},
144+
"completion_tokens_details": {
145+
"reasoning_tokens": 0,
146+
"audio_tokens": 0,
147+
"accepted_prediction_tokens": 0,
148+
"rejected_prediction_tokens": 0
149+
},
150+
"num_sources_used": 0
151+
},
152+
"system_fingerprint": "fp_80e0751284",
153+
"meta": {
154+
"usage": {
155+
"tokens_used": 204
156+
}
157+
}
158+
}
159+
```
160+
{% endcode %}
161+
162+
</details>

0 commit comments

Comments
 (0)