AgnicPay

A I Gateway

OpenAI-compatible AI endpoints

Chat Completions (OpenAI-compatible)

OpenAI-compatible chat completions endpoint with automatic X402 payments. Just change your base URL and use your AgnicPay token!

POST
/v1/chat/completions

Authorization

X-Agnic-Token<token>

API token from your dashboard

In: header

Authorization
Required
Bearer <token>

OAuth2 access token

In: header

Request Body

application/jsonRequired
model
Required
string

Model identifier (e.g., openai/gpt-4o, anthropic/claude-3.5-sonnet)

messages
Required
array<object>
temperaturenumber
Default: 0.7Minimum: 0Maximum: 2
max_tokensinteger
streamboolean
Default: false
curl -X POST "https://api.agnic.ai/v1/chat/completions" \
  -H "X-Agnic-Token: <token>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-4o",
    "messages": [
      {
        "role": "user",
        "content": "Hello!"
      }
    ]
  }'

Chat completion response

{
  "id": "string",
  "object": "chat.completion",
  "created": 0,
  "model": "string",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "string",
        "content": "string"
      },
      "finish_reason": "string"
    }
  ],
  "usage": {
    "prompt_tokens": 0,
    "completion_tokens": 0,
    "total_tokens": 0
  }
}

List Available Models

List all available AI models through the gateway.

GET
/v1/models

Authorization

X-Agnic-Token<token>

API token from your dashboard

In: header

Authorization
Required
Bearer <token>

OAuth2 access token

In: header

curl -X GET "https://api.agnic.ai/v1/models" \
  -H "X-Agnic-Token: <token>"

Models listed successfully

{
  "object": "list",
  "data": [
    {
      "id": "string",
      "object": "model",
      "created": 0,
      "owned_by": "string"
    }
  ]
}