Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.keywordsai.co/llms.txt

Use this file to discover all available pages before exploring further.

Get xAI API key

Get your xAI API key from the xAI Console to start using xAI models through Keywords AI.

xAI models compatibility

Add xAI API keys

There are 2 ways to add your xAI credentials to your requests:

Via UI

1

Go to the Providers page

2

Add your xAI credentials.

Follow the on-screen instructions to add your xAI API key.

Via code

  • Add customer_credentials parameter in your request body to use your own xAI credits.
{
  // Rest of the request body
  "customer_credentials": {
    "xai": {
      "api_key": "YOUR_XAI_API_KEY"
    }
  }
}

Full request example

from openai import OpenAI

client = OpenAI(
    base_url="https://api.keywordsai.co/api/",
    api_key="YOUR_KEYWORDSAI_API_KEY",
)

response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role":"user", "content":"Tell me a long story"}],
    extra_body={"customer_credentials": {
                  "xai": {
                      "api_key": "YOUR_XAI_API_KEY",
                  }
                }
              }
)