Back to Home

API Reference

Integrate OneFirewall's secure AI gateway directly into your applications using our OpenAI-compatible API endpoints.

All Endpoints

GET
/api/v1/models

List all available workspaces as models

GET
/api/v1/models/{workspace-name}

Retrieve a specific workspace/model

POST
/api/v1/chat/completions

Create a chat completion (OpenAI-compatible)

Authentication

All API requests must include your API key in the Authorization HTTP header as a Bearer token.

Authorization: Bearer YOUR_API_KEY

You can generate API keys from the profile section of the dashboard. Keep your keys secure and never share them publicly.

Models (Workspaces)

In OneFirewall, models = workspaces. Each workspace you belong to appears as a callable model. This allows you to route calls through different workspace configurations transparently using the standard OpenAI model field.

GET/api/v1/models

Returns all workspaces you have access to, in OpenAI model list format.

Example Request

curl https://onefirewall.ai/api/v1/models \
  -H "Authorization: Bearer $ONEFIREWALL_API_KEY"

Example Response

{
  "object": "list",
  "data": [
    {
      "id": "my-team",
      "object": "model",
      "created": 1715000000,
      "owned_by": "organization",
      "root": "my-team",
      "parent": null,
      "permission": []
    },
    {
      "id": "security-workspace",
      "object": "model",
      "created": 1715001000,
      "owned_by": "organization",
      "root": "security-workspace",
      "parent": null,
      "permission": []
    }
  ]
}
GET/api/v1/models/{workspace-name}

Returns details for a specific workspace/model by name.

Example Request

curl https://onefirewall.ai/api/v1/models/my-team \
  -H "Authorization: Bearer $ONEFIREWALL_API_KEY"

Example Response

{
  "id": "my-team",
  "object": "model",
  "created": 1715000000,
  "owned_by": "organization",
  "root": "my-team",
  "parent": null,
  "permission": []
}

Chat Completions

Standard OpenAI-compatible chat completions endpoint. Set model to your workspace name.

POST/api/v1/chat/completions

Example Request

curl https://onefirewall.ai/api/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $ONEFIREWALL_API_KEY" \
  -d '{
    "model": "my-team",
    "messages": [
      {
        "role": "system",
        "content": "You are a helpful assistant."
      },
      {
        "role": "user",
        "content": "Hello!"
      }
    ],
    "stream": true
  }'

💡 Tip: Use pii parameter for privacy control

Add "pii": "obfuscate" or "pii": "block" to enable PII detection. Default is "disabled".

SDK Integration

Drop-in compatible with the OpenAI SDK. Just set our base URL and use your workspace name as the model.

Python

from openai import OpenAI

client = OpenAI(
  base_url="https://onefirewall.ai/api/v1",
  api_key="your-onefirewall-key"
)

response = client.chat.completions.create(
  model="my-team",  # Your workspace name
  messages=[
    {"role": "user", "content": "Hi"}
  ]
)

Node.js (TypeScript)

import OpenAI from 'openai';

const openai = new OpenAI({
  baseURL: 'https://onefirewall.ai/api/v1',
  apiKey: 'your-onefirewall-key'
});

const response = await openai.chat.completions.create({
  model: 'my-team', // Your workspace name
  messages: [{ role: 'user', content: 'Hi' }]
});