Skip to content
NEW GPT-5.5 / Claude 4.6 已上线,立即体验 →
API 参考

API 参考

Base URL https://api.onefast.ai/v1

Chat Completions

OpenAI-compatible conversation completions for text and reasoning models.

POST /v1/chat/completions Bearer

Generate a chat completion for any supported model.

参数

参数 类型 必填 说明
model string Model ID from the model catalog
messages array Conversation messages, OpenAI format
max_tokens integer Maximum output tokens
temperature number Sampling temperature 0-2
stream boolean Stream the response incrementally

示例

curl https://api.onefast.ai/v1/chat/completions 
  -H "Content-Type: application/json" 
  -H "Authorization: Bearer sk-your-api-key" 
  -d '{
    "model": "gpt-4o",
    "messages": [{"role": "user", "content": "Hello!"}],
    "max_tokens": 200
  }'
{
  "id": "chatcmpl-xxx",
  "object": "chat.completion",
  "model": "gpt-4o",
  "choices": [
    { "index": 0, "message": { "role": "assistant", "content": "Hi there!" }, "finish_reason": "stop" }
  ],
  "usage": { "prompt_tokens": 5, "completion_tokens": 20, "total_tokens": 25 }
}

Responses API

Newer Responses endpoint for agentic and reasoning workloads.

POST /v1/responses Bearer

Create a response (Responses API).

参数

参数 类型 必填 说明
model string Model ID (openai-response compatible)
input array Input messages or items

示例

curl https://api.onefast.ai/v1/responses 
  -H "Content-Type: application/json" 
  -H "Authorization: Bearer sk-your-api-key" 
  -d '{
    "model": "gpt-5.4",
    "input": "Tell me a short joke"
  }'
{
  "id": "resp_xxx",
  "object": "response",
  "model": "gpt-5.4",
  "output": [
    { "type": "message", "role": "assistant", "content": [{ "type": "output_text", "text": "Why did the ..." }] }
  ]
}

Models & Usage

List available models and check usage / balance.

GET /v1/models Bearer

List all available models.

示例

curl https://api.onefast.ai/v1/models 
  -H "Authorization: Bearer sk-your-api-key"
{
  "object": "list",
  "data": [
    { "id": "gpt-4o", "object": "model", "owned_by": "openai" }
  ]
}
GET /v1/usage Bearer

Query usage and balance.

示例

curl https://api.onefast.ai/v1/usage 
  -H "Authorization: Bearer sk-your-api-key"
{
  "balance": 12.34,
  "total_usage": 88.20
}

Image Generation

Generate images with image-capable models (per-call billing).

POST /v1/images/generations Bearer

Generate an image from a prompt.

参数

参数 类型 必填 说明
model string Image model ID
prompt string Image description
size string e.g. 1024x1024

示例

curl https://api.onefast.ai/v1/images/generations 
  -H "Content-Type: application/json" 
  -H "Authorization: Bearer sk-your-api-key" 
  -d '{
    "model": "gpt-image-2",
    "prompt": "A red panda surfing in space",
    "size": "1024x1024"
  }'
{
  "created": 1730000000,
  "data": [
    { "url": "https://.../generated-image.png" }
  ]
}