Skip to content
Developer API

Chat Completions: the OpenAI-compatible API

The /v1/chat/completions endpoint: parameters, streaming, and ready examples in cURL, Python, JavaScript, and for opencode.

2 min readUpdated 2026-08-11

The POST /v1/chat/completions endpoint mirrors the OpenAI interface: the same request fields, the same response shape, streaming included. If your tool works with OpenAI, it works with AgentHere — just change the base URL and key.

Base URL and auth

  • Base URL: https://agenthere.ru/v1 (use agenthere.ruagenthere.online redirects to it).
  • Header: Authorization: Bearer ah_YOUR_KEY.
  • Create the key in the developer dashboard with type proxy.

Minimal request

bash
curl https://agenthere.ru/v1/chat/completions \
  -H "Authorization: Bearer ah_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v4-pro",
    "messages": [
      {"role": "system", "content": "You are a concise assistant."},
      {"role": "user", "content": "Explain tokens simply."}
    ]
  }'

Python (openai SDK)

python
from openai import OpenAI

client = OpenAI(
    base_url="https://agenthere.ru/v1",
    api_key="ah_YOUR_KEY",
)

response = client.chat.completions.create(
    model="deepseek-v4-pro",
    messages=[{"role": "user", "content": "Hi!"}],
)

print(response.choices[0].message.content)

JavaScript (fetch)

javascript
const res = await fetch("https://agenthere.ru/v1/chat/completions", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.AGENTHERE_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    model: "deepseek-v4-pro",
    messages: [{ role: "user", content: "Hi!" }],
  }),
});
const data = await res.json();
console.log(data.choices[0].message.content);

Streaming

Pass "stream": true — the reply arrives as a stream of Server-Sent Events chunks, like OpenAI. Great for UIs with typing text.

Using your own agent

To talk over the API not to a bare model but to your agent (with its system prompt and skills), use the agent identifier in the relevant client parameter, or supply the system prompt directly in messages. Concrete model names are available via /api/developer/info.

Token metering

Every request is billed on actual token usage (prompt + completion). Spend is visible in Usage and debited from your balance. With a zero balance the request errors — top up in Billing & tokens.

Limits

  • 60 requests per minute per key;
  • no daily token cap — spend is limited by the account balance.

For tools and automation, the MCP server is also available.

Chat Completions: the OpenAI-compatible API | AgentHere