Quick Start

1. Get Your API Key

To start using the XAI API, you first need an API Key. The system is currently in an invitation-only phase. Please contact your parent account administrator or the platform administrator to create an account for you and obtain your unique API Key.

Your key will start with sk-....

2. Configure the API Endpoint

The core advantage of the XAI API is its compatibility. You just need to change the API request address (base_url or endpoint) in your application or SDK from the official address to the XAI API address.

  • XAI API Base URL: https://api.proxyxai.com

3. Make Your First Request

Now, you can use any tool that supports HTTP requests (like cURL) or your favorite programming language's SDK to call the API.

Here is an example of calling the gpt-4o-mini model using cURL:

# Replace YOUR_XAI_API_KEY with your own key
export XAI_API_KEY="sk-Xvs..."

curl https://api.proxyxai.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $XAI_API_KEY" \
  -d '{
      "model": "gpt-4o-mini",
      "messages": [
        {
          "role": "user",
          "content": "Hello, XAI API!"
        }
      ]
    }'

If everything goes well, you will receive a JSON response similar to the following:

{
  "id": "chatcmpl-...",
  "object": "chat.completion",
  "created": 1728511727,
  "model": "gpt-4o-mini",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Hello! How can I help you?"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 12,
    "completion_tokens": 10,
    "total_tokens": 22
  },
  "system_fingerprint": "fp_..."
}

Congratulations! You have successfully made an AI API call through the XAI API.

Development/Test Key

We provide a shared key for development and testing. It has strict model, rate, and access control limits and is intended for trial and debugging purposes only.

EndpointBASE_URLAPI_KEY
XAIhttps://api.proxyxai.comsk-XvskBeymPs0X6HSju25MQ9WU8jtITF5GKG7GmV9TCvYVlk1B
**Important Note**: By default, any model request made with this test key will be mapped to the `gemini-2.5-flash` model.