Create an Anthropic message
curl --request POST \
--url https://api.bianxie.ai/v1/messagesimport requests
url = "https://api.bianxie.ai/v1/messages"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.bianxie.ai/v1/messages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.bianxie.ai/v1/messages",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.bianxie.ai/v1/messages"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.bianxie.ai/v1/messages")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bianxie.ai/v1/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodyAnthropic
Create an Anthropic message
Generate a response using the Anthropic Messages format
POST
/
v1
/
messages
Create an Anthropic message
curl --request POST \
--url https://api.bianxie.ai/v1/messagesimport requests
url = "https://api.bianxie.ai/v1/messages"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.bianxie.ai/v1/messages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.bianxie.ai/v1/messages",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.bianxie.ai/v1/messages"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.bianxie.ai/v1/messages")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.bianxie.ai/v1/messages")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodyInclude
The response has
x-api-key: API_KEY, anthropic-version: 2023-06-01, and Content-Type: application/json.
| Field | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Model ID. |
messages | array | Yes | User and assistant messages with text or content blocks. |
max_tokens | integer | Yes | Maximum generated tokens. |
system | string/array | No | System instruction. |
stream | boolean | No | Return SSE events. |
temperature, top_p, top_k | number | No | Sampling controls. |
stop_sequences | array | No | Custom stop sequences. |
tools, tool_choice, metadata | mixed | No | Tools, selection policy, and request metadata. |
curl https://api.bianxie.ai/v1/messages \
-H "x-api-key: API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "your-model",
"max_tokens": 1024,
"messages": [{"role": "user", "content": "Hello"}]
}'
client.messages.create(model="your-model", max_tokens=1024, messages=[{"role":"user","content":"Hello"}])
await client.messages.create({ model: "your-model", max_tokens: 1024, messages: [{ role: "user", content: "Hello" }] });
id, type, role, content[], model, stop_reason, stop_sequence, and usage. Streaming returns message, content-block, and ping events.⌘I
