Skip to main content
This guide helps you send your first AGICTO API request. You will set the API Key, use the correct Base URL, and verify a Chat completions response.

Prerequisites

  • You have an AGICTO API Key
  • Your account has available balance or quota
  • Your environment can reach https://api.agicto.cn

1. Set your API Key

Send your API Key in the Authorization header.
Authorization: Bearer $API_KEY
Do not expose your API Key in client-side code, public repositories, or logs.

2. Use the Base URL

https://api.agicto.cn
OpenAI-compatible endpoints usually use the /v1 path:
https://api.agicto.cn/v1/chat/completions

3. Send a Chat request

Replace $API_KEY with your API Key. Replace model with a model available to your account.
curl https://api.agicto.cn/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $API_KEY" \
  -d '{
    "model": "gpt-4o",
    "messages": [
      {
        "role": "user",
        "content": "Say hello in one sentence."
      }
    ]
  }'

4. Use the OpenAI SDK

import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.AGICTO_API_KEY,
  baseURL: "https://api.agicto.cn/v1"
});

const completion = await client.chat.completions.create({
  model: "gpt-4o",
  messages: [{ role: "user", content: "Say hello in one sentence." }]
});

console.log(completion.choices[0].message.content);

Next steps

OpenAI compatibility

Learn how to migrate existing OpenAI SDK code.

API reference

Browse endpoint details synced from Apifox.