API Reference
The gateway speaks the OpenAI API format. If your code works with OpenAI, it works with Gujiata AI by changing the base URL and key.
Base URL & authentication
Base URL: https://gujiata.com/v1
Headers:
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json
Create API keys from the console. Keys are shown once at creation — store them securely. Requests are billed to the wallet of the key owner.
Chat completions
POST /v1/chat/completions — create a model response for a conversation.
curl https://gujiata.com/v1/chat/completions \
-H "Authorization: Bearer sk-gujiata-xxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4.1",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Explain quantum tunneling in one sentence."}
],
"temperature": 0.7
}'
Python
from openai import OpenAI
client = OpenAI(
api_key="sk-gujiata-xxxxxxxx",
base_url="https://gujiata.com/v1",
)
resp = client.chat.completions.create(
model="claude-sonnet-4",
messages=[{"role": "user", "content": "Hello!"}],
)
print(resp.choices[0].message.content)
Node.js
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "sk-gujiata-xxxxxxxx",
baseURL: "https://gujiata.com/v1",
});
const resp = await client.chat.completions.create({
model: "gemini-2.5-flash",
messages: [{ role: "user", content: "Hello!" }],
});
console.log(resp.choices[0].message.content);
Request fields
| Field | Type | Required | Notes |
|---|---|---|---|
model | string | yes | Any model ID from the catalog. |
messages | array | yes | Standard OpenAI message array. |
stream | boolean | no | Enables SSE streaming (see below). |
temperature, max_tokens, top_p, tools… | — | no | Forwarded to the upstream provider unchanged. |
List models
GET /v1/models — returns the models currently enabled on the gateway.
curl https://gujiata.com/v1/models \
-H "Authorization: Bearer sk-gujiata-xxxxxxxx"
Streaming
Set "stream": true to receive server-sent events. Chunks are proxied byte-for-byte from the upstream provider, so your existing OpenAI streaming code works unchanged.
curl https://gujiata.com/v1/chat/completions \
-H "Authorization: Bearer sk-gujiata-xxxxxxxx" \
-d '{
"model": "deepseek-chat",
"messages": [{"role":"user","content":"Count to five."}],
"stream": true
}'
Errors
| HTTP | type | Meaning |
|---|---|---|
| 401 | authentication_error | Missing or invalid API key. |
| 402 | billing_error | Insufficient wallet balance — please recharge. |
| 400 | invalid_request_error | Malformed request or unknown model. |
| 503 | server_error | No upstream channel is currently serving the requested model. |
{
"error": {
"message": "Insufficient balance. Please recharge your wallet.",
"type": "billing_error"
}
}
Recharging your wallet
- Open the wallet and submit a recharge request with the amount you plan to send.
- Our support team emails you the bank account details at your registered address.
- Complete the transfer, keep the receipt, and reply to the email.
- Your balance is credited as soon as the transfer is confirmed — you can watch it land in your console.
Questions? Use the contact form, leave your email and we will get back to you.