Integration guide

GCP Cloud Functions OpenAI-compatible API guide (Python)

GCP Cloud Functions Python guide for OpenAI-compatible APIs: set the base URL to https://api.abliteration.ai/v1, call /v1/chat/completions, and keep the same request schema.

Updated 2026-08-04

GCP Cloud Functions works with OpenAI-compatible APIs by switching the base URL, API key, and model id.

This guide shows a Python example plus a test vector you can run to validate responses.

import os
import requests

payload = {
    "model": "abliterated-model",
    "messages": [{"role": "user", "content": "Respond with: GCP Cloud Functions Python ready."}],
    "temperature": 0.2,
}

resp = requests.post(
    "https://api.abliteration.ai/v1/chat/completions",
    headers={
        "Authorization": f"Bearer {os.getenv('ABLIT_KEY')}",
        "Content-Type": "application/json",
    },
    json=payload,
)

resp.raise_for_status()
print(resp.json()["choices"][0]["message"]["content"])

Configure GCP Cloud Functions

Follow this checklist to point your integration at the OpenAI-compatible endpoint.

OpenAI-compatible payload

Use this request body as a known-good payload before customizing parameters.

{
  "model": "abliterated-model",
  "messages": [
    { "role": "user", "content": "Respond with: GCP Cloud Functions Python ready." }
  ],
  "temperature": 0.2
}

Streaming and tool calling readiness

If you stream responses or send tool definitions, keep the OpenAI-compatible schema and validate against the OpenAPI spec.

FAQ

Frequently asked questions.

How do I fix a 401 Unauthorized error from abliteration.ai?

Check that your API key is set and sent as a Bearer token.

How do I fix a 404 Not Found error from abliteration.ai?

Make sure the base URL ends with /v1 and you call /chat/completions.

How do I fix a 400 Bad Request error from abliteration.ai?

Verify the model id and that messages are an array of { role, content } objects.

How do I fix a 429 Rate limit error from abliteration.ai?

Back off and retry. Use the Retry-After header for pacing.