Skip to main content
AnyAIGC / Grok
EN

xAI / TEXT & CODE

Grok 4 API

Keep building on familiar ground.

Grok 4 supports text and image understanding through Chat Completions. Maintain an existing integration and compare later models on your own tasks and costs.

Input from $0.2978/1M tokens · Unlimited concurrency for every user

300+ models, one keyDirect API accessSelf-service invoices

01 / CAPABILITIES

Built for work that matters.

Chat · Image understanding · Existing apps

01

Text generation

Create explanations, summaries, and drafts from supplied information in an existing chat or content workflow.

02

Image understanding

The catalog lists image understanding. Supply an image in the format supported by the API and ask questions about it.

03

Existing integrations

Keep the grok-4 model ID for regression evaluation, then compare with 4.7 before deciding on a migration.

Capabilities are based on official release notes and the catalog. Check the documentation for the model and endpoint you use. Grok 4.7 release notes ↗

02 / USAGE PRICING

Grok 4 API pricing

Clear input and output rates, billed by token usage.

USD / 1M tokensUnlimited concurrency by defaultOne balance across models
Lowest displayed catalog rates · checked 2026-11-05
Operation / tierModel IDPrice (USD)
Grok 4 Input / output
Inputgrok-4$0.2978 / 1M tokens
Outputgrok-4$1.4890 / 1M tokens

Prices are in USD. Successfully submitted requests are metered by actual input and output tokens; current catalog rates apply. The 200K / 500K boundaries describe input billing tiers, not context limits for every model. Unlisted cache rates do not mean free usage; actual cache hits and other charges follow your bill.

Cost examples · grok-4

One analysis

100,000 input + 20,000 output tokens

$0.2978 × 0.1 + $1.4890 × 0.02$0.05956

Ten tasks of the same size

100,000 input + 20,000 output tokens each

10 × $0.05956$0.5956

Examples use the base input tier, without cache hits or additional tool charges.

03 / USE CASES

Bring it into your workflow.

Development & code review

Supply code and constraints for implementation suggestions, test plans, and review notes. Verify with your project tools.

Business agents

Connect queries, calculations, and internal systems into traceable multi-step tasks. Confirm tool support for your chosen model.

Research & knowledge work

Turn supplied material into summaries, proposals, and report drafts, with sources and review for key facts.

AnyAIGC

One key. More ways forward.

One API key and shared balance for 300+ models.

Direct access with published unit rates for budgeting.

Unlimited concurrency for every user of this series.

04 / QUICKSTART

Integrate Grok 4 API

Start with a minimal request, then connect it to your application.

  1. 01Sign up and create an API key in the console.
  2. 02Set the ANYAIGC_API_KEY environment variable.
  3. 03Send a request with grok-4 and inspect usage in the console.

The cURL examples use Bash / WSL. Python uses the standard library without an SDK. Requests return complete JSON; Python reads choices[0].message.content.

cURL
curl https://anyaigc.ai/v1/chat/completions \
  -H "Authorization: Bearer $ANYAIGC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "grok-4",
  "messages": [
    {
      "role": "user",
      "content": "Summarize this requirement: users can create, edit, and archive tickets. List edge cases to clarify."
    }
  ],
  "stream": false
}'
Python · standard library
import json
import os
import urllib.request

payload = {'model': 'grok-4', 'messages': [{'role': 'user', 'content': 'Summarize this requirement: users can create, edit, and archive tickets. List edge cases to clarify.'}], 'stream': False}
request = urllib.request.Request(
    "https://anyaigc.ai/v1/chat/completions",
    data=json.dumps(payload).encode("utf-8"),
    headers={
        "Authorization": f"Bearer {os.environ['ANYAIGC_API_KEY']}",
        "Content-Type": "application/json",
    },
    method="POST",
)
with urllib.request.urlopen(request, timeout=180) as response:
    result = json.load(response)
print(result["choices"][0]["message"]["content"])

AnyAIGC documentation defines request and response fields. The Messages page does not document Grok-specific response differences, so that example shows the request without assuming extra response fields.

05 / ENTERPRISE

Grok 4 API for teams and enterprises

Bring procurement, finance, and engineering into one integration process.

01

Invoices

Issue invoices yourself in the console for the amount you actually topped up.

02

Dedicated support

Dedicated support and technical contacts for integration and troubleshooting.

Payment methods
  • WeChat Pay
  • Alipay
  • USDT
  • Credit card

Why teams trust AnyAIGC

Trial credit, top-ups, refunds, data handling and billing, spelled out up front.

  • 5M free tokens to start

    New accounts get trial credit, so you can test before you top up.

  • Top up from $1, refundable

    Top up from $1. Unused balance can be refunded with no fee.

  • Official channels, real models

    Requests go to official model channels, never cheaper or reverse-engineered substitutes.

  • No retention, no training

    Unless the law requires it, your prompts and outputs are not persistently stored or used for training. See the privacy policy.

  • Transparent billing, spend caps

    See tokens and cost for every request in the console, and set a quota on each API key.

  • 24/7 support

    Contact support any time about integration, billing or incidents.

06 / MODEL FAMILY

Find Grok for your next task.

Grok 4.x overview and price comparison ↗

07 / FAQ

Grok 4 API FAQ

What model ID should I use for Grok 4?

Use grok-4 exactly as written. See the Grok 4.x overview for other models in the series.

How is the Grok API priced?

Input costs $0.2978 and output costs $1.4890 per million tokens. These are the lowest displayed catalog rates; check the model catalog for current pricing.

Which API endpoints are supported?

Supports POST /v1/chat/completions, as currently listed in the model catalog.

Are there concurrency or RPM limits?

All models listed here have unlimited concurrency by default for every user, with no separate activation. Manage connections, timeouts, and retries in your application.

Does the API automatically include live X data?

Ordinary chat does not automatically include live events. xAI requires search tools for live data; the basic examples here do not use search or promise support for every upstream search tool. Commercial use is governed by xAI terms.

Can I get an invoice from AnyAIGC?

Yes. You can issue invoices yourself in the console, for the amount you actually topped up.

Which payment methods are supported?

You can top up with WeChat Pay, Alipay, USDT or a credit card. Your balance is in USD and works across every model on the platform. Invoices can be issued in the console for the amount you topped up.

Is there free trial credit for new users?

Yes. New accounts get 5 million tokens of trial credit, so you can test before deciding to top up. Top-ups start at $1.

Can I get a refund on my balance?

Yes. Unused balance can be refunded with no fee. Contact support to start a refund.

Are these the real models? Is my data safe?

Requests go to official model channels, never cheaper or reverse-engineered substitutes. Unless the law requires it, we do not persistently store your prompts or outputs or use them for training, and the console shows tokens and cost for every request.