Skip to main content
The AI Stats Gateway gives you a single, unified API surface for accessing multiple model providers. Follow this guide to create an API key, send your first request, and adopt the conventions that keep integrations production ready.

Before you begin

Make sure you have the following in place:
  • An AI Stats account with Gateway access.
  • At least one API key generated from your dashboard.
  • An HTTP client such as curl, fetch, or axios.
  • A model ID supported by the Gateway (for example gpt-5-nano-2025-08-07).

1. Create and store an API key

  1. Log in to the AI Stats dashboard.
  2. Navigate to Gateway → API Keys.
  3. Create a new key, give it a descriptive name, and copy the generated value.
  4. Store the key securely using your secret manager or environment variables:
# .env
AI_STATS_API_KEY="aistats_v1_k_xx_xxx"
💡 Tip Rotate keys regularly and remove any that are no longer needed. This keeps access scoped and auditable.

2. Choose an endpoint and model

Pick the endpoint that matches your use case. The Gateway normalises payloads across providers, so request shapes are consistent:
EndpointWhen to use it
/v1/chat/completionsConversational interfaces, agents, and assistants.
/v1/moderationsSafety and content policy checks.
/v1/images/embeddingsImage generation from text prompts.
More endpoints are coming soon. We will keep the API compatible as we expand. Refer to the API Reference for the complete list of supported parameters and responses.

3. Send a request

Here is a minimal curl example using the chat completions endpoint:
curl https://gateway.ai-stats.phaseo.app/v1/chat/completions \
    -H "Authorization: Bearer $AI_STATS_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
        "model": "gpt-5-nano-2025-08-07",
        "messages": [
            { "role": "system", "content": "You are a helpful assistant." },
            { "role": "user", "content": "Explain the benefits of AI." }
        ]
    }'
The response includes metadata such as provider, model version, and token usage so you can track costs regardless of which provider served the request.

4. Handle configuration for the API

Store your API key in environment variables for different environments:
# .env.local
AI_STATS_API_KEY="aistats_v1_k_xx_xxx"
AI_STATS_BASE_URL="https://api.ai-stats.phaseo.app/v1"
This allows you to keep everything consistent across development, staging, and production. When making requests, always include the Authorization header with your API key:
Authorization: Bearer $AI_STATS_API_KEY

5. Next steps

  • Review Authentication to learn about header formats and workspace tokens.
  • Explore Common use cases for production-ready patterns.
  • Browse the Examples to see complete integrations in popular frameworks.