overview.md +6 −6
70 70
71You can also switch inside the TUI with `/model <name>`.71You can also switch inside the TUI with `/model <name>`.
72 72
7373## Use Grok Build 0.1 on the API## Use Grok 4.5 on the API
74 74
7575The same model that powers Grok Build, [`grok-build-0.1`](/developers/models/grok-build-0.1), is also available directly on the xAI API in early access. Drop it into your own agent loop, IDE integration, or coding tool.The same model that powers Grok Build, [`grok-4.5`](/developers/models/grok-4.5), is also available directly on the xAI API. Drop it into your own agent loop, IDE integration, or coding tool.
76 76
77```bash customLanguage="bash"77```bash customLanguage="bash"
78curl https://api.x.ai/v1/responses \78curl https://api.x.ai/v1/responses \
79 -H "Authorization: Bearer $XAI_API_KEY" \79 -H "Authorization: Bearer $XAI_API_KEY" \
80 -H "Content-Type: application/json" \80 -H "Content-Type: application/json" \
81 -d '{81 -d '{
8282 "model": "grok-build-0.1", "model": "grok-4.5",
83 "input": "Fix this function and explain the bug: function median(a){a.sort();return a[a.length/2]}"83 "input": "Fix this function and explain the bug: function median(a){a.sort();return a[a.length/2]}"
84 }'84 }'
85```85```
91 91
92client = Client(api_key=os.getenv("XAI_API_KEY"))92client = Client(api_key=os.getenv("XAI_API_KEY"))
93 93
9494chat = client.chat.create(model="grok-build-0.1")chat = client.chat.create(model="grok-4.5")
95chat.append(user("Fix this function and explain the bug: function median(a){a.sort();return a[a.length/2]}"))95chat.append(user("Fix this function and explain the bug: function median(a){a.sort();return a[a.length/2]}"))
96 96
97print(chat.sample().content)97print(chat.sample().content)
106)106)
107 107
108response = client.responses.create(108response = client.responses.create(
109109 model="grok-build-0.1", model="grok-4.5",
110 input="Fix this function and explain the bug: function median(a){a.sort();return a[a.length/2]}",110 input="Fix this function and explain the bug: function median(a){a.sort();return a[a.length/2]}",
111)111)
112 112
118import { generateText } from 'ai';118import { generateText } from 'ai';
119 119
120const { text } = await generateText({120const { text } = await generateText({
121121 model: xai.responses('grok-build-0.1'), model: xai.responses('grok-4.5'),
122 prompt: 'Fix this function and explain the bug: function median(a){a.sort();return a[a.length/2]}',122 prompt: 'Fix this function and explain the bug: function median(a){a.sort();return a[a.length/2]}',
123});123});
124 124