Add a connection: OpenRouter API key
curl --request POST \
--url https://api.runaether.dev/connections/openrouter-api-key \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"api_key": "<string>",
"name": "<string>"
}
'import requests
url = "https://api.runaether.dev/connections/openrouter-api-key"
payload = {
"api_key": "<string>",
"name": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({api_key: '<string>', name: '<string>'})
};
fetch('https://api.runaether.dev/connections/openrouter-api-key', 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.runaether.dev/connections/openrouter-api-key",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'api_key' => '<string>',
'name' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.runaether.dev/connections/openrouter-api-key"
payload := strings.NewReader("{\n \"api_key\": \"<string>\",\n \"name\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
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.runaether.dev/connections/openrouter-api-key")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"api_key\": \"<string>\",\n \"name\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.runaether.dev/connections/openrouter-api-key")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"api_key\": \"<string>\",\n \"name\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"option": "claude_plan",
"reauth": {
"reason": "<string>"
},
"limits": [
{
"reason": "<string>",
"scope": "session",
"until": "2023-11-07T05:31:56Z"
}
],
"profiles": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"org": "<string>"
}
]
}{
"code": "aether_inference_unavailable",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "aether_inference_unavailable",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "org_membership_required",
"error": "<string>"
}{
"code": "aether_inference_unavailable",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "aether_inference_unavailable",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "aether_inference_unavailable",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "aether_inference_unavailable",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}Connections
Add a connection: OpenRouter API key
Stores a new openrouter_api_key connection under its name, leaving every other connection in place.
Use this tool when you need to:
- Connect an OpenRouter API key so the caller's OpenCode tasks can run on it
- Add another OpenRouter API key beside one the caller already holds, under its own name
Examples:
- POST /connections/openrouter-api-key {"name": "OpenRouter", "api_key": "sk-or-v1-0123456789abcdef"}
Hints:
- name is required: 1 to 100 characters on one line, with no space, tab, form feed or carriage return at either end; the schema answers 422 otherwise, and a name it admits is stored as sent.
- api_key is required: sk-or- then one or more non-space characters, surrounding whitespace trimmed. The schema answers 422 for any other shape, and a key it admits that the handler's vendor-format check refuses is 422 too, neither with a code.
- Answers 201 with the connection: option openrouter_api_key, id, name, key_suffix (the key's last four characters, for a key of at least eight) and reauth null, never the key. It becomes the OpenCode default when the caller has none; a default the caller has stays.
- Use addOpencodeAuthFileConnection instead to connect OpenCode through its auth.json, reconnectConnection to replace the key of a connection the caller holds and keep its id, and setDefaultConnection to make it the default.
- Any signed-in user may call it for themselves; through a platform API key pinned to an org where the caller is a viewer or billing member it is refused with 403 org_role_insufficient, and an agent host's grant with 403 agent_host_route_not_allowed.
- Refused with 409 connection_name_taken when the caller already uses the name for an OpenRouter API key.
POST
/
connections
/
openrouter-api-key
Add a connection: OpenRouter API key
curl --request POST \
--url https://api.runaether.dev/connections/openrouter-api-key \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"api_key": "<string>",
"name": "<string>"
}
'import requests
url = "https://api.runaether.dev/connections/openrouter-api-key"
payload = {
"api_key": "<string>",
"name": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({api_key: '<string>', name: '<string>'})
};
fetch('https://api.runaether.dev/connections/openrouter-api-key', 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.runaether.dev/connections/openrouter-api-key",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'api_key' => '<string>',
'name' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.runaether.dev/connections/openrouter-api-key"
payload := strings.NewReader("{\n \"api_key\": \"<string>\",\n \"name\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
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.runaether.dev/connections/openrouter-api-key")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"api_key\": \"<string>\",\n \"name\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.runaether.dev/connections/openrouter-api-key")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"api_key\": \"<string>\",\n \"name\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"option": "claude_plan",
"reauth": {
"reason": "<string>"
},
"limits": [
{
"reason": "<string>",
"scope": "session",
"until": "2023-11-07T05:31:56Z"
}
],
"profiles": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"org": "<string>"
}
]
}{
"code": "aether_inference_unavailable",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "aether_inference_unavailable",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "org_membership_required",
"error": "<string>"
}{
"code": "aether_inference_unavailable",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "aether_inference_unavailable",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "aether_inference_unavailable",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}{
"code": "aether_inference_unavailable",
"error": "<string>",
"errors": [
{
"location": "<string>",
"message": "<string>",
"value": "<unknown>"
}
]
}Authorizations
Body
application/json
Response
Created
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
- Option 7
One connection you hold, a variant per option: which credential it holds, qualified by its vendor. reauth is null while the stored credential works.