Yn llwytho rhyngwyneb Shannon...
API AI cydnaws â OpenAI ac Anthropic gyda galwadau swyddogaeth, chwilio gwe a allbynnau strwythuredig.
Popeth sydd ei angen i lansio gyda API cydnaws OpenAI ac Anthropic Shannon.
https://us-central1-shannonai.cloudfunctions.net/v1/chat/completionsUse the Chat Completions API with function calling and streaming.
https://us-central1-shannonai.cloudfunctions.net/v1/messagesClaude Messages format with tools and anthropic-version header.
Authorization: Bearer <api-key>Or X-API-Key with anthropic-version for Claude-style calls.
Public docs - Key required to callStreaming, function calling, structured outputs, web search.
Disodli uniongyrchol i OpenAI ac Anthropic gyda chefnogaeth frodorol i offer, allbynnau strwythuredig a chwilio gwe adeiledig.
Yn gweithio gyda SDK OpenAI ac Anthropic. Newidiwch yr URL sylfaen yn unig.
Diffiniwch offer, gadewch i Shannon eu galw. Yn cefnogi moddau auto, forced a none.
Chwiliad gwe amser real gyda dyfyniadau ffynonellau. Ar gael yn awtomatig.
Modd JSON a gorfodi JSON Schema ar gyfer tynnu data dibynadwy.
Dolennu gweithrediad swyddogaeth awtomatig. Hyd at 10 iteriad fesul cais.
Server‑sent events ar gyfer ffrydio token amser real.
Dechreuwch mewn tri cham. Mae Shannon yn efelychu cleientiaid OpenAI ac Anthropic.
Defnyddiwch endpoint sy’n gydnaws ag OpenAI.
https://us-central1-shannonai.cloudfunctions.net/v1/chat/completionsDefnyddiwch Bearer auth yn y pennawd Authorization.
Dewiswch iaith a rhowch eich allwedd.
from openai import OpenAIclient = OpenAI(api_key="YOUR_API_KEY",base_url="https://us-central1-shannonai.cloudfunctions.net/v1")response = client.chat.completions.create(model="shannon-balanced-grpo",messages=[{"role": "system", "content": "You are a helpful assistant."},{"role": "user", "content": "Hello, Shannon!"}],max_tokens=1024)print(response.choices[0].message.content)
{
"id": "chatcmpl-abc123",
"object": "chat.completion",
"created": 1234567890,
"model": "shannon-balanced-grpo",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "Hello! I'm Shannon, your AI assistant. How can I help you today?"
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 25,
"completion_tokens": 18,
"total_tokens": 43
}
}Profi API Shannon yn uniongyrchol yn eich porwr. Adeiladwch y cais, rhedwch ef, a gweld yr ymateb mewn amser real.
Switch between Chat Completions, Responses, and Messages without changing pages. The request body, auth header, stream parser, and SDK snippets all follow the selected protocol.
Pick an endpoint, shape the payload, and run the request to inspect the live output.
{"model": "shannon-balanced-grpo","messages": [{"role": "system","content": "You are Shannon. Answer crisply, commercially, and with strong structure."},{"role": "user","content": "Outline a clean launch plan for a new AI API aimed at startup founders."}],"max_tokens": 1024,"temperature": 0.7,"stream": true}
Mae pob cais API yn gofyn am ddilysu gan ddefnyddio eich allwedd API Shannon.
Authorization: Bearer YOUR_API_KEY
X-API-Key: YOUR_API_KEYanthropic-version: 2023-06-01
Mae Shannon yn cynnig sawl model wedi'u optimeiddio ar gyfer gwahanol achosion defnydd.
shannon-balanced-grpoBalancedFast, efficient responses for everyday tasks
shannon-deep-dapoDeepAdvanced reasoning for complex problems
shannon-coder-1CoderOptimized for Claude Code CLI with call-based quota
Diffiniwch offer y gall Shannon eu galw i gyflawni gweithredoedd neu adfer gwybodaeth.
from openai import OpenAIimport jsonclient = OpenAI(api_key="YOUR_API_KEY",base_url="https://us-central1-shannonai.cloudfunctions.net/v1")# Define available tools/functionstools = [{"type": "function","function": {"name": "get_weather","description": "Get current weather for a location","parameters": {"type": "object","properties": {"location": {"type": "string","description": "City name, e.g., 'Tokyo'"},"unit": {"type": "string","enum": ["celsius", "fahrenheit"]}},"required": ["location"]}}}]response = client.chat.completions.create(model="shannon-balanced-grpo",messages=[{"role": "user", "content": "What's the weather in Tokyo?"}],tools=tools,tool_choice="auto")# Check if model wants to call a functionif response.choices[0].message.tool_calls:tool_call = response.choices[0].message.tool_calls[0]print(f"Function: {tool_call.function.name}")print(f"Arguments: {tool_call.function.arguments}")
{
"id": "chatcmpl-xyz",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": null,
"tool_calls": [
{
"id": "call_abc123",
"type": "function",
"function": {
"name": "get_weather",
"arguments": "{\"location\": \"Tokyo\", \"unit\": \"celsius\"}"
}
}
]
},
"finish_reason": "tool_calls"
}
]
}Gorfodwch Shannon i ymateb gyda JSON dilys sy'n cyfateb i'ch sgema.
from openai import OpenAIclient = OpenAI(api_key="YOUR_API_KEY",base_url="https://us-central1-shannonai.cloudfunctions.net/v1")# Force JSON output with schemaresponse = client.chat.completions.create(model="shannon-balanced-grpo",messages=[{"role": "user", "content": "Extract: John Doe, 30 years old, engineer"}],response_format={"type": "json_schema","json_schema": {"name": "person_info","schema": {"type": "object","properties": {"name": {"type": "string"},"age": {"type": "integer"},"occupation": {"type": "string"}},"required": ["name", "age", "occupation"]}}})import jsondata = json.loads(response.choices[0].message.content)print(data) # {"name": "John Doe", "age": 30, "occupation": "engineer"}
Galluogi ffrydio tocynnau amser real gyda Server‑Sent Events ar gyfer UI ymatebol.
from openai import OpenAIclient = OpenAI(api_key="YOUR_API_KEY",base_url="https://us-central1-shannonai.cloudfunctions.net/v1")# Enable streaming for real-time responsesstream = client.chat.completions.create(model="shannon-balanced-grpo",messages=[{"role": "user", "content": "Write a short poem about AI"}],stream=True)for chunk in stream:if chunk.choices[0].delta.content:print(chunk.choices[0].delta.content, end="", flush=True)
Mae Shannon yn cynnwys swyddogaeth web_search adeiledig sydd ar gael yn awtomatig.
from openai import OpenAIclient = OpenAI(api_key="YOUR_API_KEY",base_url="https://us-central1-shannonai.cloudfunctions.net/v1")# Web search is automatically available!# Shannon will use it when needed for current informationresponse = client.chat.completions.create(model="shannon-balanced-grpo",messages=[{"role": "user", "content": "What are the latest AI news today?"}],# Optionally, explicitly define web_search tooltools=[{"type": "function","function": {"name": "web_search","description": "Search the web for current information","parameters": {"type": "object","properties": {"query": {"type": "string", "description": "Search query"}},"required": ["query"]}}}])print(response.choices[0].message.content)# Response includes sources and citations
Mae Shannon hefyd yn cefnogi fformat Messages API Anthropic.
https://us-central1-shannonai.cloudfunctions.net/v1/messagesimport anthropicclient = anthropic.Anthropic(api_key="YOUR_API_KEY",base_url="https://us-central1-shannonai.cloudfunctions.net/messages")response = client.messages.create(model="shannon-balanced-grpo",max_tokens=1024,messages=[{"role": "user", "content": "Hello, Shannon!"}],# Tool use (Anthropic format)tools=[{"name": "web_search","description": "Search the web","input_schema": {"type": "object","properties": {"query": {"type": "string"}},"required": ["query"]}}])print(response.content[0].text)
Defnyddiwch unrhyw SDK OpenAI neu Anthropic — dim ond newid yr URL sylfaenol.
Mae Shannon yn defnyddio codau statws HTTP safonol ac yn dychwelyd negeseuon gwall manwl.
{
"error": {
"message": "Invalid API key provided",
"type": "authentication_error",
"code": "invalid_api_key"
}
}Diweddariadau a gwelliannau diweddar i API Shannon.
Cael eich allwedd API a dechrau adeiladu gyda Shannon AI heddiw.