Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.ai-stats.phaseo.app/llms.txt

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

This recipe is for teams building internal tools, CLIs, or coding-agent workflows on top of the gateway SDKs.
If you want a reusable starting point instead of writing every skill from scratch, install the public AI Stats skills from AI-Stats/skills:
npx skills add AI-Stats/skills --agent codex --skill '*'
Then keep project-specific instructions in your local SKILL.md.
The main idea is simple:
  • keep your SDK setup inside the repository
  • add a SKILL.md file that teaches the agent how the project expects requests to be made
  • point the agent at that file during setup so request patterns stay consistent

1. Install the SDK

If you’re using TypeScript or JavaScript:
npm install @ai-stats/sdk
If you’re using Python:
pip install ai-stats

2. Add a project-local skill file

Create SKILL.md in the repository root or the agent skill location your team uses.
# AI Stats Gateway

- Use `https://api.phaseo.app/v1` as the gateway base URL.
- Read the API key from `AI_STATS_API_KEY`.
- Prefer the Responses API for new text integrations.
- Use preset slugs when the repository defines shared request defaults.
- Log request ids and model ids for debugging.
- For async video jobs, store the returned id and poll status until terminal.

3. Keep the first integration tiny

For coding agents, smaller request helpers are easier to reuse than large wrappers.
import AIStats from "@ai-stats/sdk";

export const gateway = new AIStats({
  apiKey: process.env.AI_STATS_API_KEY!,
});
Then keep one obvious call path per surface:
  • text generation
  • async video
  • embeddings
  • image generation

4. What the skill should encode

Your SKILL.md should answer the questions that waste the most agent time:
  • which endpoint family to prefer
  • which environment variable holds credentials
  • which model ids or preset slugs are approved
  • how request ids should be logged
  • how async jobs should be tracked
  • SDK helper in one shared module
  • SKILL.md next to the integration code or at repository root
  • one short example per major endpoint
  • one note covering request logging and error handling
This gives both humans and coding agents the same operational entrypoint.
Last modified on May 19, 2026