Text API guide

Use public model IDs for single-turn answers, conversations, streaming, and file understanding. Select a model by supported input types, context length, and protocol. Text output alone does not imply image, audio, or video input support.

Choose an endpoint

Use caseEndpointInput and output
OpenAI-compatible chat and SDKsPOST /v1/chat/completionsmessages; read choices[].message.
Responses applicationsPOST /v1/responsesinput; traverse messages and content in output[].
Anthropic Messages applicationsPOST /v1/messagesmessages, top-level system, required max_tokens; read content[].

Events, tool results, and structured-output fields are not interchangeable. The gateway converts protocols supported by configured mappings; this does not imply every provider supports all advanced features. Responses state and tools depend on the mapping; do not assume automatic server-side conversation storage.

Requests and conversation history

Create an API key and choose an available public model ID in the console. YOUR_MODEL_ID is a placeholder. Keep INONEAPI_API_KEY on your server and use Content-Type: application/json.

The Node.js 20+ example retains the first assistant message before sending a follow-up. Your application stores and trims history to fit the context window. Resent history may be billed as input on every request.

curl  https://api.inoneapi.com/v1/chat/completions \
  -H "Authorization: Bearer $INONEAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "YOUR_MODEL_ID",
    "messages": [
      {"role": "system", "content": "Answer concisely."},
      {"role": "user", "content": "Explain HTTP/2 in one sentence."}
    ],
    "stream": false
  }'

Read responses and streams

Check HTTP status before reading choices[0].message.content. Content can be empty when the assistant returns tool_calls. A length finish reason indicates possible truncation. Inspect usage, but missing usage does not mean a free request.

Streaming uses SSE. cURL -N disables output buffering for inspection:

curl  -N https://api.inoneapi.com/v1/chat/completions \
  -H "Authorization: Bearer $INONEAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"YOUR_MODEL_ID","messages":[{"role":"user","content":"Explain HTTP/2."}],"stream":true}'

Split SSE events on blank lines, join data: lines, then parse JSON. A network chunk is not necessarily a complete event. For Chat, consume choices[].delta.content and stop at [DONE]. Tool arguments may also span deltas. Responses and Messages use different event types and need their own parsers. Disconnecting stops reading but does not guarantee upstream cancellation or a billing rollback.

Files and multimodal input

Upload with the same key, then reference the returned ID. This is a complete Chat body for a model supporting documents. The same reference shape accepts images, audio, and video, expanded by detected type. Unified type: file references are an InOneAPI extension, not a cross-platform file protocol.

{
  "model": "YOUR_MODEL_ID",
  "messages": [
    {
      "role": "user",
      "content": [
        {
          "type": "text",
          "text": "Summarize this document."
        },
        {
          "type": "file",
          "file": {
            "file_id": "file_ioa_0123456789abcdef0123456789abcdef"
          }
        }
      ]
    }
  ]
}

Responses uses {"type":"input_file","file_id":"..."} inside input[].content. Messages uses a block matching the media type and source: {"type":"file","file_id":"..."}. Successful upload does not guarantee PDF or media understanding. A model request accepts at most 32 file references and 64 MiB of original bytes, counting each occurrence; expanded bodies still face request limits.

Upload and reference files

Tools and structured output

For tool use, send tools, inspect assistant tool_calls, validate names and arguments, execute authorized operations on your server, then append the original assistant message and a role: tool result with its tool_call_id before calling again. A proposed call is not an executed action. Bound loop count and elapsed time.

Send response_format only to compatible models. Parse and validate JSON/schema server-side, handling refusals, truncation, and invalid structure. Choose sampling parameters, token limits, and tools according to the model rather than combining every optional field.

Production and errors

For 400, check message structure, parameters, and context limits; for 401/403, check authorization; for 429, inspect rate limits and budgets and honor Retry-After; for 5xx, apply bounded backoff. Before retrying a timeout or interrupted stream, decide whether duplicate generation and charges are acceptable.

Record HTTP status, model ID, latency, and X-Gateway-Trace-ID, excluding keys and sensitive prompts. Store conversation history in your application with user-level access controls. File IDs are not permanent document storage.

Chat Completions · Responses · Anthropic Messages

Text · Documentation · InOneAPI