OpenAI: GPT-4 Turbo Preview
openai/gpt-4-turbo-preview
Created Jan 25, 2024128,000 context
$10/M input tokens$30/M output tokens
Providers for GPT-4 Turbo Preview
OpenRouter routes requests to the best providers that are able to handle your prompt size and parameters, with fallbacks to maximize uptime.
US | Context 128K Max Output 4K Input $10 Output $30 |
1.
New API
new
2.54Mtokens
2.
MBX AI
new
650Ktokens
3.
Cbm-Informatica
new
359Ktokens
4.
Mynt
Free AI writing done right
156Ktokens
5.
agent37.ai
new
149Ktokens
6.
github.com/alonsosilvaallende/chatplotlib-openrouter
new
124Ktokens
7.
SillyTavern
LLM frontend for power users
68Ktokens
8.
github.com/OpenRouterTeam/openrouter-examples
new
67Ktokens
9.
APIpie.ai
new
30Ktokens
10.
BioKEA Paper Reviewer
new
29Ktokens
11.
script.4cg.fr
new
23Ktokens
12.
OFS25 Marine Route Forecast
new
22Ktokens
13.
AI Chat Assistant
new
20Ktokens
14.
OpenRouter: Chatroom
Chat with multiple LLMs at once
19Ktokens
15.
Chris Boden's Bookmark Manager
new
17Ktokens
16.
PSL Predictor App
new
17Ktokens
17.
Schreibhorst
new
16Ktokens
18.
Schreibhorst Analyzer
new
12Ktokens
19.
novelcrafter
Your personal novel writing toolbox. Plan, write and tinker with your story.
9Ktokens
20.
xenoCRM
new
8Ktokens
When an error occurs in an upstream provider, we can recover by routing to another healthy provider, if your request filters allow it.
Learn more about our load balancing and customization options.
Sample code and API for GPT-4 Turbo Preview
OpenRouter normalizes requests and responses across providers for you.
OpenRouter provides an OpenAI-compatible completion API to 300+ models & providers that you can call directly, or using the OpenAI SDK. Additionally, some third-party SDKs are available.
In the examples below, the OpenRouter-specific headers are optional. Setting them allows your app to appear on the OpenRouter leaderboards.
from openai import OpenAI
client = OpenAI(
base_url="https://openrouter.ai/api/v1",
api_key="<OPENROUTER_API_KEY>",
)
completion = client.chat.completions.create(
extra_headers={
"HTTP-Referer": "<YOUR_SITE_URL>", # Optional. Site URL for rankings on openrouter.ai.
"X-Title": "<YOUR_SITE_NAME>", # Optional. Site title for rankings on openrouter.ai.
},
extra_body={},
model="openai/gpt-4-turbo-preview",
messages=[
{
"role": "user",
"content": "What is the meaning of life?"
}
]
)
print(completion.choices[0].message.content)
Using third-party SDKs
For information about using third-party SDKs and frameworks with OpenRouter, please see our frameworks documentation.
See the Request docs for all possible fields, and Parameters for explanations of specific sampling parameters.