OhMyGPT API
English
  • 中文
  • English
  • 日本語
OhMyGPT
OhMyGPT
English
  • 中文
  • English
  • 日本語
  1. Claude
  • Introduction to this site
  • Change log
  • OpenAI
    • Responses
      • Create model response
      • Get model response
      • Delete model response
      • Cancel response
      • List input items
    • Conversations
      • create conversation
      • Retrieve conversation
      • update conversation
      • delete conversation
      • Create items
      • list items
      • Retrieve item
      • Delete item
    • create completion
      POST
    • TTS text to speech
      POST
    • Embeddings
      POST
    • image generation
      POST
    • image editing
      POST
  • Store
    • List chat completions
      POST
    • Get chat completed
      POST
    • Deletion of chat completed
      POST
  • Claude
    • Anthropic native Completions enterprise commercial API
      POST
    • Anthropic native Messages API
      POST
    • Anthropic native Messages Token Count API
      POST
  • OAuth开放API
    • Introduction to Open OAuth API
    • User authorization page
      GET
    • Code display page
      GET
    • Apply for access_token
      POST
    • Read basic user information
      POST
    • Read user balance information
      POST
    • Charge user fees
      POST
    • Create a Stripe Checkout recharge order for the user
      POST
    • Create a Stripe Invoice recharge order for the user
      POST
    • Call other open APIs
      POST
    • Read user management token through OAuth Token
      POST
    • Update user management token through OAuth Token
      POST
  • other
    • search
      • Google Custom Search API
      • Google Search By Serper
    • Azure
      • Azure text-to-speech
      • Azure gets TTS voice list
  • Override rules
    • Create rules
    • Update rules
    • delete rule
    • Get rules
    • list rules
    • Batch enable/disable
    • Copy rules
    • test rules
    • Get statistics
    • Get restriction configuration
    • Check rule name
    • Batch delete
    • Export rules
    • Import rules
  • image generation
    • other
      • ND image generation API
    • Flux
      • Flux Schnell image generation
      • Flux Dev image generation
      • Flux Pro image generation
      • Flux Pro 1.1 image generation
      • Flux 1.1 Pro Ultura image generation
  • Storage service
    • File storage service
    • File upload
    • File information update
    • Delete files
    • User query (pagination)
    • User metadata query (by fileUinqueIds)
    • File download interface (Public file download)
    • File download interface (Private private file download)
    • Obtain public file metadata
  • API KEY management
    • Create new API Key
    • Modify API Key information
    • Query all API Keys of the user
    • Delete the specified API Key
    • Interface for querying user membership expiration date
    • User balance query interface
    • Query the current model magnification interface
  • Archive documents
    • Self-service invoicing system usage documentation
    • Telegram Bot usage documentation
    • Self-built Cloudflare Worker anti-generation tutorial
    • Claude Code forwarding service
    • CodeX forwarding service
    • Introduction to the new website
  • Model list
    GET
  1. Claude

Anthropic native Messages API

line1
https://cn2us02.opapi.win
line1
https://cn2us02.opapi.win
POST
/v1/messages
Updated 24-1123:
The official built-in PDF input function has been supported. To use this function, you need to add pdfs-2024-09-25 in the request header to enable this Beta function:
anthropic-beta: pdfs-2024-09-25, prompt-caching-2024-07-31
Notice:
Regarding Cache cache billing, if you need to use a large amount of cache, then because there are many Anthropic API accounts on the backend of this website to support the usage of all site users, and the Cache between multiple organizational accounts is not shared, in this case you may encounter multiple cache writes but no cache reads are triggered. This is not a bug. For this problem, we are designing a solution to allocate requests that may trigger cache reads to the same Key after the cache is written. After the Feature is online, a notification will be posted in the update log and TG notification channel.
0815 Update: Prompt Cache support has been added to some Claude models, which may save a lot of costs for continuous conversations with very long texts. This feature support is only implemented on the Messages native interface and will take effect with the corresponding request header. For details, please refer to: https://docs.anthropic.com/en/docs/build-with-claude/prompt-caching
Native Claude Messages API compatible interface, input and output are provided as is, API version: anthropic-version: 2023-06-01
24-0405 Update: The latest ToolCall is supported
Note: The request method is slightly different from the native API:
1.
Authentication method: The APIKey can be the same as the OpenAI API, and can be placed in the request header in the format of Bearer Token, or it can be placed in the x-api-key request header.
2.
API version control: anthropic-version header native API is mandatory to fill in, otherwise an error will be reported. Although there is no mandatory requirement here, it is still recommended to fill it in. If not filled in, the latest version will be used by default, such as: 2023-06-01
The supported models are as follows:
claude-3-opus C3 large cup multi-modal
claude-3-sonnet C3 medium cup multi-modal
claude-2
claude-instant-1
For detailed documentation about this API interface, you can directly refer to Anthropic official Messages document
To use this interface, you only need to replace the API domain name and API key with those of this site and then you can debug and use them directly
For example, change https://api.anthropic.com/v1/messages to any of the following:
https://apic.ohmygpt.com/v1/messages
https://aigptx.top/v1/messages
*...
**Also, please pay attention to whether the API key permissions have checked the new model. This is because for security reasons, newly supported models will not affect all old keys. You need to manually check the permissions of these two models for the corresponding APIKey in the key management interface and save them, or create a new API key. **
That is, the current selling price = official price * Anthropic multiple: https://www.anthropic.com/api#pricing
The current limiting policy of this API service is: 6RPM for ordinary users, 60RPM for VIP users, and 480RPM for PREMIUM users.

请求参数

Authorization
在 Header 添加参数
Authorization
,其值为在 Bearer 之后拼接 Token
示例:
Authorization: Bearer ********************
Body 参数application/json

示例

返回响应

🟢200success
application/json
Body

请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://cn2us02.opapi.win/v1/messages' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "model": "claude-3-opus",
    "stream": false,
    "messages": [
        {
            "role": "user",
            "content": "Say test"
        }
    ],
    "max_tokens": 4096
}'
响应示例响应示例
Successful example (NonStream)
{
    "completion": " 你好!我是一个由Anthropic公司开发的AI助手。我叫Clara。我被训练来进行友好、有帮助的对话。很高兴认识你!我希望我们的对话能让你感到开心和放松。如果有什么我可以帮到你的,请一定告诉我。",
    "stop_reason": "stop_sequence",
    "model": "claude-2.0",
    "stop": "\n\nHuman:",
    "log_id": "4fbf887cd2fd3b375d7da3b1cb81231b9401ff023772c8caf6d35bcac7ec9dd5"
}
修改于 2025-10-15 08:07:30
上一页
Anthropic native Completions enterprise commercial API
下一页
Anthropic native Messages Token Count API
Built with