Explore AI APIs for text, search, images and audio. Compare real gateway limits, understand usage pricing and take an integration example straight into your project.
Use the public model ID on the model page. Your key stays in a server-side environment variable.
PYTHON / OPENAI SDK
import os
from openai import OpenAI
from uuid import uuid4
client = OpenAI(
api_key=os.environ["SERVERNET_API_KEY"],
base_url="https://servernet.cloud/v1",
max_retries=0,
)
response = client.chat.completions.create(
model="or-meta-llamallama-4-scout-125f5697d6",
messages=[{"role": "user", "content": "Hello"}],
max_tokens=128,
extra_headers={"Idempotency-Key": str(uuid4())},
)
print(response.choices[0].message.content)
Use the same Idempotency-Key when retrying an identical request. Successful responses are replayed without a second charge for 24 hours. Do not automatically retry when x-should-retry:false is present. The key is shown once. Store it in a server environment variable. Keep it out of browser code, GitHub and logs.
This example incurs real usage. Keep the key in an environment variable. Create the request identifier once per logical request and keep it when retrying that same request.
AI API, hourly GPU or n8n: which fits your project?
Start with the result you need: a response from a hosted model, your own code and model on a GPU, or a workflow connecting several services. Each choice has different running costs and maintenance responsibilities.
A hosted model API for your application
For chat, summarization or semantic search, choose a ready model for that operation. Check its pricing unit, input limits and usage calculator. An available model does not necessarily support every operation.
For PyTorch, custom model weights or GPU data processing, review the compatible GPU application. Choose suitable VRAM, keep files outside temporary storage and plan how to run and resume your workload.
n8n can connect forms, CRM and an AI service into a workflow. Hosting and external API usage are separate costs. Store service keys in credentials rather than sharing them in a workflow export.
Before funding, check the operation and available model; the key needs permission for that operation.
Keep the first request short with a small output cap. Review its request identifier and actual charge in usage history.
Create one new Idempotency-Key per logical request. A retry of the same request must keep the same key and body.
Frequently asked questions
How is usage billed?
Billing uses reported model consumption and the prices frozen for your request. When a response becomes uncertain after sending, consumption is reconciled according to the request state.
Can I use every listed model?
Each model shows its availability. Only available models can be purchased through the API. Preparing and discontinued models remain visible for catalogue reference.
How can I limit team spending?
Set a monthly project budget and a daily API key limit. Holds for concurrent requests count towards these limits.
Choose with evidence. Build with a clear contract.
Compare the operation, read its example and start with a bounded test.