sapiom

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Sapiom

Sapiom

Instant access to paid services with pay-per-use pricing. No vendor account setup required.
按次付费,即刻访问各类付费服务。无需设置供应商账户。

Documentation

文档

How It Works

工作原理

The SDK wraps your HTTP client (Axios or Fetch) and automatically handles payment negotiation with Sapiom service gateways. Each service is hosted at
{provider}.services.sapiom.ai
and proxies to the underlying vendor API.
When to use: Node.js/TypeScript projects. For Python or other languages, use the SDK patterns with standard HTTP clients — the payment flow requires the SDK.
typescript
import { withSapiom } from "@sapiom/axios";
import axios from "axios";

const client = withSapiom(axios.create(), {
  apiKey: process.env.SAPIOM_API_KEY,
});

// Search the web with Linkup
const { data } = await client.post(
  "https://linkup.services.sapiom.ai/v1/search",
  { q: "quantum computing", depth: "standard", outputType: "sourcedAnswer" }
);
Service URLs:
ServiceBase URL
Verify
https://prelude.services.sapiom.ai
Search (Linkup)
https://linkup.services.sapiom.ai
Search (You.com)
https://you-com.services.sapiom.ai
AI Models
https://openrouter.services.sapiom.ai
Images
https://fal.services.sapiom.ai
Audio
https://elevenlabs.services.sapiom.ai
Browser
https://anchor-browser.services.sapiom.ai
SDK会封装你的HTTP客户端(Axios或Fetch),并自动处理与Sapiom服务网关的支付协商。每个服务都托管在
{provider}.services.sapiom.ai
,并代理到底层供应商API。
适用场景: Node.js/TypeScript项目。对于Python或其他语言,请结合标准HTTP客户端使用SDK模式——支付流程需要依赖该SDK。
typescript
import { withSapiom } from "@sapiom/axios";
import axios from "axios";

const client = withSapiom(axios.create(), {
  apiKey: process.env.SAPIOM_API_KEY,
});

// Search the web with Linkup
const { data } = await client.post(
  "https://linkup.services.sapiom.ai/v1/search",
  { q: "quantum computing", depth: "standard", outputType: "sourcedAnswer" }
);
服务URL:
服务基础URL
Verify
https://prelude.services.sapiom.ai
Search (Linkup)
https://linkup.services.sapiom.ai
Search (You.com)
https://you-com.services.sapiom.ai
AI Models
https://openrouter.services.sapiom.ai
Images
https://fal.services.sapiom.ai
Audio
https://elevenlabs.services.sapiom.ai
Browser
https://anchor-browser.services.sapiom.ai

Setup

设置步骤

  1. Get your API key from https://app.sapiom.ai/settings
  2. Set environment variable:
    bash
    export SAPIOM_API_KEY="your_key"
  3. Install the SDK:
    bash
    npm install @sapiom/axios axios
    # or
    npm install @sapiom/fetch
  1. https://app.sapiom.ai/settings获取你的API密钥
  2. 设置环境变量:
    bash
    export SAPIOM_API_KEY="your_key"
  3. 安装SDK:
    bash
    npm install @sapiom/axios axios
    # or
    npm install @sapiom/fetch

Quick Reference

快速参考

Verify (Prelude)

Verify (Prelude)

typescript
// Send code
await client.post("https://prelude.services.sapiom.ai/verifications", {
  target: { type: "phone_number", value: "+15551234567" },
});
// Check code
await client.post("https://prelude.services.sapiom.ai/verifications/check", {
  verificationRequestId: "id-from-send", code: "123456",
});
typescript
// 发送验证码
await client.post("https://prelude.services.sapiom.ai/verifications", {
  target: { type: "phone_number", value: "+15551234567" },
});
// 验证验证码
await client.post("https://prelude.services.sapiom.ai/verifications/check", {
  verificationRequestId: "id-from-send", code: "123456",
});

Search (Linkup)

Search (Linkup)

typescript
await client.post("https://linkup.services.sapiom.ai/v1/search", {
  q: "query", depth: "standard", outputType: "sourcedAnswer",
});
typescript
await client.post("https://linkup.services.sapiom.ai/v1/search", {
  q: "query", depth: "standard", outputType: "sourcedAnswer",
});

AI Models (OpenRouter) — OpenAI-compatible

AI Models (OpenRouter) — OpenAI兼容

typescript
await client.post("https://openrouter.services.sapiom.ai/v1/chat/completions", {
  model: "openai/gpt-4o-mini",
  messages: [{ role: "user", content: "Hello" }],
  max_tokens: 100,
});
typescript
await client.post("https://openrouter.services.sapiom.ai/v1/chat/completions", {
  model: "openai/gpt-4o-mini",
  messages: [{ role: "user", content: "Hello" }],
  max_tokens: 100,
});

Images (Fal.ai)

Images (Fal.ai)

typescript
await client.post("https://fal.services.sapiom.ai/v1/run/fal-ai/flux/dev", {
  prompt: "A mountain landscape at sunset", image_size: "landscape_4_3",
});
typescript
await client.post("https://fal.services.sapiom.ai/v1/run/fal-ai/flux/dev", {
  prompt: "A mountain landscape at sunset", image_size: "landscape_4_3",
});

Audio (ElevenLabs)

Audio (ElevenLabs)

typescript
// TTS — returns binary audio
await client.post(
  "https://elevenlabs.services.sapiom.ai/v1/text-to-speech/EXAVITQu4vr4xnSDxMaL",
  { text: "Hello world", model_id: "eleven_multilingual_v2" },
  { responseType: "arraybuffer" }
);
typescript
// TTS — 返回二进制音频
await client.post(
  "https://elevenlabs.services.sapiom.ai/v1/text-to-speech/EXAVITQu4vr4xnSDxMaL",
  { text: "Hello world", model_id: "eleven_multilingual_v2" },
  { responseType: "arraybuffer" }
);

Browser (Anchor)

Browser (Anchor)

typescript
// Extract content
await client.post("https://anchor-browser.services.sapiom.ai/v1/tools/fetch-webpage", {
  url: "https://example.com", format: "markdown",
});
// Screenshot
await client.post("https://anchor-browser.services.sapiom.ai/v1/tools/screenshot", {
  url: "https://example.com", width: 1280, height: 720,
});
typescript
// 提取内容
await client.post("https://anchor-browser.services.sapiom.ai/v1/tools/fetch-webpage", {
  url: "https://example.com", format: "markdown",
});
// 截图
await client.post("https://anchor-browser.services.sapiom.ai/v1/tools/screenshot", {
  url: "https://example.com", width: 1280, height: 720,
});

Navigating Documentation

文档导航

Append
.md
to any docs URL to get the raw markdown:
HTML PageMarkdown
https://docs.sapiom.ai/capabilities/search
https://docs.sapiom.ai/capabilities/search.md
https://docs.sapiom.ai/using-services
https://docs.sapiom.ai/using-services.md
For full endpoint details, parameters, and pricing — always fetch the docs.
在任意文档URL后添加
.md
即可获取原始Markdown内容:
HTML页面Markdown
https://docs.sapiom.ai/capabilities/search
https://docs.sapiom.ai/capabilities/search.md
https://docs.sapiom.ai/using-services
https://docs.sapiom.ai/using-services.md
如需完整的端点详情、参数及定价信息,请务必查看文档。