🚀 Start Building

Quick Start

Get up and running with the HacxGPT API in minutes. We provide drop-in compatibility with the official OpenAI and Anthropic SDKs.

OpenAI Compatible
Perfect drop-in replacement.
https://api.hacxgpt.com/v1
Anthropic Compatible
Full support for Claude APIs.
https://api.hacxgpt.com/anthropic
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 custom model you have access to.

1OpenAI Implementation

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)

2Anthropic Implementation

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)