10
0 Comments

The xAI API just dropped — and you can try it for free
IH+ Subscribers Only

All users will get $25 credit per month till the end of the year to test out the API.

Grok xAI API

X's AI company has released an API for its flagship large language model Grok for the first time.

The interface links up to a preview of a more efficient version of the model. It's roughly as powerful as the current model, Grok 2, but offers faster responses.

"Grok-beta" generates text and code and can support custom system prompts and function calling. That means users can connect it to external tools.

For now, grok-beta is text-only. But xAI plans to release a vision version that can interpret images next week.

Embedding models also appear to be on the horizon, as there's already a section for them in the API platform. These translate language into numberical data and help power things like AI searches.

Plenty of indie hackers are excited about the move. "Looks awesome, prototyping it right now," wrote Micro Launch founder Saïd Aitmbarek.

Others quickly shot feature requests to Toby Pohlen — some of whom the xAI founding member confirmed the company was working on.

But some X users criticized the API, which is in beta. User data geek, who appears to be a data scientist, said it was "lazy" when used with other tools and stopped working after the first call.

How can I access the API?

xAI console Grok

To access the API, you need to have (or sign up for) an xAI account at console.x.ai.

The company is keen for developers to try out the model, so it's giving every user $25 a month in free credit till the end of the year. Accounts with existing prepaid credit will get a $25 topup.

Grok-beta has a context length of 128,000 tokens: small chunks of language data around 4 characters long. They don't track to word length or count, but you can expect to use around about 100 tokens for a 75-word message.

Text inputs to grok-beta model currently cost $5 per million tokens. Chat completions (in other words, responses) cost $15 per million tokens.

That's more expensive than OpenAI's API pricing. GPT-4o costs $2.50 per million input tokens and $10.00 per million output tokens. And users who submit requests in batches pay half that.

Anthropic's Claude 3.5 Sonnet offers cheaper inputs at $3 per million input tokens. But its outputs also cost $15 per million tokens.

Users who like the API over rivals from OpenAI or Anthropic should be able to migrate fairly easily, as it's compatible with their software development kits (SDKs).

What is Grok?

Grok logo

Long before he bought X, serial entrepreneur Elon Musk co-founded OpenAI with then-Ycombinator president Sam Altman.

Musk left the organization in 2018, but his interest in AI didn't fade. In April 2023 he announced he wanted to release a "truth-seeking" AI model.

Seven months later, X released a preview of Grok to a small number of Premium users, before rolling out access to all Premium users in March.

The chatbot is named for a kind of empathetic understanding referred to as "Grok" in the Robert M Heinlein science fiction novel Strangers in a Strange Land.

It's billed as "witty" and "rebellious," offering a "fun" response mode as as well as a regular one.

X bills the model as a kind of Hitchiker's Guide to the Galaxy, "intended to answer almost anything."

Indie Hackers Newsletter: Subscribe to get the latest stories, trends, and insights for indie hackers in your inbox 3x/week.

Photo of Katie Hignett Katie Hignett

Katie is a journalist for Indie Hackers who specializes in tech, startups, exclusive investigations, and breaking news. She's written for Forbes, Newsweek, and more. She's also an indie hacker herself, working on EasyFOI.

Create a free account
to read this article.

Already have an account? Sign in.