Create an AI model in an organization
POST
CoderSessionTokenheader
Coder-Session-Token<token>organization*stringOrganization name or ID
Model
application/json- body
ai_provider_id?stringFormat
uuidcompression_threshold?integercontext_limit?integerdisplay_name?stringenabled?booleanis_default?booleanmodel?stringmodel_config?Created
application/json- response
ai_provider_id?stringFormat
uuidcompression_threshold?integercontext_limit?integercreated_at?stringFormat
date-timedisplay_name?stringenabled?booleanid?stringFormat
uuidis_default?booleanmodel?stringmodel_config?organization_id?stringFormat
uuidreasoning_efforts?array<string>ReasoningEfforts lists selectable reasoning effort values through the model's configured maximum.
updated_at?stringFormat
date-timeThe samples read CODER_URL and CODER_SESSION_TOKEN: set up your environment.
curl -X POST \ "$CODER_URL/api/v2/organizations/{organization}/chats/models" \ -H "Coder-Session-Token: $CODER_SESSION_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "ai_provider_id": "5a3b8ff9-20e7-4c37-ba1a-5b433e355819", "compression_threshold": 0, "context_limit": 0}'const { CODER_URL, CODER_SESSION_TOKEN } = process.env;const url = `${CODER_URL}/api/v2/organizations/{organization}/chats/models`;const response = await fetch(url, { method: "POST", headers: { "Coder-Session-Token": CODER_SESSION_TOKEN, "Content-Type": "application/json", }, body: JSON.stringify({ ai_provider_id: "5a3b8ff9-20e7-4c37-ba1a-5b433e355819", compression_threshold: 0, context_limit: 0, }),});console.log(response.status, await response.text());import osimport requestsurl = os.environ["CODER_URL"] + "/api/v2/organizations/{organization}/chats/models"token = os.environ["CODER_SESSION_TOKEN"]response = requests.post( url, headers={ "Coder-Session-Token": token, }, json={ "ai_provider_id": "5a3b8ff9-20e7-4c37-ba1a-5b433e355819", "compression_threshold": 0, "context_limit": 0, },)print(response.status_code, response.text)package mainimport ( "fmt" "io" "net/http" "os" "strings")func main() { body := strings.NewReader(`{ "ai_provider_id": "5a3b8ff9-20e7-4c37-ba1a-5b433e355819", "compression_threshold": 0, "context_limit": 0}`) url := os.Getenv("CODER_URL") + "/api/v2/organizations/{organization}/chats/models" token := os.Getenv("CODER_SESSION_TOKEN") req, err := http.NewRequest(http.MethodPost, url, body) if err != nil { panic(err) } req.Header.Set("Coder-Session-Token", token) req.Header.Set("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() out, err := io.ReadAll(resp.Body) if err != nil { panic(err) } fmt.Println(resp.Status, string(out))}Example Response201
{ "ai_provider_id": "5a3b8ff9-20e7-4c37-ba1a-5b433e355819", "compression_threshold": 0, "context_limit": 0, "created_at": "2019-08-24T14:15:22Z", "display_name": "string", "enabled": true, "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "is_default": true, "model": "string", "model_config": { "frequency_penalty": 0, "max_output_tokens": 0, "openai_config": { "reasoning_model": true, "use_responses_api": true }, "presence_penalty": 0, "provider_options": { "anthropic": { "allowed_domains": [ "string" ], "blocked_domains": [ "string" ], "context_1m_enabled": true, "disable_parallel_tool_use": true, "send_reasoning": true, "thinking": { "budget_tokens": 0 }, "thinking_display": "string", "web_search_enabled": true }, "google": { "cached_content": "string", "safety_settings": [ { "category": "string", "threshold": "string" } ], "thinking_config": { "include_thoughts": true, "thinking_budget": 0, "thinking_level": "string" }, "threshold": "string", "web_search_enabled": true }, "openai": { "allowed_domains": [ "string" ], "include": [ "string" ], "instructions": "string", "log_probs": true, "logit_bias": { "property1": 0, "property2": 0 }, "max_completion_tokens": 0, "max_tool_calls": 0, "metadata": { "property1": null, "property2": null }, "parallel_tool_calls": true, "prediction": { "property1": null, "property2": null }, "prompt_cache_key": "string", "reasoning_mode": "string", "reasoning_summary": "string", "safety_identifier": "string", "search_context_size": "string", "service_tier": "string", "store": true, "strict_json_schema": true, "structured_outputs": true, "text_verbosity": "string", "top_log_probs": 0, "user": "string", "web_search_enabled": true }, "openaicompat": { "user": "string" }, "openrouter": { "extra_body": { "property1": null, "property2": null }, "include_usage": true, "log_probs": true, "logit_bias": { "property1": 0, "property2": 0 }, "parallel_tool_calls": true, "provider": { "allow_fallbacks": true, "data_collection": "string", "ignore": [ "string" ], "only": [ "string" ], "order": [ "string" ], "quantizations": [ "string" ], "require_parameters": true, "sort": "string" }, "reasoning": { "enabled": true, "exclude": true, "max_tokens": 0 }, "user": "string" }, "vercel": { "extra_body": { "property1": null, "property2": null }, "logit_bias": { "property1": 0, "property2": 0 }, "logprobs": true, "parallel_tool_calls": true, "providerOptions": { "models": [ "string" ], "order": [ "string" ] }, "reasoning": { "enabled": true, "exclude": true, "max_tokens": 0 }, "top_logprobs": 0, "user": "string" } }, "reasoning_effort": { "default": "string", "max": "string" }, "temperature": 0, "top_k": 0, "top_p": 0 }, "organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6", "reasoning_efforts": [ "string" ], "updated_at": "2019-08-24T14:15:22Z"}