DOCUMENTATION / V1

One endpoint.
Familiar semantics.

Use the OpenAI SDK or plain HTTP. Change the base URL, choose a Surf model, and start streaming.

Create an API key
Abstract routing field converging into a single output path
01 / OVERVIEW

OpenAI-compatible by design

Surf exposes a focused subset of the OpenAI API. Existing server-side clients can connect by changing baseURL and using a Surf API key. Requests enter one endpoint while routing stays internal to the network.

BASE URLhttps://route.futurixai.com/v1
PROTOCOLHTTPS + SSE
API VERSIONv1
02 / QUICKSTART

Make your first request

  1. 01

    Create a key

    Sign in, open API keys, and copy the new key when it is shown. Store it in a server-side secret manager.

  2. 02

    Export it locally

    TERMINAL
    export SURF_API_KEY="surf_your_key"
  3. 03

    Send a chat completion

    JAVASCRIPT
    import OpenAI from "openai";
    
    const surf = new OpenAI({
      apiKey: process.env.SURF_API_KEY,
      baseURL: "https://route.futurixai.com/v1",
    });
    
    const response = await surf.chat.completions.create({
      model: "kimi-k2.6",
      messages: [{ role: "user", content: "Explain distributed inference." }],
    });
    
    console.log(response.choices[0].message.content);
03 / AUTHENTICATION

Bearer keys, kept server-side

Send your key in the Authorization header. Keys are revealed once and stored as hashes. Never expose them in browser code, mobile bundles, or public repositories.

HTTP HEADER
Authorization: Bearer $SURF_API_KEY
04 / CHAT COMPLETIONS

Create a completion

POST/chat/completions
CURL
curl https://route.futurixai.com/v1/chat/completions \
  -H "Authorization: Bearer $SURF_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "kimi-k2.6",
    "messages": [{"role":"user","content":"Hello from Surf"}],
    "max_completion_tokens": 4096
  }'
modelstring · required

A public model alias from the catalog.

messagesarray · required

Conversation messages using system, user, assistant, and tool roles.

streamboolean

Return server-sent events as tokens become available.

max_completion_tokensinteger

Defaults to 4,096 and is capped at 32,768.

tools / tool_choicearray / string

Function definitions and tool-selection behavior.

response_formatobject

Request JSON mode or a structured JSON schema.

05 / STREAMING

Read output as it arrives

Set stream: true to receive OpenAI-compatible server-sent events. Keep the connection open until the terminal event. Usage is settled after the stream completes or disconnects.

JAVASCRIPT
const stream = await surf.chat.completions.create({
  model: "glm-5.2",
  messages: [{ role: "user", content: "Return a short status update." }],
  stream: true,
});

for await (const chunk of stream) {
  process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
}
06 / TOOL CALLING

Let models request your functions

Define tools with JSON Schema. Surf returns tool calls through the standard assistant message shape; your application executes them and sends the result back as a tool message.

REQUEST BODY
{
  "model": "kimi-k2.7-code",
  "messages": [{"role":"user","content":"Check the build status."}],
  "tools": [{
    "type": "function",
    "function": {
      "name": "get_build_status",
      "description": "Return the current build state",
      "parameters": {
        "type": "object",
        "properties": {"build_id":{"type":"string"}},
        "required": ["build_id"]
      }
    }
  }]
}
07 / STRUCTURED OUTPUT

Constrain the response shape

Models marked with structured-output support accept response_format. Validate returned JSON in your application even when a schema is supplied.

REQUEST FIELD
"response_format": {
  "type": "json_schema",
  "json_schema": {
    "name": "deployment_check",
    "strict": true,
    "schema": {
      "type": "object",
      "properties": {"ready":{"type":"boolean"}},
      "required": ["ready"],
      "additionalProperties": false
    }
  }
}
08 / MODELS

Discover available aliases

Use the catalog for human-readable capabilities or query the authenticated model endpoint at runtime.

GET/models
CURL
curl https://route.futurixai.com/v1/models \
  -H "Authorization: Bearer $SURF_API_KEY"
09 / ERRORS

Errors use the OpenAI object shape

Inspect the HTTP status and error code. Successful inference responses include x-request-id; log it with your own trace so a request can be located without exposing provider routing identifiers.

400invalid_request
401invalid_api_key
402insufficient_quota
404model_not_found
502provider_error
503service_unavailable
ERROR OBJECT
{
  "error": {
    "message": "The model 'unknown' does not exist.",
    "type": "invalid_request_error",
    "param": null,
    "code": "model_not_found"
  }
}
10 / LIMITS AND USAGE

Metered against actual tokens

Surf reserves enough credit for the request, then settles against terminal usage. The default output cap is 4,096 tokens and the platform maximum is 32,768. Model context limits are listed in the model catalog; pricing is published per million tokens.

View pricing