CI/CD Integration

Prysm supports dynamic upstream API keys and custom header forwarding, enabling seamless integration with CI/CD pipelines and AI gateway platforms like GitLab AI Gateway, AWS Bedrock, and Azure OpenAI Service.

Dynamic Upstream API Key

Override the stored provider API key at request time by passing the X-Prysm-Upstream-Key header. This is useful when the API key is injected by a CI/CD runner or gateway at runtime.

curl -X POST https://prysmai.io/api/v1/chat/completions \
  -H "Authorization: Bearer sk-prysm-YOUR_KEY" \
  -H "X-Prysm-Upstream-Key: glpat-xxxxxxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"model": "claude-sonnet-4-20250514", "messages": [{"role": "user", "content": "Hello"}]}'

Custom Header Forwarding

Pass custom headers to the upstream provider via X-Prysm-Forward-Headers (JSON string). Content-Type and Authorization cannot be overridden for security.

curl -X POST https://prysmai.io/api/v1/chat/completions \
  -H "Authorization: Bearer sk-prysm-YOUR_KEY" \
  -H "X-Prysm-Upstream-Key: $AI_GATEWAY_TOKEN" \
  -H 'X-Prysm-Forward-Headers: {"X-Gitlab-Instance-Id": "ea8bf810-...", "X-Gitlab-Realm": "saas"}' \
  -H "Content-Type: application/json" \
  -d '{"model": "claude-sonnet-4-20250514", "messages": [{"role": "user", "content": "Review this code"}]}'

Python SDK Integration

import os
import openai
from prysmai import monitor

client = openai.OpenAI()
monitored = monitor(
    client,
    prysm_key="sk-prysm-...",
    upstream_api_key=os.environ["AI_GATEWAY_TOKEN"],
    forward_headers={
        "X-Gitlab-Instance-Id": os.environ.get("CI_SERVER_HOST", ""),
        "X-Gitlab-Realm": "saas",
    },
)

response = monitored.chat.completions.create(
    model="claude-sonnet-4-20250514",
    messages=[{"role": "user", "content": "Hello"}],
)

GitHub Actions Example

# .github/workflows/ai-tests.yml
name: AI Agent Tests with Prysm Observability

on:
  pull_request:
    branches: [main]

jobs:
  test-langgraph:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-python@v5
        with:
          python-version: "3.12"
      - name: Install dependencies
        run: pip install prysmai[langgraph] pytest -r requirements.txt
      - name: Run LangGraph tests with Prysm
        env:
          PRYSM_API_KEY: ${{ secrets.PRYSM_API_KEY }}
          OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
        run: pytest tests/ -v
HeaderRequiredDescription
X-Prysm-Upstream-KeyOptionalOverrides the stored provider API key for this request
X-Prysm-Forward-HeadersOptionalJSON string of headers to forward to the upstream provider