Create an OpenAI-compatible chat completion

OpenAI-compatible chat completion. Without a PAYMENT-SIGNATURE header the gateway returns HTTP 402 with an x402 challenge: a legacy snake_case JSON body plus a canonical x402 v2 challenge (camelCase) in the PAYMENT-REQUIRED response header, both quoting the USDC cost on Solana mainnet. Sign the quoted exact (or escrow) payment with your wallet and resubmit the same request with the signed payment payload in the PAYMENT-SIGNATURE header to receive the completion.

post/v1/chat/completions

Request

  • Base URL: https://api.solvela.ai
  • URL: https://api.solvela.ai/v1/chat/completions
  • Auth: one of:
    • none
    • API key in header PAYMENT-SIGNATURE

Request body

modelstring required

Model ID (e.g. openai/gpt-4o), alias (e.g. sonnet), or routing profile (auto, eco, premium, free). Call GET /v1/models for available IDs.

max_tokensinteger

Max output tokens; clamped to the model limit.

temperaturenumber
top_pnumber
streamboolean

Stream the response as Server-Sent Events.

toolsobject[]

OpenAI-style tool/function definitions.

tool_choiceunknown

Example request

{
  "model": "auto",
  "messages": [
    {
      "tool_calls": [
        {
          "type": "function"
        }
      ]
    }
  ]
}

Response

Chat completion (or an SSE stream when stream is true).

idstring required
objectstring required
createdinteger required
modelstring required

Example response

{
  "object": "chat.completion",
  "choices": [
    {
      "message": {
        "tool_calls": [
          {
            "type": "function"
          }
        ]
      }
    }
  ]
}

Changes

No recorded changes to this operation across all 1 revision of this API.