Documentation

Build with 7XAI in 5 minutes.

OpenAI-compatible API, SDKs for every major language, and a worldwide GPU network.

Quick Start

1. Sign up, grab your API key, and start making calls in seconds.

1

Create your API key

Head to API Keys and click Create Key. Save it somewhere safe — it is shown only once.

2

Install the SDK

npm install @7xai/sdk
3

Make your first request

ts
import { SevenXAI } from '@7xai/sdk';

const client = new SevenXAI({ apiKey: process.env.SEVENXAI_API_KEY });

const res = await client.chat.completions.create({
  model: '7xai-super',
  messages: [{ role: 'user', content: 'Hello, 7XAI!' }],
  stream: true,
});

for await (const chunk of res) {
  process.stdout.write(chunk.choices[0]?.delta?.content ?? '');
}
4

Use any model — same interface

ts
// Use GPT-4o, Claude 3.5, Gemini, Doubao, Qwen, DeepSeek...
// All available through one /v1/chat/completions endpoint
const models = ['gpt-4o', 'claude-3-5-sonnet', 'gemini-pro', 'doubao-pro', 'qwen-max', 'deepseek-v3'];

for (const model of models) {
  await client.chat.completions.create({ model, messages: [...] });
}

cURL example

Standard OpenAI-compatible format — drop-in replacement.

bash
curl https://api.7xai.com/v1/chat/completions \
  -H "Authorization: Bearer $SEVENXAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "7xai-super",
    "messages": [{"role": "user", "content": "Explain decentralized compute in one paragraph."}],
    "stream": true
  }'

Examples across languages

Python
from openai import OpenAI

client = OpenAI(
    api_key="sk-...",
    base_url="https://api.7xai.com/v1"
)

resp = client.chat.completions.create(
    model="7xai-super",
    messages=[{"role": "user", "content": "Hi!"}]
)
print(resp.choices[0].message.content)
Go
package main

import (
    "context"
    "fmt"
    openai "github.com/sashabaranov/go-openai"
)

func main() {
    cfg := openai.DefaultConfig("sk-...")
    cfg.BaseURL = "https://api.7xai.com/v1"
    client := openai.NewClientWithConfig(cfg)

    resp, _ := client.CreateChatCompletion(
        context.Background(),
        openai.ChatCompletionRequest{
            Model: "7xai-super",
            Messages: []openai.ChatCompletionMessage{
                {Role: "user", Content: "Hi!"},
            },
        },
    )
    fmt.Println(resp.Choices[0].Message.Content)
}