OpenAI-compatible API
7API implements the OpenAI Chat Completions and Responses APIs. Point any OpenAI SDK or OpenAI-compatible tool at the base URL below, keep your request code as it is, and choose a model from the catalog. You don't need an OpenAI account.
Base URL: https://7api.st/v1
Header: Authorization: Bearer sk-your-keyChat Completions
POST /v1/chat/completions (also accepted at /chat/completions)
curl https://7api.st/v1/chat/completions \
-H "Authorization: Bearer $SEVENAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-v4.1-flash",
"messages": [
{"role": "system", "content": "You are terse."},
{"role": "user", "content": "Name three sorting algorithms."}
],
"max_tokens": 200
}'The response follows OpenAI's shape:
{
"id": "chatcmpl-…",
"object": "chat.completion",
"model": "deepseek-v4.1-flash",
"choices": [{ "index": 0, "message": { "role": "assistant", "content": "Quicksort, mergesort, heapsort." }, "finish_reason": "stop" }],
"usage": { "prompt_tokens": 24, "completion_tokens": 9, "total_tokens": 33,
"prompt_tokens_details": { "cached_tokens": 0 } }
}Supported parameters
| Parameter | Notes |
|---|---|
model | Required. 1–128 characters. See Model IDs. |
messages | Required. Text and, on vision models, image_url parts |
stream, stream_options | See Streaming. Usage is always reported in the final chunk. |
max_tokens / max_completion_tokens | Default 16,384 if omitted, maximum 131,072. If you send both, they must be equal. |
temperature, top_p, stop | Passed to the model |
tools, tool_choice, parallel_tool_calls | Function calling on every model |
response_format | JSON mode and JSON schema, except kimi-k3.1-pro |
reasoning_effort | See Reasoning effort |
n | 1–4 |
Tool calling
from openai import OpenAI
client = OpenAI(base_url="https://7api.st/v1", api_key="sk-your-key")
tools = [{
"type": "function",
"function": {
"name": "get_weather",
"description": "Current weather for a city",
"parameters": {"type": "object", "properties": {"city": {"type": "string"}}, "required": ["city"]},
},
}]
r = client.chat.completions.create(model="kimi-k3", messages=[{"role": "user", "content": "Weather in Oslo?"}], tools=tools)
print(r.choices[0].message.tool_calls)Images
Models listed with Text and images input on their model page accept image_url content parts (URLs or base64 data URLs). On the text-only GLM and DeepSeek models, each image is replaced by a short text placeholder instead of an error. That way, an image left earlier in a conversation doesn't break the later turns.
Responses API
POST /v1/responses (also accepted at /responses)
Codex CLI, recent OpenAI SDKs and agent frameworks use the Responses API. It accepts:
input(a string or an item list) andinstructionstoolsreasoning.effortandmax_output_tokensstream
To continue a conversation, resend the full history in input. This works on every model. previous_response_id also works on GPT models, which run natively on Responses. It only accepts IDs returned to your own account for the same model.
curl https://7api.st/v1/responses \
-H "Authorization: Bearer $SEVENAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "gpt-6.1-sol", "input": "One sentence on why caching cuts LLM cost.", "reasoning": {"effort": "low"}}'The Responses API works for every model, not only GPT. Non-GPT models are translated to and from Chat Completions by the gateway.
Other endpoints
| Endpoint | Purpose |
|---|---|
GET /v1/models | Model catalog with limits and prices |
GET /v1/balance, GET /v1/usage, GET /v1/status | Account endpoints |
GET /v1/dashboard/billing/credit_grants, …/subscription | OpenAI-style billing endpoints, for balance widgets in existing tools |
Embeddings, image generation, audio and fine-tuning endpoints are not available. Unsupported paths return 404 not_found_error.
Differences from OpenAI's API
- Requests with
ngreater than 1 are billed for every completion, as at OpenAI. - Organization and project headers are ignored.
- The response
idis generated by 7API. Store your own identifiers if you need to correlate requests.
