Quick Start

Get up and running with the HacxGPT API in minutes. Compatible with OpenAI and Anthropic SDKs.

OpenAI Compatible
Drop-in replacement for the OpenAI API.
https://api.hacxgpt.com/v1
Anthropic Compatible
Drop-in replacement for the Anthropic API.
https://api.hacxgpt.com/anthropic

Make your first request

OpenAI SDK

from openai import OpenAI

client = OpenAI(
    api_key="hk-proj-YOUR_API_KEY",
    base_url="https://api.hacxgpt.com/v1"
)

response = client.chat.completions.create(
    model="hacxgpt",
    messages=[
        {"role": "user", "content": "Hello!"}
    ]
)

print(response.choices[0].message.content)

Anthropic SDK

from anthropic import Anthropic

client = Anthropic(
    api_key="hk-proj-YOUR_API_KEY",
    base_url="https://api.hacxgpt.com/anthropic"
)

message = client.messages.create(
    model="hacxgpt",
    max_tokens=1024,
    messages=[
        {"role": "user", "content": "Hello!"}
    ]
)

print(message.content[0].text)
Tip
Replace hk-proj-YOUR_API_KEY with your actual API key from the HacxGPT dashboard. The model name hacxgpt can be replaced with any model available on your plan.

What's next?