1. 7API
  2. Docs
  3. OpenAI-compatible API

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.

text
Base URL:  https://7api.st/v1
Header:    Authorization: Bearer sk-your-key

Chat Completions

POST /v1/chat/completions (also accepted at /chat/completions)

bash
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:

json
{
  "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

ParameterNotes
modelRequired. 1–128 characters. See Model IDs.
messagesRequired. Text and, on vision models, image_url parts
stream, stream_optionsSee Streaming. Usage is always reported in the final chunk.
max_tokens / max_completion_tokensDefault 16,384 if omitted, maximum 131,072. If you send both, they must be equal.
temperature, top_p, stopPassed to the model
tools, tool_choice, parallel_tool_callsFunction calling on every model
response_formatJSON mode and JSON schema, except kimi-k3.1-pro
reasoning_effortSee Reasoning effort
n1–4

Tool calling

python
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) and instructions
  • tools
  • reasoning.effort and max_output_tokens
  • stream

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.

bash
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

EndpointPurpose
GET /v1/modelsModel catalog with limits and prices
GET /v1/balance, GET /v1/usage, GET /v1/statusAccount endpoints
GET /v1/dashboard/billing/credit_grants, …/subscriptionOpenAI-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 n greater than 1 are billed for every completion, as at OpenAI.
  • Organization and project headers are ignored.
  • The response id is generated by 7API. Store your own identifiers if you need to correlate requests.