Integration

OpenAI through the Vigil proxy

OpenAI’s API at api.openai.com: Chat Completions and Responses, with automatic prompt caching on the provider’s side. Point your SDK's base URL at Vigil, add one header, and every OpenAI call is logged with its cost, tokens, latency, errors and agent, then forwarded to https://api.openai.com unchanged unless you switch on an optimisation. Prompt caching never changes answers. History trimming and model routing can: both are opt-in, run in Shadow first, and stop automatically if errors, cut-off answers or failed answers rise.

What Vigil records per OpenAI call

Each OpenAI call is one record: model id, tokens, cache reads and writes, latency, status, error code and agent. What a record holds, what happens to your OpenAI key and what the hop costs in latency are answered once in the FAQ: what Vigil sees, your provider key and added latency.

Cost is computed from the proxy's rate registry, which prices 15 models on this platform today. A model the registry has no row for is logged with its cost left empty, never estimated.

  • chat-latest
  • gpt-4.1-mini
  • gpt-4o
  • gpt-4o-2024-05-13
  • gpt-4o-mini
  • gpt-5.3-codex
  • gpt-5.6-cyber
  • gpt-5.6-luna
  • gpt-5.6-sol
  • gpt-5.6-terra
  • gpt-6-astra
  • gpt-6-luna
  • gpt-6-sol
  • gpt-6.1-sol
  • gpt-6.1-terra

Price per token, by model: GPT-6 Sol, GPT-6 Luna, GPT-5.6 Sol, GPT-5.3 Codex, GPT-4o, GPT-4o mini.

Setup

The OpenAI base URL is https://api.vigil.tools/{user_id}/openai; a request path such as /v1/chat/completions is forwarded unchanged, and your OpenAI key stays in OPENAI_API_KEY. The two Vigil headers, the modes and the error codes are the same for every provider: see the LLM proxy setup.

your OpenAI client
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.OPENAI_API_KEY,   // unchanged
  baseURL: "https://api.vigil.tools/{user_id}/openai/v1",
  defaultHeaders: {
    // MUST be X-Vigil-Key: Authorization already carries your OpenAI key.
    "X-Vigil-Key": "vk_your_vigil_key",
    "X-Vigil-Agent": "my-agent",
  },
});

const completion = await client.chat.completions.create({
  model: "gpt-6-luna",
  messages: [{ role: "user", content: "Hello!" }],
});
your OpenAI client
from openai import OpenAI

client = OpenAI(
    base_url="https://api.vigil.tools/{user_id}/openai/v1",
    default_headers={
        "X-Vigil-Key": "vk_your_vigil_key",
        "X-Vigil-Agent": "my-agent",
    },
)

completion = client.chat.completions.create(
    model="gpt-6-luna",
    messages=[{"role": "user", "content": "Hello!"}],
)
terminal
curl https://api.vigil.tools/{user_id}/openai/v1/chat/completions \
  -H "content-type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "X-Vigil-Key: vk_your_vigil_key" \
  -H "X-Vigil-Agent: my-agent" \
  -d '{
    "model": "gpt-6-luna",
    "messages": [{ "role": "user", "content": "Hello!" }]
  }'

Prompt caching on OpenAI

This provider caches automatically, on its own terms. Vigil records what it reports and prices it — there is nothing for Vigil to add to the request.

With optimisation On: the provider caches automatically or not at all; Vigil records cache use and does not change the request. In Shadow, Vigil measures what caching would have saved and changes nothing. Off records the call and nothing more.

Questions

Which OpenAI models does Vigil price?
15 models with a published rate in the registry: chat-latest, gpt-4.1-mini, gpt-4o, gpt-4o-2024-05-13, gpt-4o-mini, gpt-5.3-codex, gpt-5.6-cyber, gpt-5.6-luna, gpt-5.6-sol, gpt-5.6-terra, gpt-6-astra, gpt-6-luna, gpt-6-sol, gpt-6.1-sol, gpt-6.1-terra. A call to any other OpenAI model is logged and monitored, with its cost left empty rather than guessed.

Other providers: Anthropic · AWS Bedrock · Google Vertex · Google Gemini · Mistral · xAI Grok · DeepSeek · Together AI · Fireworks AI · Groq · Cerebras · Baseten · Moonshot · Z.ai · Cloudflare Workers AI · OpenRouter