Skip to main content

๐Ÿš€ Quick Start

1. Get Your API Key

  1. Go to Profile page in the app.
  2. Click โ€œCreate API Keyโ€.
  3. Give it a name (e.g., โ€œAutomation Scriptโ€).
  4. Copy the key immediately (you wonโ€™t see it again!).

2. Make Your First Request

The endpoint is OpenAI-compatible, meaning you can use standard LLM libraries or simple curl commands.
curl https://onefirewall.ai/api/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY_HERE" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-4o",
    "messages": [
      {"role": "user", "content": "What is the capital of France?"}
    ]
  }'

๐Ÿ“‹ API Reference

Endpoint: POST /api/v1/chat/completions

ParameterTypeDefaultDescription
modelstringREQIdentifier (e.g., openai/gpt-4o, grok/grok-beta)
messagesarrayREQChat history (OpenAI format)
systemstringDefault PersonaCustom system prompt. If provided, it overrides all default behavior.
streambooleanfalseEnable/disable real-time streaming.
web_searchbooleantrue*Enables tools. Defaults to true unless a custom system prompt is used.
piistringdisabledSecurity mode: disabled, obfuscate, or block.
temperaturenumber0.7Controls randomness (0.0 to 2.0).

๐Ÿ Python Implementation Examples

Standard (Non-Streaming)

import requests

API_KEY = "your_key_here"
URL = "https://onefirewall.ai/api/v1/chat/completions"

headers = {
    "Authorization": f"Bearer {API_KEY}",
    "Content-Type": "application/json"
}

data = {
    "model": "openai/gpt-4o",
    "web_search": True,
    "pii": "obfuscate",
    "messages": [
        {"role": "user", "content": "Who won the Super Bowl recently?"}
    ]
}

response = requests.post(URL, headers=headers, json=data)
print(response.json()["choices"][0]["message"]["content"])

Advanced Streaming

Recommended for a better user experience in CLI or UI applications.
import requests
import sys

API_KEY = "your_key_here"
URL = "https://onefirewall.ai/api/v1/chat/completions"

data = {
    "model": "openai/gpt-4o",
    "stream": True,
    "messages": [{"role": "user", "content": "Write a long essay on AI ethics"}]
}

# Request with stream=True
headers = {"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"}
response = requests.post(URL, headers=headers, json=data, stream=True)

# Flush output to console in real-time
sys.stdout.reconfigure(encoding='utf-8')
for chunk in response.iter_content(chunk_size=None):
    if chunk:
        print(chunk.decode('utf-8'), end="", flush=True)

JavaScript/Node.js Example

const API_KEY = "sk-YOUR-KEY-HERE";
const URL = "https://onefirewall.ai/api/v1/chat/completions";

const response = await fetch(URL, {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${API_KEY}`,
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    model: "openai/gpt-4o",
    messages: [
      { role: "user", content: "Hello!" }
    ]
  })
});

const data = await response.json();
console.log(data.choices[0].message.content);

Tips

  1. Save Your API Key: You only see it once during creation
  2. Use HTTPS in Production: All examples use https://onefirewall.ai for secure access.
  3. Monitor Usage: Check your API key stats in the Profile page
  4. Choose Security Level: Set pii based on your needs:
    • Development: "disabled" (default)
    • Production: "obfuscate" (recommended)
    • High security: "block"
  5. Model Selection: Use the same models available in the chat UI
  6. Custom Prompts: When you provide a system prompt, itโ€™s used exclusively (no mixing with app prompts)
  7. API Independence: The API works independently of team UI settings by design

Support

  • View your API keys: Go to Profile page
  • Delete a key: Click the trash icon next to the key
  • Track usage: See request count and last used date in the key list
Enjoy building on top of the secure-ai-gateway! ๐Ÿš€