1. SDK'yı Yükle

GlomaxGPT provides official SDKs for Python and Node.js. Choose your preferred language to get started.

bash
# Requires Python 3.8+
pip install GlomaxGPT

# Verify installation
python -c "import GlomaxGPT; print(GlomaxGPT.__version__)"
bash
# Requires Node.js 18+
npm install GlomaxGPT

# Or with yarn
yarn add GlomaxGPT

# Or with pnpm
pnpm add GlomaxGPT
bash
# No installation needed — use cURL directly
curl https://api.glomaxgpt.com/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $GlomaxGPT_API_KEY" \
  -d '{
    "model": "glomaxgpt-pro",
    "input": "Hello, world!"
  }'

2. API Anahtarını Al

All API requests require authentication using an API key. You can generate and manage your keys in the GlomaxGPT dashboard.

1

Create an account

Sign up at platform.glomaxgpt.com if you haven't already. You'll need a verified email address.

2

Navigate to API Keys

Go to Settings → API Keys in the dashboard. Click Create new secret key.

3

Store your key securely

Copy the key immediately — it won't be shown again. Store it as an environment variable, never hardcode it in source files.

4

Set the environment variable

bash
# Linux / macOS
export GlomaxGPT_API_KEY="sk-proj-..."

# Windows PowerShell
$env:GlomaxGPT_API_KEY = "sk-proj-..."

# Add to ~/.bashrc or ~/.zshrc for persistence
echo 'export GlomaxGPT_API_KEY="sk-proj-..."' >> ~/.bashrc
Security Warning: Never commit API keys to version control. Use .env files with python-dotenv or a secrets manager in production. Rotate keys immediately if they are exposed.

3. Your First API Call

The Responses API is the newest and most powerful way to interact with GlomaxGPT models. It supports multi-turn conversations, built-in tools, and structured outputs.

python
from GlomaxGPT import GlomaxGPT

client = GlomaxGPT()  # Uses GlomaxGPT_API_KEY env var automatically

response = client.responses.create(
    model="glomaxgpt-pro",
    input="Write a haiku about recursion in programming."
)

print(response.output_text)
javascript
import GlomaxGPT from "GlomaxGPT";

const client = new GlomaxGPT();

const response = await client.responses.create({
  model: "glomaxgpt-pro",
  input: "Write a haiku about recursion in programming.",
});

console.log(response.output_text);
Note: The Responses API replaces the older Chat Completions API for most use cases. It provides a simpler interface with built-in support for tools, file attachments, and conversation history. The output_text property gives you the text output directly without navigating nested response objects.

4. Multi-turn Conversations

The Responses API makes it easy to maintain conversation context. You can pass previous response IDs or explicitly include message history.

python
from GlomaxGPT import GlomaxGPT

client = GlomaxGPT()

# First turn
response = client.responses.create(
    model="glomaxgpt-pro",
    input="What is the capital of France?"
)
print(response.output_text)  # Paris

# Second turn — reference previous response
follow_up = client.responses.create(
    model="glomaxgpt-pro",
    previous_response_id=response.id,
    input="What is its population?"
)
print(follow_up.output_text)  # ~2.1 million (city proper)

# Alternatively, pass explicit message history
response2 = client.responses.create(
    model="glomaxgpt-pro",
    input=[
        {"role": "user", "content": "What is the capital of France?"},
        {"role": "assistant", "content": "The capital of France is Paris."},
        {"role": "user", "content": "What is its population?"}
    ]
)
print(response2.output_text)
javascript
import GlomaxGPT from "GlomaxGPT";

const client = new GlomaxGPT();

// First turn
const response = await client.responses.create({
  model: "glomaxgpt-pro",
  input: "What is the capital of France?",
});
console.log(response.output_text);

// Second turn — reference previous response
const followUp = await client.responses.create({
  model: "glomaxgpt-pro",
  previous_response_id: response.id,
  input: "What is its population?",
});
console.log(followUp.output_text);

5. Add Web Search

Give your model access to real-time web search with a single parameter. The model will automatically decide when to search.

6. Image Input

GlomaxGPT Pro and other vision-capable models can analyze images. Pass image URLs or base64-encoded images directly.

python
from GlomaxGPT import GlomaxGPT

client = GlomaxGPT()

# Using an image URL
response = client.responses.create(
    model="glomaxgpt-pro",
    input=[
        {
            "role": "user",
            "content": [
                {
                    "type": "input_image",
                    "image_url": "https://upload.wikimedia.org/wikipedia/commons/thumb/4/47/PNG_transparency_demonstration_1.png/280px-PNG_transparency_demonstration_1.png"
                },
                {
                    "type": "input_text",
                    "text": "What do you see in this image? Describe it in detail."
                }
            ]
        }
    ]
)

print(response.output_text)
javascript
import GlomaxGPT from "GlomaxGPT";

const client = new GlomaxGPT();

const response = await client.responses.create({
  model: "glomaxgpt-pro",
  input: [
    {
      role: "user",
      content: [
        {
          type: "input_image",
          image_url: "https://example.com/image.png",
        },
        {
          type: "input_text",
          text: "What do you see in this image?",
        },
      ],
    },
  ],
});

console.log(response.output_text);

7. Streaming Responses

For a better user experience, stream the model's response token by token instead of waiting for the full output.

python
from GlomaxGPT import GlomaxGPT

client = GlomaxGPT()

# Stream using context manager
with client.responses.stream(
    model="glomaxgpt-pro",
    input="Write a short story about a robot learning to paint."
) as stream:
    for text in stream.text_deltas:
        print(text, end="", flush=True)

# Or use the raw stream iterator
stream = client.responses.create(
    model="glomaxgpt-pro",
    input="Explain quantum entanglement simply.",
    stream=True
)

for event in stream:
    if event.type == "response.text.delta":
        print(event.delta, end="", flush=True)
javascript
import GlomaxGPT from "GlomaxGPT";

const client = new GlomaxGPT();

// Stream using the helper
const stream = await client.responses.stream({
  model: "glomaxgpt-pro",
  input: "Write a short story about a robot learning to paint.",
});

for await (const chunk of stream) {
  if (chunk.type === "response.text.delta") {
    process.stdout.write(chunk.delta);
  }
}

// Get the final response after streaming
const finalResponse = await stream.finalResponse();
console.log("\nTotal tokens:", finalResponse.usage.total_tokens);

Sonraki Adımlar

You're ready to build. Explore these guides to go deeper into specific capabilities.